Skip to content

Instantly share code, notes, and snippets.

@smw
Last active August 23, 2016 22:05
Show Gist options
  • Save smw/7cf217045113b58bb56d2428833a7126 to your computer and use it in GitHub Desktop.
Save smw/7cf217045113b58bb56d2428833a7126 to your computer and use it in GitHub Desktop.
fatal: [tw-r01-s01]: FAILED! => {
"actions": [],
"changed": false,
"failed": true,
"invocation": {
"module_args": {
"architecture": null,
"cert_file": "/root/.config/lxc/client.crt",
"config": {
"user.user-data": "#cloud-config\nssh_authorized_keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2l3zSGhZ7eCBCGeZB4WGf7yAz5lrkk2svTp4fbB927NYosiHtj4uqKRKTiaIzCaAYgNRTHFpF4IkcHtNdiJUfbWt9XUc4lJ/8lQOw36OFJOqmVGY3nM/aBxJziBXqgZOVoRmQ/mEAE1sYGvK0TX04qDudBDUaIt+gZUQq4FS9b6NwLMcS+qfEIRSpNp1ANoiUNZjbzgP8vc/jC4emaA0QY6X5XDSNKfVP0bxUkAcH1eaHimdW9NddiA21G0SOfRWztkJIyPAcBDRkpwudv1bHCnNEf2COqbnOnDKqXGFpLfqIUAQhidqdG3a/WvC3rRlfLewNdXySseZsiYldSl8h [email protected]\npackages:\n python\n"
},
"description": null,
"devices": null,
"ephemeral": null,
"force_stop": false,
"key_file": "/root/.config/lxc/client.key",
"name": "tw-r01-s01",
"profiles": [
"default",
"ansible-tupperware"
],
"source": {
"alias": "ubuntu",
"type": "image"
},
"state": "started",
"timeout": 60,
"trust_password": null,
"url": "unix:/var/lib/lxd/unix.socket",
"wait_for_ipv4_addresses": true
},
"module_name": "lxd_container"
},
"msg": "cannot connect to the LXD server"
}
- name: Create containers
hosts: ansible-tupperware
connection: local
gather_facts: false
tasks:
- name: Create a started container
connection: local
register: container_result
lxd_container:
name: "{{inventory_hostname}}"
state: started
source:
type: image
alias: ubuntu
profiles: ["default", "ansible-tupperware"]
config:
user.user-data: |
#cloud-config
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2l3zSGhZ7eCBCGeZB4WGf7yAz5lrkk2svTp4fbB927NYosiHtj4uqKRKTiaIzCaAYgNRTHFpF4IkcHtNdiJUfbWt9XUc4lJ/8lQOw36OFJOqmVGY3nM/aBxJziBXqgZOVoRmQ/mEAE1sYGvK0TX04qDudBDUaIt+gZUQq4FS9b6NwLMcS+qfEIRSpNp1ANoiUNZjbzgP8vc/jC4emaA0QY6X5XDSNKfVP0bxUkAcH1eaHimdW9NddiA21G0SOfRWztkJIyPAcBDRkpwudv1bHCnNEf2COqbnOnDKqXGFpLfqIUAQhidqdG3a/WvC3rRlfLewNdXySseZsiYldSl8h [email protected]
packages:
python
wait_for_ipv4_addresses: true
timeout: 60
- name: Set ansible_host
set_fact: ansible_host="{{ container_result.addresses.eth0[0] }}"
- name: foo
debug: var=hostvars[inventory_hostname]
- name: pause
local_action: wait_for port=22 host="{{ ansible_ssh_host | default(inventory_hostname) }}" search_regex=OpenSSH delay=10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment