New in version 2.6.
The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments |
---|---|---|
executable | The executable location for yarn. | |
global bool |
| Install the node.js library globally |
ignore_scripts bool |
| Use the --ignore-scripts flag when installing. |
name | The name of a node.js library to install If omitted all packages in package.json are installed. | |
path | The base path where Node.js libraries will be installed. This is where the node_modules folder lives. | |
production bool |
| Install dependencies in production mode. Yarn will ignore any dependencies under devDependencies in package.json |
registry | The registry to install modules from. | |
state |
| Installation state of the named node.js library If absent is selected, a name option must be provided |
version | The version of the library to be installed. Must be in semver format. If "latest" is desired, use "state" arg instead |
- name: Install "imagemin" node.js package. yarn: name: imagemin path: /app/location - name: Install "imagemin" node.js package on version 5.3.1 yarn: name: imagemin version: '5.3.1' path: /app/location - name: Install "imagemin" node.js package globally. yarn: name: imagemin global: yes - name: Remove the globally-installed package "imagemin". yarn: name: imagemin global: yes state: absent - name: Install "imagemin" node.js package from custom registry. yarn: name: imagemin registry: 'http://registry.mysite.com' - name: Install packages based on package.json. yarn: path: /app/location - name: Update all packages in package.json to their latest version. yarn: path: /app/location state: latest
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
changed boolean | always | Whether Yarn changed any package data Sample: True |
invocation dictionary | success | Parameters and values used during execution Sample: {'module_args': {'executable': None, 'name': None, 'ignore_scripts': False, 'globally': False, 'state': 'present', 'production': False, 'registry': None, 'version': None, 'path': '/some/path/folder'}} |
msg string | failure | Provides an error message if Yarn syntax was incorrect Sample: Package must be explicitly named when uninstalling. |
out string | always | Output generated from Yarn with emojis removed. Sample: yarn add v0.16.1[1/4] Resolving packages...[2/4] Fetching packages...[3/4] Linking dependencies...[4/4] Building fresh packages...success Saved lockfile.success Saved 1 new [email protected] Done in 0.59s. |
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.7/modules/yarn_module.html