tasks: lxc_container_create: Check for 'lxc-info' failures and retry
If lxc-info command fails, it's best if we know it rather than ignoring it as if nothing serious has happened. We expect the container to be present at that point, so we should be able to retrieve its state information. If lxc-info fails (perhaps the container hasn't been fully created yet so we can't get its state) then we can simply retry and fail if we can't recover in a reasonable amount of time. Change-Id: Iefb03508138bc9dbafef8be9dc669c89cafc8916
This commit is contained in:
parent
d5ad61ec0a
commit
311bfc2a8c
|
@ -38,10 +38,12 @@
|
|||
|
||||
- name: Check container state
|
||||
command: "lxc-info -n {{ inventory_hostname }} --state"
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
delegate_to: "{{ physical_host }}"
|
||||
register: _lxc_container_state
|
||||
until: _lxc_container_state | success
|
||||
retries: 3
|
||||
delay: 5
|
||||
|
||||
# Due to https://github.com/ansible/ansible-modules-extras/issues/2691
|
||||
# this uses the LXC CLI tools to ensure that we get logging.
|
||||
|
|
Loading…
Reference in New Issue