The plural playbook_files
option for the Ansible provider seems not to be working (Packer version 1.6.4). I get the error:
* unknown configuration key: '"playbook_files"'
This is an excerpt of my config:
"provisioners": [
{
"type": "ansible",
"user": "root",
"playbook_files": [
"./images/ansible/site.yml",
"./images/ansible/cleanup.yml",
],
"groups": "{{user `image_type`}}",
"ansible_env_vars": ["ANSIBLE_CONFIG=images/ansible/ansible.cfg"],
"extra_arguments": [
"--extra-vars",
"ansible_host={{user `ansible_host`}} ansible_connection={{user `ansible_connection`}}"
]
},
]
Am I doing something wrong?
I don’t think there is a plural playbook_files option. Unfortunately right now you need to call the ansible provisioner twice to provide two playbooks.
If you’d like to open a feature request to add this option, you can do so on Packer’s github repo: https://github.com/hashicorp/packer/issues/new/choose
The option is described here: https://www.packer.io/docs/provisioners/ansible-local#playbook_files
that’s for the ansible-local provisoner, which is not the same as the ansible (remote) provisioner. ansible-local runs ansible with a localhost connection on the guest instance, and ansible must be installed on the guest instance. The “ansible” provisioner that you’re using above has ansible installed on the machine running packer, and doesn’t require that ansible is installed on the guest.
It’s definitely confusing to have this option available for one provisioner and not the other, but the option isn’t documented on the docs page that corresponds to the actual provisioner you’re using: https://www.packer.io/docs/provisioners/ansible.
That’s a clear answer, thanks!