Package_vars_wrong_format after Ansible and Trellis update

Hi, everyone. Here’s a question that betrays how little I really understand about Ansible.

After a recent update to ansible 2.4.1.0, and a merge of recent Trellis changes, I’m getting the following when trying to reprovision an existing server. I haven’t tried provisioning a new server from this repo yet.

I ran into this while trying to test the fix for the LetsEncrypt issue from this morning. I got around it by running ansible-playbook server.yml -e env=staging --tags letsencrypt which works fine.

Here’s the error (sanitized to remove my site name and directory path):

The conditional check 'package_vars_wrong_format | count' failed. The error
was: error while evaluating conditional (package_vars_wrong_format | count):
[{% for k,v in package_vars.iteritems() if v | type_debug != 'dict' %}'{{ k
}}',{% endfor %}]: {u'apt_packages_custom': u'{{ apt_packages_custom }}',
u'memcached_packages_custom': u'{{ memcached_packages_custom }}',
u'sshd_packages_default': u'{{ sshd_packages_default }}',
u'sshd_packages_custom': u'{{ sshd_packages_custom }}',
u'php_extensions_custom': u'{{ php_extensions_custom }}',
u'apt_packages_default': u'{{ apt_packages_default }}',
u'php_extensions_default': u'{{ php_extensions_default }}',
u'memcached_packages_default': u'{{ memcached_packages_default }}'}: {u
'openssh-server': u'{{ apt_security_package_state }}', u'openssh-client':
u'{{ apt_security_package_state }}'}: 'apt_security_package_state' is
undefined

The error appears to have been in '/path/to/example.com/trellis/roles/common/tasks/main.yml': line 15, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Verify dict format for apt package component variables
  ^ here

fatal: [staging.example.com]: FAILED! => {"failed": true}

The method I used to update Trellis is going to horrify you, but just in case it’s related: I deleted everything in my Trellis directory except ansible.cfg, deploy-hooks, group_vars, and hosts, and replaced it all with the latest from the Trellis repo (again, except for those files and directories).

Deploys work fine, it’s just provisioning that’s broken.

Did I bring this on myself with my hacky update method?

Thanks!

And here, class, we see another post in Michael’s “solved by actually typing it out” series. During this artistic period Michael found it necessary to waste everyone else’s time while solving his own problems.

@fullyint addressed this issue way back here. The problem was in trellis/group_vars/all/main.yml. Replacing its contents from the latest Trellis repo fixed it.

Thanks and sorry for the spam.

6 Likes

@fullyint addressed a Trellis question? Surely not – sounds very out of character :grin:

5 Likes