# Edit playbook to work with Packer Ansible Provisioner

**URL:** <https://forum.ansible.com/t/edit-playbook-to-work-with-packer-ansible-provisioner/30041>\
**Category:** Ansible Project\
**Created:** [April 2, 2019, 6:10pm UTC](https://forum.ansible.com/t/edit-playbook-to-work-with-packer-ansible-provisioner/30041 "2019-04-02T18:10:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gigit1000](https://avatars.discourse-cdn.com/v4/letter/g/a87d85/32.png) [@gigit1000](https://forum.ansible.com/u/gigit1000)\
**Post date:** [April 2, 2019, 6:10pm UTC](https://forum.ansible.com/t/edit-playbook-to-work-with-packer-ansible-provisioner/30041/1 "2019-04-02T18:10:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sebastian\_Meyer](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@Sebastian\_Meyer](https://forum.ansible.com/u/Sebastian_Meyer)\
**Post date:** [April 2, 2019, 6:14pm UTC](https://forum.ansible.com/t/edit-playbook-to-work-with-packer-ansible-provisioner/30041/2 "2019-04-02T18:14:04Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![Raghavendra\_Rao](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Raghavendra\_Rao](https://forum.ansible.com/u/Raghavendra_Rao)\
**Post date:** [April 2, 2019, 6:19pm UTC](https://forum.ansible.com/t/edit-playbook-to-work-with-packer-ansible-provisioner/30041/3 "2019-04-02T18:19:20Z")

</div>

Use hosts: all

More detailed discussion in:

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

-R.Rao
