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


-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/54a6a058-638c-4476-8993-349f43bb1433%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to