My Friday brain is really struggling to convert an Ansible command line into the format my Packer .json wants. The Ansible:
ansible-playbook playbook.yml -e @env/users/user01.yml --ask-vault --ask-become
My attempted Packer block:
"provisioners": [
{
"ansible_env_vars": ["ANSIBLE_HOST_KEY_CHECKING=False"],
"playbook_file": "{{ template_dir }}/../path/playbook.yml",
"type": "ansible",
"user": "{{ user `ssh_username` }}",
"extra_arguments": ["--extra-vars", "@env", "../path/env/users/user01.yml", "desktop=false", "--vault-password-file", "../vaultpass"]
}
],
I've tried various combinations of key=value (like the docs say) instead of separate "thing",
blocks but then it looks like Ansible is trying to read everything as one big argument for --extra-vars
(whereas at least --vault-password-file
should be separate I think?).