Running dev.yml directly via ansible is failing

If I try to run dev.yml directly via ansible (as documented) it fails. Has anyone else noticed this lately?

It’s odd, because the vagrant ansible provisioner has no trouble bringing up the vagrant box on it’s own. I just can run ansible playbooks against it myself.

I normally wouldn’t need to do this, but I’m developing a new feature for Trellis which will need to run playbooks against dev.

If anyone else could run this command from trellis/ on one of their Trellis projects and tell me what happens, I’d be grateful:

ansible-playbook dev.yml -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory

I forgot to mention - I’ve been through this thread and tried some of the solutions here, but no success in fixing the problem yet: https://github.com/ansible/ansible/issues/15321

I believe I’ve fixed this by disabling strict host key checking for vagrant boxes. The vagrant ansible provisioner always does this by default. However, if you run dev.yml directly, you need to specify this yourself. You can configure this by editing the vagrant generated inventory file. However, because this file is auto generated, it’s better to do it in the vagrantfile like this, so your changes won’t be overwritten: https://github.com/discopatrick/trellis/blob/sync_db_and_files/Vagrantfile#L111-L117

This results in an inventory file that looks like:

...

[web]
default

[development]
default

[development:vars]
ansible_ssh_extra_args="-o StrictHostKeyChecking=no"
2 Likes