I am currently experimenting with deploying using Packer’s Ansible local provisioning and for some odd reason, it doesn’t appear to be executing the tasks in the playbook. Packer, after installing the pre-requiresites for Ansible, uploads the following:
Inventory file (“hosts”)
[localhost]
localhost ansible_connection=local
And the playbook file (“local.yml”):
---
- hosts: localhost
connection: local
become: yes
become_method: sudo
tasks:
- name: Making sure that ansible is actually executing this playbook
shell: echo "hello world"
- name: install packages
package: name={{ item }} state=present
with_items:
- nginx
- git
- curl
- libmysqlclient-dev
- libmysqlclient18
- mysql-common
- nodejs
- tcpdump
The output is as follows (running Ansible against a Ubuntu 14.04 instance):
amazon-ebs: Executing Ansible: cd /tmp/packer-provisioner-ansible-local && ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 ansible-playbook /tmp/packer-provisioner-ansible-local/local.yml -c local -i /tmp/packer-provisioner-ansible-local/hosts
==> amazon-ebs: Stopping the source instance...
==> amazon-ebs: Waiting for the instance to stop.
As you can see, there is no Ansible output, which I assume I should get (somebody correct me if I am wrong).
I did manual run of the playbook, which worked successfully. At this point, I am not sure if I missing something or not.