diff --git a/playbooks/common-tasks/os-lxc-container-setup.yml b/playbooks/common-tasks/os-lxc-container-setup.yml index e85416ce26..920de9b805 100644 --- a/playbooks/common-tasks/os-lxc-container-setup.yml +++ b/playbooks/common-tasks/os-lxc-container-setup.yml @@ -88,6 +88,18 @@ tags: - common-lxc +- name: Check container state + command: "lxc-info -n {{ inventory_hostname }} --state" + changed_when: false + delegate_to: "{{ physical_host }}" + register: _lxc_container_state + until: _lxc_container_state | success + retries: 3 + delay: 5 + when: + - not is_metal | bool + - (_mc is defined and _mc | changed) or (_ec is defined and _ec | changed) + # Due to https://github.com/ansible/ansible-modules-extras/issues/2691 # this uses the LXC CLI tools to ensure that we get logging. # TODO(odyssey4me): revisit this once the bug is fixed and released @@ -103,6 +115,7 @@ when: - not is_metal | bool - (_mc is defined and _mc | changed) or (_ec is defined and _ec | changed) + - _lxc_container_state.stdout.find('RUNNING') != -1 tags: - common-lxc