Skip to content

community.general.yarn throws errors due to --non-interactive and --production args #9909

Open
@jeffbyrnes

Description

@jeffbyrnes

Summary

Similar to #4661, the community.general.yarn runs into a YN0050 error with Yarn stable, aka Yarn 2, with two flags it uses:

  • --non-interactive - this is always applied, and thus every run against Yarn stable errors
  • --production - this is controlled by an identically-named Ansible module parameter

The latter defaults to false, but some documentation should probably be added to clarify it only works for Yarn Classic.

The former, however, just totally breaks this module from working:

fatal: [host]: FAILED! => {"changed": false, "cmd": "/usr/bin/yarn install --non-interactive", "msg": "", "rc": 1, "stderr": "", "stderr_lines": [], "stdout": "➤ YN0050: The --non-interactive option is deprecated\n", "stdout_lines": ["➤ YN0050: The --non-interactive option is deprecated"]}

Issue Type

Bug Report

Component Name

yarn

Ansible Version

$ ansible --version
ansible [core 2.18.1]
  config file = /Users/jeffbyrnes/.ansible.cfg
  configured module search path = ['/Users/jeffbyrnes/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/jeffbyrnes/dev/better-boston-ansible/.venv/lib/python3.13/site-packages/ansible
  ansible collection location = /Users/jeffbyrnes/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/jeffbyrnes/dev/better-boston-ansible/.venv/bin/ansible
  python version = 3.13.2 (main, Feb  4 2025, 14:51:09) [Clang 16.0.0 (clang-1600.0.26.6)] (/Users/jeffbyrnes/dev/better-boston-ansible/.venv/bin/python3.13)
  jinja version = 3.1.5
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

# /Users/jeffbyrnes/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 10.4.0

# /opt/homebrew/Cellar/ansible/11.3.0/libexec/lib/python3.13/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 10.4.0

Configuration

$ ansible-config dump --only-changed
CONFIG_FILE() = /Users/jeffbyrnes/.ansible.cfg
EDITOR(env: EDITOR) = code -w

GALAXY_SERVERS:

OS / Environment

Ubuntu 20.04.6

Steps to Reproduce

    - name: Install Yarn dependencies
      community.general.yarn:
        path: /home/mastodon/boston
ansible-playbook -f 10 -i inventories/production/hosts mastodon.yaml

Expected Results

I expected yarn install to successfully run at the path /home/mastodon/boston.

Actual Results

I’ve stripped out the SSH debug{1,2,3} messages to make this more legible.

ansible-playbook -vvvv -f 10 -i inventories/production/hosts mastodon-repo.yml
ansible-playbook [core 2.18.3]
  config file = /Users/jeffbyrnes/.ansible.cfg
  configured module search path = ['/Users/jeffbyrnes/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/11.3.0/libexec/lib/python3.13/site-packages/ansible
  ansible collection location = /Users/jeffbyrnes/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible-playbook
  python version = 3.13.2 (main, Feb  4 2025, 14:51:09) [Clang 16.0.0 (clang-1600.0.26.6)] (/opt/homebrew/Cellar/ansible/11.3.0/libexec/bin/python)
  jinja version = 3.1.5
  libyaml = True
Using /Users/jeffbyrnes/.ansible.cfg as config file
setting up inventory plugins
Loading collection ansible.builtin from
host_list declined parsing /Users/jeffbyrnes/dev/better-boston-ansible/inventories/production/hosts as it did not pass its verify_file() method
script declined parsing /Users/jeffbyrnes/dev/better-boston-ansible/inventories/production/hosts as it did not pass its verify_file() method
auto declined parsing /Users/jeffbyrnes/dev/better-boston-ansible/inventories/production/hosts as it did not pass its verify_file() method
Parsed /Users/jeffbyrnes/dev/better-boston-ansible/inventories/production/hosts inventory source with ini plugin
Loading collection community.general from /Users/jeffbyrnes/.ansible/collections/ansible_collections/community/general
Loading callback plugin default of type stdout, v2.0 from /opt/homebrew/Cellar/ansible/11.3.0/libexec/lib/python3.13/site-packages/ansible/plugins/callback/default.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: mastodon-repo.yml ***************************************************************************************************************************************************************************************************
Positional arguments: mastodon-repo.yml
verbosity: 4
connection: ssh
become_method: sudo
tags: ('all',)
inventory: ('/Users/jeffbyrnes/dev/better-boston-ansible/inventories/production/hosts',)
forks: 10
1 plays in mastodon-repo.yml

PLAY [Clone Mastodon repo] ****************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ********************************************************************************************************************************************************************************************************
# <snip>

TASK [Install Yarn dependencies] **********************************************************************************************************************************************************************************************
task path: /Users/jeffbyrnes/dev/better-boston-ansible/mastodon-repo.yml:19
# <snip>
Using module file /Users/jeffbyrnes/.ansible/collections/ansible_collections/community/general/plugins/modules/yarn.py
# <snip>
<hostname> (1, b'\r\n{"cmd": "/usr/bin/yarn install --non-interactive", "rc": 1, "stdout": "\\u27a4 YN0050: The --non-interactive option is deprecated\\n", "stderr": "", "failed": true, "msg": "", "invocation": {"module_args": {"path": "/home/mastodon/boston", "production": false, "state": "present", "ignore_scripts": false, "global": false, "name": null, "version": null, "executable": null, "registry": null}}}\r\n', b"OpenSSH_9.8p1, LibreSSL 3.3.6\r\ndebug1: Reading configuration data /Users/jeffbyrnes/.ssh/config\r\ndebug3: /Users/jeffbyrnes/.ssh/config line 1: Including file /Users/jeffbyrnes/.orbstack/ssh/config depth 0\r\ndebug1: Reading configuration data /Users/jeffbyrnes/.orbstack/ssh/config\r\ndebug1: /Users/jeffbyrnes/.ssh/config line 26: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files\r\ndebug1: /etc/ssh/ssh_config line 54: Applying options for *\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/Users/jeffbyrnes/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/Users/jeffbyrnes/.ssh/known_hosts2'\r\ndebug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling\r\ndebug1: auto-mux: Trying existing master at '/tmp/ansible-ssh-hostname-22-root'\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 41071\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet_timeout: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\nShared connection to hostname closed.\r\n")
# <snip>
fatal: [hostname]: FAILED! => {
    "changed": false,
    "cmd": "/usr/bin/yarn install --non-interactive",
    "invocation": {
        "module_args": {
            "executable": null,
            "global": false,
            "ignore_scripts": false,
            "name": null,
            "path": "/home/mastodon/boston",
            "production": false,
            "registry": null,
            "state": "present",
            "version": null
        }
    },
    "msg": "",
    "rc": 1,
    "stderr": "",
    "stderr_lines": [],
    "stdout": "➤ YN0050: The --non-interactive option is deprecated\n",
    "stdout_lines": [
        "➤ YN0050: The --non-interactive option is deprecated"
    ]
}

PLAY RECAP ********************************************************************************************************************************************************************************************************************
hostname         : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions