Edit playbook to work with Packer Ansible Provisioner

Hello,

I’m trying to call a playbook from Packer for the first time. I’m using the Packer Ansible provisioner. The documentation says that Packer will “dynamically create an inventory file to use with the playbook” If this is the case, How should I edit my playbook? As it is now it has a “hosts” entry - should I just remove that? It looks like:

  • hosts: ec2lin

remote_user: ec2-user

become: yes

become_user: root

tasks:

  • name: run yum update -y using yum module

yum:

name: “*”

state: latest

Thank You much for any help

Hello,

I’m trying to call a playbook from Packer for the first time. I’m using the
Packer Ansible provisioner. The documentation says that Packer will
“dynamically create an inventory file to use with the playbook” If this is
the case, How should I edit my playbook? As it is now it has a “hosts”
entry - should I just remove that?

Use hosts: all

Packer only makes the one host available in the inventory.

Sebastian

Use hosts: all

More detailed discussion in:

https://stackoverflow.com/questions/21966246/packer-ansible-how-to-specify-the-inventory-file

-R.Rao