I’m getting an error when trying to provision a remote server:
System info:
Ansible 2.11.1; Darwin
Trellis version (per changelog): “Improve handling of PHP versions and support PHP 8.0”
---------------------------------------------------
The conditional check ‘not (not ansible_ssh_extra_args)’ failed. The error
was: error while evaluating conditional (not (not ansible_ssh_extra_args)):
‘ansible_ssh_extra_args’ is undefined
The error appears to be in '/Users/james/Sites/square-
mile/trellis/roles/connection/tasks/main.yml': line 9, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Specify preferred HostKeyAlgorithms for unknown hosts
^ here
fatal: [138.68.144.64]: FAILED! => {}
PLAY RECAP **********************************************************************************************************************************
138.68.144.64 : ok=0 changed=0 unreachable=0 failed=1 skipped=1 rescued=0 ignored=0
localhost : ok=0 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
Provision has always gone fine for me before, any ideas?
Thanks for your help starsis, that didn’t work but I have managed to fix it it seems.
I think it was just an issue with my ansible. I tried to update it last week and it throw some errors, I thought i’d navigated them and updated, but it must not have properly updated. I’m not quite sure what the fix was in the end, but I temporarily renamed some folders in in Library > Python … > ansible and installed again and have now managed to provision a server and deploy to another one.
With Ansible v2.9.23 as installed via Trellis-cli, same with Ansible v2.10.11.
Also tried using
v2.8 for ERROR! Unexpected Exception, this is probably a bug: cannot pickle '_io.TextIOWrapper' object)
v2.9.0 for ERROR! Unexpected Exception, this is probably a bug: cannot pickle 'module' object.
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 '/Volumes/Ochosi/Clients/Client/example.com/trellis/roles/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: [157.230.58.##]: FAILED! => {}
You are so dope, @strarsis. What would I do without you.
In my case, the only difference in the plugins/callback/vars.py file was that I had this line in there:
# handle Ansible 2.7 and 2.8 cases by normalizing each into a dict
- try:
- from ansible import context
I think I had restored that line in initial troubleshooting, following having rebased my local Trellis codebase.
I am using Ansible v10. What I think may have solved the issue for me is that at some point in my hacking, I had added quotes around {{ dynamic_user | default(true) | ternary('root', web_user) }}.
So, sadly, I’m not sure what exactly caused the error in the first place.