Merge "Fix 'ModuleNotFoundError: No module named 'docker'"

This commit is contained in:
Zuul 2022-01-07 12:49:51 +00:00 committed by Gerrit Code Review
commit 3ad7870944

View File

@ -14,13 +14,21 @@
with_items: "{{ ntp_service_disable_list }}" with_items: "{{ ntp_service_disable_list }}"
- name: Remove kolla-ansible installed chrony container - name: Remove kolla-ansible installed chrony container
docker_container: shell:
name: chrony cmd: >
state: absent if [[ -n $(docker ps -aq -f name=chrony) ]]; then
docker rm -f -v chrony
fi
executable: "/bin/bash"
register: result
changed_when: result.stdout != ""
become: true become: true
# NOTE(wszumski): There is an ordering issue where on a fresh host, docker # NOTE(wszumski): There is an ordering issue where on a fresh host, docker
# will not have been configured, but if that is the case, the chrony container # will not have been configured, but if that is the case, the chrony container
# can't possibly exist, but trying to execute this unconditionally will fail # can't possibly exist, but trying to execute this unconditionally will fail
# with: No module named 'docker' as we have not yet added the docker package # with: No module named 'docker' as we have not yet added the docker package
# to the kayobe target venv. # to the kayobe target venv, so we use 'docker rm' command with force and
when: "'docker.service' in ansible_facts.services" # don't fail on error.
when:
- "'docker.service' in ansible_facts.services"
- ansible_facts.services['docker.service'].status == 'running'