From 50b9eefd2b6266b29755e37090138096a2aebc31 Mon Sep 17 00:00:00 2001 From: Brenton Leanhardt Date: Wed, 17 Feb 2016 13:05:12 -0500 Subject: First past at the upgrade process --- roles/cockpit/tasks/main.yml | 2 +- roles/openshift_cli/tasks/main.yml | 7 +------ roles/openshift_cli/templates/openshift.j2 | 11 ++++++++++- roles/openshift_master/tasks/main.yml | 5 ----- roles/openshift_master_ca/tasks/main.yml | 5 ----- roles/openshift_repos/tasks/main.yaml | 13 +++++++------ 6 files changed, 19 insertions(+), 24 deletions(-) (limited to 'roles') diff --git a/roles/cockpit/tasks/main.yml b/roles/cockpit/tasks/main.yml index e83f72a3d..6e9f3a8bd 100644 --- a/roles/cockpit/tasks/main.yml +++ b/roles/cockpit/tasks/main.yml @@ -6,7 +6,7 @@ - cockpit-shell - cockpit-bridge - "{{ cockpit_plugins }}" - when: not openshift.common.is_atomic | bool + when: not openshift.common.is_containerized | bool - name: Enable cockpit-ws service: diff --git a/roles/openshift_cli/tasks/main.yml b/roles/openshift_cli/tasks/main.yml index a6b6b1925..e9d7f4afe 100644 --- a/roles/openshift_cli/tasks/main.yml +++ b/roles/openshift_cli/tasks/main.yml @@ -9,11 +9,6 @@ action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-clients state=present" when: not openshift.common.is_containerized | bool -- name: Pull CLI Image - command: > - docker pull {{ openshift.common.cli_image }} - when: openshift.common.is_containerized | bool - - name: Create /usr/local/bin/openshift cli wrapper template: src: openshift.j2 @@ -30,4 +25,4 @@ - /usr/local/bin/oadm - /usr/local/bin/oc - /usr/local/bin/kubectl - when: openshift.common.is_containerized | bool \ No newline at end of file + when: openshift.common.is_containerized | bool diff --git a/roles/openshift_cli/templates/openshift.j2 b/roles/openshift_cli/templates/openshift.j2 index a7c148a22..d2a3f066c 100644 --- a/roles/openshift_cli/templates/openshift.j2 +++ b/roles/openshift_cli/templates/openshift.j2 @@ -20,4 +20,13 @@ See https://docs.openshift.org/latest/cli_reference/get_started_cli.html ================================================================================= """ -docker run -i --privileged --net=host --user=${user}:${group} -v ~/.kube:/root/.kube -v /tmp:/tmp -v {{ openshift.common.config_base}}:{{ openshift.common.config_base }} -e KUBECONFIG=/root/.kube/config --entrypoint ${cmd} --rm {{ openshift.common.cli_image }} "${@}" +image="" +if ! docker inspect -f {% raw %}'{{ .State.Status }}'{% endraw %} {{ openshift.common.service_type }}-master | grep running > /dev/null; then +>&2 echo """ + +Warning: {{ openshift.common.service_type }}-master service is not running. Using the latest image. +""" + image=:`docker inspect -f {% raw %}'{{ .Image }}'{% endraw %} {{ openshift.common.service_type }}-master` +fi + +docker run -i --privileged --net=host --user=${user}:${group} -v ~/.kube:/root/.kube -v /tmp:/tmp -v {{ openshift.common.config_base}}:{{ openshift.common.config_base }} -e KUBECONFIG=/root/.kube/config --entrypoint ${cmd} --rm {{ openshift.common.cli_image }}${image} "${@}" diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml index a37f5b4bb..4f722679d 100644 --- a/roles/openshift_master/tasks/main.yml +++ b/roles/openshift_master/tasks/main.yml @@ -92,11 +92,6 @@ action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-master{{ openshift_version }} state=present" when: not openshift.common.is_containerized | bool -- name: Pull master image - command: > - docker pull {{ openshift.master.master_image }} - when: openshift.common.is_containerized | bool - - name: Install Master docker service file template: dest: "/etc/systemd/system/{{ openshift.common.service_type }}-master.service" diff --git a/roles/openshift_master_ca/tasks/main.yml b/roles/openshift_master_ca/tasks/main.yml index 66960e73e..4b7ef1d84 100644 --- a/roles/openshift_master_ca/tasks/main.yml +++ b/roles/openshift_master_ca/tasks/main.yml @@ -13,11 +13,6 @@ path: "{{ openshift_master_config_dir }}" state: directory -- name: Pull master docker image - command: > - docker pull {{ openshift.common.cli_image }} - when: openshift.common.is_containerized | bool - - name: Create the master certificates if they do not already exist command: > {{ openshift.common.admin_binary }} create-master-certs diff --git a/roles/openshift_repos/tasks/main.yaml b/roles/openshift_repos/tasks/main.yaml index 6143805ca..af9fefec6 100644 --- a/roles/openshift_repos/tasks/main.yaml +++ b/roles/openshift_repos/tasks/main.yaml @@ -9,6 +9,7 @@ - assert: that: openshift_deployment_type in known_openshift_deployment_types + when: not openshift.common.is_containerized | bool - name: Ensure libselinux-python is installed action: "{{ ansible_pkg_mgr }} name=libselinux-python state=present" @@ -34,9 +35,9 @@ state: absent with_fileglob: - '*/repos/*' - when: not (item | search("/files/" ~ openshift_deployment_type ~ "/repos")) and - (ansible_os_family == "RedHat" and ansible_distribution != "Fedora") - and not openshift.common.is_containerized | bool + when: not openshift.common.is_containerized | bool + and not (item | search("/files/" ~ openshift_deployment_type ~ "/repos")) + and (ansible_os_family == "RedHat" and ansible_distribution != "Fedora") notify: refresh cache - name: Remove any yum repo files for other deployment types Fedora @@ -45,9 +46,9 @@ state: absent with_fileglob: - '*/repos/*' - when: not (item | search("/files/fedora-" ~ openshift_deployment_type ~ "/repos")) and - (ansible_distribution == "Fedora") - and not openshift.common.is_containerized | bool + when: not openshift.common.is_containerized | bool + and not (item | search("/files/fedora-" ~ openshift_deployment_type ~ "/repos")) + and (ansible_distribution == "Fedora") notify: refresh cache - name: Configure gpg keys if needed -- cgit v1.2.1