diff options
Diffstat (limited to 'playbooks/byo')
-rw-r--r-- | playbooks/byo/openshift-cluster/upgrades/docker/docker_upgrade.yml | 13 | ||||
-rw-r--r-- | playbooks/byo/openshift-cluster/upgrades/docker/files/nuke_images.sh | 16 |
2 files changed, 15 insertions, 14 deletions
diff --git a/playbooks/byo/openshift-cluster/upgrades/docker/docker_upgrade.yml b/playbooks/byo/openshift-cluster/upgrades/docker/docker_upgrade.yml index 6c12e8245..d7798d304 100644 --- a/playbooks/byo/openshift-cluster/upgrades/docker/docker_upgrade.yml +++ b/playbooks/byo/openshift-cluster/upgrades/docker/docker_upgrade.yml @@ -4,26 +4,27 @@ roles: - openshift_facts tasks: + - fail: + msg: Cannot upgrade Docker on Atomic operating systems. + when: openshift.common.is_atomic | bool + - name: Determine available Docker version script: ../../../../common/openshift-cluster/upgrades/files/rpm_versions.sh docker register: g_docker_version_result - when: not openshift.common.is_atomic | bool - name: Check if Docker is installed command: rpm -q docker register: pkg_check failed_when: pkg_check.rc > 1 changed_when: no - when: not openshift.common.is_atomic | bool - set_fact: g_docker_version: "{{ g_docker_version_result.stdout | from_yaml }}" - when: not openshift.common.is_atomic | bool - name: Set fact if docker requires an upgrade set_fact: docker_upgrade: true - when: not openshift.common.is_atomic | bool and pkg_check.rc == 0 and g_docker_version.curr_version | version_compare('1.10','<') + when: pkg_check.rc == 0 and g_docker_version.curr_version | version_compare('1.10','<') - fail: msg: This playbook requires access to Docker 1.10 or later @@ -59,7 +60,7 @@ - "{{ openshift.common.service_type }}-master-api" - "{{ openshift.common.service_type }}-master-controllers" - "{{ openshift.common.service_type }}-node" - - etcd + - etcd_container - openvswitch failed_when: false when: docker_upgrade is defined and docker_upgrade | bool and openshift.common.is_containerized | bool @@ -77,7 +78,7 @@ - name: Restart containerized services service: name={{ item }} state=started with_items: - - etcd + - etcd_container - openvswitch - "{{ openshift.common.service_type }}-master" - "{{ openshift.common.service_type }}-master-api" diff --git a/playbooks/byo/openshift-cluster/upgrades/docker/files/nuke_images.sh b/playbooks/byo/openshift-cluster/upgrades/docker/files/nuke_images.sh index 9a5ee2276..6b155f7fa 100644 --- a/playbooks/byo/openshift-cluster/upgrades/docker/files/nuke_images.sh +++ b/playbooks/byo/openshift-cluster/upgrades/docker/files/nuke_images.sh @@ -1,22 +1,22 @@ #!/bin/bash # Stop any running containers -running_container_count=`docker ps -q | wc -l` -if test $running_container_count -gt 0 +running_container_ids=`docker ps -q` +if test -n "$running_container_ids" then - docker stop $(docker ps -q) + docker stop $running_container_ids fi # Delete all containers -container_count=`docker ps -a -q | wc -l` -if test $container_count -gt 0 +container_ids=`docker ps -a -q` +if test -n "$container_ids" then - docker rm -f -v $(docker ps -a -q) + docker rm -f -v $container_ids fi # Delete all images (forcefully) -image_count=`docker images -q | wc -l` -if test $image_count -gt 0 +image_ids=`docker images -q` +if test -n "$image_ids" then # Taken from: https://gist.github.com/brianclements/f72b2de8e307c7b56689#gistcomment-1443144 docker rmi $(docker images | grep "$2/\|/$2 \| $2 \|$2 \|$2-\|$2_" | awk '{print $1 ":" $2}') 2>/dev/null || echo "No images matching \"$2\" left to purge." |