Edit playbook to work with Packer Ansible Provisioner

14 views
Skip to first unread message

gigi...@gmail.com

unread,
Apr 2, 2019, 2:10:32 PM4/2/19
to Ansible Project

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

Sebastian Meyer

unread,
Apr 2, 2019, 2:14:15 PM4/2/19
to ansible...@googlegroups.com, gigi...@gmail.com
On 02.04.19 20:10, gigi...@gmail.com wrote:
>
>
> 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

> 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
>

--
Sebastian Meyer
Linux Consultant & Trainer
Mail: me...@b1-systems.de

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

Raghavendra Rao

unread,
Apr 2, 2019, 2:19:40 PM4/2/19
to ansible...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d64c9bd8-ed4f-4066-bac9-1e0a19e1b367%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages