I tried creating a container with Ansible’s lxd_container module from a remote host but the task failed. I saw in the logs that the Ansible module tried to call /1.0/operations/<uuid>/wait
but received a 404:
{
"request": {
"json": null,
"method": "GET",
"timeout": null,
"url": "/1.0/operations/8346c91a-ba85-4ed2-a50a-38a9864f3296/wait"
},
"response": {
"json": {
"error": "not found",
"error_code": 404,
"type": "error"
}
},
"type": "sent request"
}
The container was created but it didn’t start (I set its state to “started” in the playbook). Another strange thing is that running the same playbook for the 2nd time returns the same error (obviously) but still starts the container. If I wait until the container is booted and run the playbook again, the task runs without errors (but doesn’t change anything of course).
Is it missing from the version I use (3.0.1 on Ubuntu Bionic) or is it something with the Ansible module?
This is the playbook I was running; it’s pretty simple:
---
- hosts: lxd1
connection: ssh
tasks:
- name: Create new container
lxd_container:
name: test2
state: started
wait_for_ipv4_addresses: true
source:
type: image
fingerprint: 38219778c2cf
profiles: ["test"]
devices:
eth1:
name: eth1
nictype: macvlan
parent: ens4
type: nic
eth2:
name: eth2
nictype: macvlan
parent: ens5
type: nic
vlan: "2"
Note: I tried “wait_for_ipv4_addresses” with both true and false values.