ansible_env_vars throws unknown configuration key when running ansible-local playbook in Packer

14 views
Skip to first unread message

Loki Jötunn Jarl Hayhurst

unread,
Oct 1, 2021, 6:33:05 AMOct 1
to Packer

I am trying to add some hardening to an AMI image which moves /tmp to systemd as one of the steps. This understandably kills the run. When I try to use ansible_env_vars to place the temporary ansible files elsewhere I get

Error: Failed to prepare build: "amazon-ebs" 1 error occurred: * unknown configuration key: '"ansible_env_vars"' ==> Wait completed after 5 microseconds

Provisioner step for packer:

     "type": "ansible-local", 
     "ansible_env_vars": [ "ANSIBLE_REMOTE_TMP='/home/ubuntu/.ansible/tmp'" ],
     "playbook_file": "ansible/harden.yaml", 
     "playbook_dir": "ansible/", 
     "extra_arguments": [ "--tags='level_1_server' --vault-password-file=pwfile" ], 
     "role_paths" : "ansible/roles"
 }

I'm wondering if this is maybe an ebs issue with ansible-local and if I should just use ansible instead. The only other option I can see is to rewrite the ansible step that changes /tmp as a shell script but I would rather avoid that. Any other ideas to get this to run?

Reply all
Reply to author
Forward
0 new messages