From a5171fef4deb4205e7c1e0e462032d39ed14b108 Mon Sep 17 00:00:00 2001 From: Rickard von Essen Date: Mon, 30 Jan 2017 12:09:55 +0100 Subject: [PATCH 1/2] provisioner/ansible: Add documentation howto use with chroot Closes #3583 --- .../source/docs/provisioners/ansible.html.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/website/source/docs/provisioners/ansible.html.md b/website/source/docs/provisioners/ansible.html.md index 89b8a702c..0207b7049 100644 --- a/website/source/docs/provisioners/ansible.html.md +++ b/website/source/docs/provisioners/ansible.html.md @@ -116,6 +116,33 @@ Redhat / CentOS builds have been known to fail with the following error due to ` virtualbox-ovf: fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh", "unreachable": true} ``` +### chroot communicator + +Building within a chroot (e.g. `amazon-chroot`) requires changing the Ansible connection to chroot. + +``` +{ + "builders": [ + { + "type": "amazon-chroot", + "mount_path": "/mnt/packer-amazon-chroot", + "region": "us-east-1", + "source_ami": "ami-123456" + } + ], + "provisioners": [ + { + "type": "ansible", + "extra_arguments": [ + "--connection=chroot", + "--inventory-file=/mnt/packer-amazon-chroot," + ], + "playbook_file": "main.yml" + } + ] +} +``` + ### winrm communicator Windows builds require a custom Ansible communicator and a particular configuration. Assuming a directory named `connection_plugins` is next to the playbook and contains a file named `packer.py` whose contents is From 4ffbfde09b7dc462fa198cb3cd1f6a8edc197af7 Mon Sep 17 00:00:00 2001 From: Rickard von Essen Date: Mon, 30 Jan 2017 12:11:48 +0100 Subject: [PATCH 2/2] s/communicator/connection plugin/ to align with Ansible nomenclature --- website/source/docs/provisioners/ansible.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/source/docs/provisioners/ansible.html.md b/website/source/docs/provisioners/ansible.html.md index 0207b7049..6ebe4259a 100644 --- a/website/source/docs/provisioners/ansible.html.md +++ b/website/source/docs/provisioners/ansible.html.md @@ -145,7 +145,7 @@ Building within a chroot (e.g. `amazon-chroot`) requires changing the Ansible co ### winrm communicator -Windows builds require a custom Ansible communicator and a particular configuration. Assuming a directory named `connection_plugins` is next to the playbook and contains a file named `packer.py` whose contents is +Windows builds require a custom Ansible connection plugin and a particular configuration. Assuming a directory named `connection_plugins` is next to the playbook and contains a file named `packer.py` whose contents is ``` from __future__ import (absolute_import, division, print_function)