Merge "Improve the minor update of the docker service"

This commit is contained in:
Zuul 2018-02-22 09:48:44 +00:00 committed by Gerrit Code Review
commit 8731e10296
1 changed files with 21 additions and 0 deletions

View File

@ -101,3 +101,24 @@ outputs:
- name: Install docker packages on upgrade if missing
when: step|int == 3
yum: name=docker state=latest
update_tasks:
block:
- name: Stop all containers
# xargs is preferable to docker stop $(docker ps -q) as that might generate a
# a too long command line
shell: docker ps -q | xargs --no-run-if-empty -n1 docker stop
- name: Stop docker
service:
name: docker
state: stopped
- name: Update the docker package
yum: name=docker state=latest update_cache=yes # cache for tripleo/+bug/1703830
- name: Apply puppet which will start the service again
shell: |
puppet apply --detailed-exitcodes --verbose \
--modulepath /etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules \
-e "class { 'tripleo::profile::base::docker': step => 1, }"
register: puppet_docker_apply
failed_when: puppet_docker_apply.rc not in [0, 2]
changed_when: puppet_docker_apply.rc == 2
when: step|int == 2