Merge pull request #4483 from rickard-von-essen/ansible-chroot

provisioner/ansible: Add documentation howto use with chroot
This commit is contained in:
Rickard von Essen 2017-01-30 12:15:52 +01:00 committed by GitHub
commit 87ecf3bd15
1 changed files with 28 additions and 1 deletions

View File

@ -116,9 +116,36 @@ 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
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)