All:
Fundamental question is how do I assign a newly minted lxd container to an
ansible group when using the remote ansible provisioner? Here's what I have
so far:
Packer Template:
{
"builders": [
{
"type": "lxd",
"name": "consulserver",
"image": "AWTAlpine37",
"output_image": "consulserver",
"publish_properties": {
"description": "Consul Server"
}
}
],
"provisioners": [
{
"type": "shell",
"inline": [ "sleep 10; apk update && apk add python2" ]
},
{
"type": "ansible",
"groups": ["consul_servers"],
"ansible_env_vars": [
"ANSIBLE_CONFIG=/home/FUZZBUTT/snesbitt/projects/ansible/fuzzbutt.awt_ansible/ansible.cfg"
],
"inventory_directory":
"/home/FUZZBUTT/snesbitt/projects/ansible/fuzzbutt.awt_ansible/inventories/prod"
,
"playbook_file":
"/home/FUZZBUTT/snesbitt/projects/ansible/fuzzbutt.awt_ansible/playbooks/domain-server.yml"
,
"extra_arguments": [ "-c", "lxd", "-i", "packer-consulserver,", "-l",
"packer-consulserver" ]
}
]
}
Ansible output:
==> consulserver: Executing Ansible: ansible-playbook --extra-vars
packer_build_name=consulserver packer_builder_type=lxd -i /home/FUZZBUTT/
snesbitt/projects/ansible/fuzzbutt.awt_ansible/i
nventories/prod/packer-provisioner-ansible904637113 /home/FUZZBUTT/snesbitt/
projects/ansible/fuzzbutt.awt_ansible/playbooks/domain-server.yml -e
ansible_ssh_private_key_file=/tmp/ansible-k
ey529167426 -c lxd -i packer-consulserver, -l packer-consulserver
consulserver:
consulserver: PLAY [all]
*********************************************************************
consulserver:
consulserver: TASK [Gathering Facts]
*********************************************************
consulserver: [WARNING]: lxd does not support remote_user, using
container default: root
consulserver: ok: [packer-consulserver]
consulserver:
consulserver: TASK [Play hosts]
**************************************************************
consulserver: [WARNING]: lxd does not support remote_user, using
container default: root
consulserver: ok: [packer-consulserver] => {
consulserver: "msg": "play_hosts=[u'packer-consulserver']"
consulserver: }
consulserver:
consulserver: TASK [Groups]
******************************************************************
consulserver: [WARNING]: lxd does not support remote_user, using
container default: root
consulserver: ok: [packer-consulserver] => {
consulserver: "msg": "groups=['ungrouped']"
consulserver: }
consulserver:
consulserver: TASK [Test]
********************************************************************
consulserver: skipping: [packer-consulserver]
consulserver:
consulserver: PLAY RECAP
*********************************************************************
consulserver: packer-consulserver : ok=3 changed=0
unreachable=0 failed=0
If I've got this correct, I've told Packer in the template to assign the
container to group "consul_servers". But when I query Ansible for the list
of groups, the only group recognized is 'ungrouped'.
Any assistance would be much appreciated.
-steve
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/packer-tool/ba1f8e2c-b571-4b27-813e-6aff6ed77770%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.