Skip to content

Instantly share code, notes, and snippets.

@codesplicer
Created December 17, 2014 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codesplicer/1a33dbdac3cb52835ccd to your computer and use it in GitHub Desktop.
Save codesplicer/1a33dbdac3cb52835ccd to your computer and use it in GitHub Desktop.
Packer Ansible Template
{
"builders": [
{
"access_key": "REDACTED",
"ami_description": "MYCOMPONENT v16",
"ami_name": "MYCOMPONENT-16-201412171508",
"command_wrapper": "sudo {{.Command}}",
"region": "eu-west-1",
"secret_key": "REDACTED",
"source_ami": "REDACTED",
"tags": {
"COMPONENT_NAME": "MYCOMPONENT",
"COMPONENT_REPO": "REDACTED",
"COMPONENT_VERSION": "16",
"CREATED_AT": "201412171508",
"GIT_SHA": "810dc799dc2e106ac7ec7e6ff0c96172986d8a07"
},
"type": "amazon-chroot"
}
],
"provisioners": [
{
"environment_vars": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"inline": [
"/usr/bin/pip install ansible"
],
"inline_shebang": "/bin/bash",
"type": "shell"
},
{
"extra_arguments": [
"--extra-vars \"COMPONENT_NAME=MYCOMPONENT COMPONENT_VERSION=16\""
],
"playbook_file": "/path/to/MYCOMPONENT/ansible/site.yml",
"role_paths": [
"/path/to/MYCOMPONENT/ansible/roles/MYCOMPONENT"
],
"type": "ansible-local",
"command": "ansible-playbook -vvvv"
},
{
"inline": [
"rm -f /usr/sbin/policy-rc.d",
"rm -rf /tmp/ansible"
],
"inline_shebang": "/bin/bash",
"type": "shell"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment