Ansible Provisioner for Packer
MIT License
This repository does not receive active maintenance or improvements; its feature set was integrated into Packer and released in v0.9.0 as one of the officially supported provisioners.
packer-provisioner-ansible is a Packer plugin that provisions machines using Ansible.
packer-provsioner-ansible does not support SCP to transfer files.
Download and install Packer: https://github.com/mitchellh/packer#quick-start
go get -d github.com/bhcleek/packer-provisioner-ansible
go build -o /usr/local/bin/packer-provisioner-ansible ./plugin/provisioner-ansible
This is a fully functional template that will provision an image on
DigitalOcean. Replace the mock api_token
value with your own.
{
"provisioners": [
{
"type": "ansible",
"playbook_file": "./playbook.yml",
"extra_arguments": ["--private-key", "./id_packer-ansible", "-v", "-c", "paramiko"],
"ssh_authorized_key_file": "./id_packer-ansible.pub",
"ssh_host_key_file": "./packer_host_private_key"
}
],
"builders": [
{
"type": "digitalocean",
"api_token": "6a561151587389c7cf8faa2d83e94150a4202da0e2bad34dd2bf236018ffaeeb",
"image": "ubuntu-14-04-x64",
"region": "sfo1"
},
]
}
playbook_file
- The playbook file to be run by Ansible.ssh_host_key_file
- The SSH key that will be used to run the SSH server to which Ansible connects.ssh_authorized_key_file
- The SSH public key of the Ansible ssh_user
.local_port
(string) - The port on which ansible-provisioner should firstlocal_port
. When local_port
is missingsftp_command
(string) - The command to run on the machine to handle the/usr/lib/sftp-server -e
.