summaryrefslogtreecommitdiffstats
path: root/playbooks
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks')
-rw-r--r--playbooks/adhoc/uninstall.yml2
-rw-r--r--playbooks/byo/openshift-cluster/upgrades/docker/docker_upgrade.yml9
-rw-r--r--playbooks/byo/openshift-cluster/upgrades/docker/files/nuke_images.sh16
-rw-r--r--playbooks/common/openshift-cluster/initialize_facts.yml1
-rw-r--r--playbooks/common/openshift-cluster/upgrades/files/rpm_versions.sh10
-rw-r--r--playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml5
-rw-r--r--playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml11
-rw-r--r--playbooks/common/openshift-etcd/config.yml1
8 files changed, 38 insertions, 17 deletions
diff --git a/playbooks/adhoc/uninstall.yml b/playbooks/adhoc/uninstall.yml
index 3d6de2d17..4edd44fe4 100644
--- a/playbooks/adhoc/uninstall.yml
+++ b/playbooks/adhoc/uninstall.yml
@@ -143,11 +143,13 @@
- registry\.qe\.openshift\.com/.*
- registry\.access\..*redhat\.com/rhel7/etcd
- docker.io/openshift
+ when: openshift_uninstall_images | default(True) | bool
- shell: "docker rmi -f {{ item.stdout_lines | join(' ') }}"
changed_when: False
failed_when: False
with_items: "{{ images_to_delete.results }}"
+ when: openshift_uninstall_images | default(True) | bool
- name: Remove sdn drop files
file:
diff --git a/playbooks/byo/openshift-cluster/upgrades/docker/docker_upgrade.yml b/playbooks/byo/openshift-cluster/upgrades/docker/docker_upgrade.yml
index 8b1b2fb1b..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
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."
diff --git a/playbooks/common/openshift-cluster/initialize_facts.yml b/playbooks/common/openshift-cluster/initialize_facts.yml
index cda490b1f..37f523246 100644
--- a/playbooks/common/openshift-cluster/initialize_facts.yml
+++ b/playbooks/common/openshift-cluster/initialize_facts.yml
@@ -1,6 +1,7 @@
---
- name: Initialize host facts
hosts: oo_all_hosts
+ any_errors_fatal: true
roles:
- openshift_facts
tasks:
diff --git a/playbooks/common/openshift-cluster/upgrades/files/rpm_versions.sh b/playbooks/common/openshift-cluster/upgrades/files/rpm_versions.sh
index a2a9579b5..8d7543f3c 100644
--- a/playbooks/common/openshift-cluster/upgrades/files/rpm_versions.sh
+++ b/playbooks/common/openshift-cluster/upgrades/files/rpm_versions.sh
@@ -1,7 +1,11 @@
#!/bin/bash
-
-installed=$(yum list installed -e 0 -q "$@" 2>&1 | tail -n +2 | awk '{ print $2 }' | sort -r | tr '\n' ' ')
-available=$(yum list available -e 0 -q "$@" 2>&1 | tail -n +2 | grep -v 'el7ose' | awk '{ print $2 }' | sort -r | tr '\n' ' ')
+if [ `which dnf 2> /dev/null` ]; then
+ installed=$(dnf repoquery --installed --latest-limit 1 -d 0 --qf '%{version}-%{release}' "${@}" 2> /dev/null)
+ installed=$(dnf repoquery --available --latest-limit 1 -d 0 --qf '%{version}-%{release}' "${@}" 2> /dev/null)
+else
+ installed=$(repoquery --plugins --pkgnarrow=installed --qf '%{version}-%{release}' "${@}" 2> /dev/null)
+ available=$(repoquery --plugins --pkgnarrow=available --qf '%{version}-%{release}' "${@}" 2> /dev/null)
+fi
echo "---"
echo "curr_version: ${installed}"
diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml
index 27b3ece96..f163cca86 100644
--- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml
+++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml
@@ -212,6 +212,9 @@
msg: Upgrade packages not found
when: openshift_image_tag is not defined and (g_aos_versions.avail_version | default(g_aos_versions.curr_version, true) | version_compare(target_version, '<'))
+- name: Verify docker upgrade targets
+ hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config
+ tasks:
- name: Determine available Docker
script: ../files/rpm_versions.sh docker
register: g_docker_version_result
@@ -266,7 +269,7 @@
- name: Backup etcd
hosts: etcd_hosts_to_backup
vars:
- embedded_etcd: "{{ openshift.master.embedded_etcd }}"
+ embedded_etcd: "{{ hostvars[groups.oo_first_master.0].openshift.master.embedded_etcd }}"
timestamp: "{{ lookup('pipe', 'date +%Y%m%d%H%M%S') }}"
roles:
- openshift_facts
diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml
index c93bf2a17..964257af5 100644
--- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml
+++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml
@@ -4,7 +4,7 @@
###############################################################################
- name: Upgrade docker
- hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config
+ hosts: oo_masters_to_config:oo_nodes_to_config
roles:
- openshift_facts
tasks:
@@ -20,6 +20,15 @@
openshift_image_tag: "v{{ g_new_version }}"
openshift_version: "{{ g_new_version }}"
+- name: Upgrade docker
+ hosts: oo_etcd_to_config
+ roles:
+ - openshift_facts
+ tasks:
+ # Upgrade docker when host is not atomic and host is not a non-containerized etcd node
+ - include: docker_upgrade.yml
+ when: not openshift.common.is_atomic | bool and not ('oo_etcd_to_config' in group_names and not openshift.common.is_containerized)
+
# The cli image is used by openshift_docker_facts to determine the currently installed
# version. We need to explicitly pull the latest image to handle cases where
# the locally cached 'latest' tag is older the g_new_version.
diff --git a/playbooks/common/openshift-etcd/config.yml b/playbooks/common/openshift-etcd/config.yml
index 6cb3a954f..a95de8cf3 100644
--- a/playbooks/common/openshift-etcd/config.yml
+++ b/playbooks/common/openshift-etcd/config.yml
@@ -1,6 +1,7 @@
---
- name: Set etcd facts needed for generating certs
hosts: oo_etcd_to_config
+ any_errors_fatal: true
roles:
- openshift_facts
tasks: