Hello,
I'm a little confused as to how the packer_build_name extra variable is supposed to be used for Ansible Remote. According to the documentation, "the provisioner automatically defines certain commonly useful Ansible variables", one of them being "packer_build_name".
The way that reads, it makes me think that the variable should be available for Ansible, but I am getting this error "'packer_build_name' is undefined" during the Ansible run.
How are these automatic extra variables supposed to be utilized?
The Ansible play:
- name: Set build stage variable
set_fact: "build_stage={{ item }}"
with_items: "{{ packer_build_name.split('-')[-1] }}"
In Packer:
{
"type": "ansible",
"user": "ubuntu",
"playbook_file": "ansible/site.yml",
"extra_arguments" : [
"-vvv"
]
}
and...
"builders": [
{
"name": "py-cicd-test",
"type": "amazon-ebs",
.....
Where I'm trying to split the "test" portion off so I can dynamically include different vars files.
Can anyone point me towards what I'm doing wrong?
Thanks, Andrew