Roots Discourse

Trellis: "with_dict expects a dict" and "PlaybookCLI object has no attribute options"

Recently I tried to make the switch from MacOS to Ubuntu (using an old PC as a way to get some more compute power).
When I vagrant up, I’m running into an issue:

TASK [common : Validate format of site_hosts] **********************************
System info:
  Ansible 2.7.12; Vagrant 2.2.18; Linux
  Trellis 1.0.3: April 30th, 2019
---------------------------------------------------
with_dict expects a dict
fatal: [default]: FAILED! => {}
	to retry, use: --limit @/home/matt/Sites/example.com/trellis/dev.retry

Did some searching, solution seems to be to upgrade Ansible from 2.7.12 to 2.8.0. Easy.
So, I did that. But then, I get this error:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'bento/ubuntu-18.04'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/ubuntu-18.04' version '202107.28.0' is up to date...
==> default: Setting the name of the VM: nest.test
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Exporting NFS shared folders...
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
==> default: Mounting NFS shared folders...
==> default: Mounting shared folders...
    default: /vagrant => /home/matt/Sites/example.com/trellis
==> default: Checking for bindfs in VM...
    default: Package manager detected: apt-get
    default: Fuse kernel module is installed
    default: Fuse kernel module is loaded
==> default: Bindfs seems to not be installed on the virtual machine, installing now
    default: Bindfs 1.13.7 is installed
==> default: Machine is ready to use bindfs!
==> default: Creating bind mounts after synced_folders...
    default: /vagrant-nfs-example.com => /srv/www/example.com/current
    default: /ansible-nfs => /home/vagrant/trellis
    default: /home/vagrant/trellis/bin => /home/vagrant/trellis/bin
==> default: [vagrant-hostmanager:guests] Updating hosts file on active guest virtual machines...
==> default: [vagrant-hostmanager:host] Updating hosts file on your workstation (password may be required)...
==> default: Running provisioner: ansible...
    default: Running ansible-galaxy...
- changing role composer from 1.7.0 to 1.7.0
- downloading role 'composer', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-composer/archive/1.7.0.tar.gz
- extracting composer to /home/matt/Sites/example.com/trellis/vendor/roles/composer
- composer (1.7.0) was installed successfully
- changing role ntp from 1.6.0 to 1.6.0
- downloading role 'ntp', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-ntp/archive/1.6.0.tar.gz
- extracting ntp to /home/matt/Sites/example.com/trellis/vendor/roles/ntp
- ntp (1.6.0) was installed successfully
- changing role logrotate from v0.0.5 to v0.0.5
- downloading role 'logrotate', owned by nickhammond
- downloading role from https://github.com/nickhammond/ansible-logrotate/archive/v0.0.5.tar.gz
- extracting logrotate to /home/matt/Sites/example.com/trellis/vendor/roles/logrotate
- logrotate (v0.0.5) was installed successfully
- changing role swapfile from v2.0.6 to v2.0.6
- downloading role 'swapfile', owned by oefenweb
- downloading role from https://github.com/Oefenweb/ansible-swapfile/archive/v2.0.6.tar.gz
- extracting swapfile to /home/matt/Sites/example.com/trellis/vendor/roles/swapfile
- swapfile (v2.0.6) was installed successfully
- changing role mailhog from 2.1.3 to 2.1.3
- downloading role 'mailhog', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-mailhog/archive/2.1.3.tar.gz
- extracting mailhog to /home/matt/Sites/example.com/trellis/vendor/roles/mailhog
- mailhog (2.1.3) was installed successfully
 [WARNING]: - dependency geerlingguy.daemonize from role mailhog differs from
already installed version (1.2.2), skipping

    default: Running ansible-playbook...
to see the full traceback, use -vvv
ERROR! Unexpected Exception, this is probably a bug: 'PlaybookCLI' object has no attribute 'options'
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

Unfortunately the solution I found for this error message is to downgrade Ansible to 2.7.12.
So I’m kind of stuck.

I have encountered the PlaybookCLI message on my MacBook, but the with_dict message is completely new to me and I’ve only ever experienced it on Ubuntu.

The only solution I can think of is to completely upgrade the version of Trellis being used in the project so that I can use a newer version of Ansible. But I manage dozens and dozens of websites on Trellis and it would be such a pain to have to update trellis anytime I need to set up a local dev environment…

Anyone know of a different way around this with_dict message that seems unique to Ubuntu? Seems to be thinking wordpress_sites.yml isn’t a dict for some reason

Hello, not associated.

I’d check out this issue from the before times, 2019. Ansible 2.8.x support (Closed)

I wonder if this is why they suggest the limit being 2.7.5.

1 Like

This topic was automatically closed after 42 days. New replies are no longer allowed.