Merge "playbooks: os-lxc-container-setup: Only stop the container if it's running"

This commit is contained in:
Zuul 2017-10-20 16:12:26 +00:00 committed by Gerrit Code Review
commit a3db82793b

View File

@ -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