The field 'environment' has an invalid value, which includes an undefined variable. The error was: 'ssh_args_default' is undefined

This one is new for me, any idea what might cause it? Project scaffolded today with latest trellis-cli

virtualenv ❯ trellis deploy staging
Running command => ansible-playbook deploy.yml -e env=staging site=domain.tld
[WARNING]: Skipping plugin (/Users/user/WWW/domain.tld/trellis/lib/t
rellis/plugins/callback/vars.py) as it seems to be invalid: cannot import name
'cli' from '__main__'
(/Users/user/WWW/domain.tld/trellis/.trellis/virtualenv/bin/ansible-
playbook)

PLAY [Ensure necessary variables are defined] **********************************

TASK [Ensure environment is defined] *******************************************
skipping: [localhost]

PLAY [Test Connection] *********************************************************

TASK [connection : Require manual definition of remote-user] *******************
skipping: [x.x.x.x]

TASK [connection : Specify preferred HostKeyAlgorithms for unknown hosts] ******
skipping: [x.x.x.x]

TASK [connection : Check whether Ansible can connect as domain] ************
System info:
  Ansible 2.13.1; Darwin
  Trellis version (per changelog): "Add built-in fail2ban filters"
---------------------------------------------------
The field 'environment' has an invalid value, which includes an undefined
variable. The error was: 'ssh_args_default' is undefined

The error appears to be in '/Users/user/WWW/domain.tld/trellis/rol
es/connection/tasks/main.yml': line 18, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Check whether Ansible can connect as {{ dynamic_user | default(true)
| ternary('root', web_user) }}
  ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:

    with_items:
      - {{ foo }}

Should be written as:

    with_items:
      - "{{ foo }}"
fatal: [x.x.x.x -> localhost]: FAILED! => {}

PLAY RECAP *********************************************************************
x.x.x.x             : ok=0    changed=0    unreachable=0    failed=1    skipped=2    rescued=0    ignored=0
localhost                  : ok=0    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0

exit status 2

I’ve posted a workaround for this in a bug report.

I hope that helps.

5 Likes