From dcb7289d9cf28b155aebb3b4ab820db2033c1b35 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 20 May 2016 11:55:41 -0300 Subject: Debug output. --- roles/openshift_cli/tasks/main.yml | 6 ++++++ roles/openshift_docker/tasks/main.yml | 3 +++ roles/openshift_master/tasks/main.yml | 2 ++ 3 files changed, 11 insertions(+) (limited to 'roles') diff --git a/roles/openshift_cli/tasks/main.yml b/roles/openshift_cli/tasks/main.yml index bfa60e5b0..a2be95eac 100644 --- a/roles/openshift_cli/tasks/main.yml +++ b/roles/openshift_cli/tasks/main.yml @@ -1,4 +1,10 @@ --- +- debug: var=openshift_version +- debug: var=openshift_release +- debug: var=openshift_image_tag +- debug: var=openshift.common +- debug: var=openshift.docker + - name: Install clients action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-clients state=present" when: not openshift.common.is_containerized | bool diff --git a/roles/openshift_docker/tasks/main.yml b/roles/openshift_docker/tasks/main.yml index 9c5887f76..cff1c6bb4 100644 --- a/roles/openshift_docker/tasks/main.yml +++ b/roles/openshift_docker/tasks/main.yml @@ -8,6 +8,9 @@ # in non-upgrade scenarios: has_image_tag_fact: "{{ hostvars[inventory_hostname].openshift.docker.openshift_image_tag is defined }}" +- debug: var=openshift_image_tag +- debug: var=openshift_release + - name: Set version when containerized command: > docker run --rm {{ openshift.common.cli_image }} version diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml index 63a54a0d9..56ce0e396 100644 --- a/roles/openshift_master/tasks/main.yml +++ b/roles/openshift_master/tasks/main.yml @@ -23,6 +23,8 @@ msg: "Pacemaker based HA is not supported at this time when used with containerized installs" when: openshift_master_ha | bool and openshift_master_cluster_method == "pacemaker" and openshift.common.is_containerized | bool +- debug: var=openshift_version + - name: Install Master package action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-master{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" when: not openshift.common.is_containerized | bool -- cgit v1.2.3 From c45562e0e03e03c82bfcf60d4b3f8b7793133301 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 20 May 2016 15:14:28 -0300 Subject: Set openshift_version in config playbooks for first master. Starting to remove openshift.docker.openshift_version fact usage. openshift_version should no longer contain a leading 'v' for containerized installs, just a version number. --- roles/openshift_cli/defaults/main.yml | 1 - roles/openshift_cli/tasks/main.yml | 5 +---- roles/openshift_cli/templates/openshift.j2 | 4 ++-- roles/openshift_docker/tasks/main.yml | 2 ++ roles/openshift_facts/library/openshift_facts.py | 12 +++--------- roles/openshift_master/tasks/main.yml | 2 ++ 6 files changed, 10 insertions(+), 16 deletions(-) (limited to 'roles') diff --git a/roles/openshift_cli/defaults/main.yml b/roles/openshift_cli/defaults/main.yml index 7baa87ab8..ed97d539c 100644 --- a/roles/openshift_cli/defaults/main.yml +++ b/roles/openshift_cli/defaults/main.yml @@ -1,2 +1 @@ --- -openshift_version: "{{ openshift_image_tag | default(openshift.docker.openshift_image_tag | default('')) }}" diff --git a/roles/openshift_cli/tasks/main.yml b/roles/openshift_cli/tasks/main.yml index a2be95eac..95711f95d 100644 --- a/roles/openshift_cli/tasks/main.yml +++ b/roles/openshift_cli/tasks/main.yml @@ -1,9 +1,6 @@ --- - debug: var=openshift_version -- debug: var=openshift_release -- debug: var=openshift_image_tag - debug: var=openshift.common -- debug: var=openshift.docker - name: Install clients action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-clients state=present" @@ -11,7 +8,7 @@ - name: Pull CLI Image command: > - docker pull {{ openshift.common.cli_image }}:{{ openshift_version }} + docker pull {{ openshift.common.cli_image }}:v{{ openshift_version }} when: openshift.common.is_containerized | bool - name: Create /usr/local/bin/openshift cli wrapper diff --git a/roles/openshift_cli/templates/openshift.j2 b/roles/openshift_cli/templates/openshift.j2 index 437e08aab..501796b0b 100644 --- a/roles/openshift_cli/templates/openshift.j2 +++ b/roles/openshift_cli/templates/openshift.j2 @@ -5,14 +5,14 @@ fi cmd=`basename $0` user=`id -u` group=`id -g` -image_tag={{ openshift_version }} +image_tag=v{{ openshift_version }} >&2 echo """ ================================================================================ ATTENTION: You are running ${cmd} via a wrapper around 'docker run {{ openshift.common.cli_image }}:${image_tag}'. This wrapper is intended only to be used to bootstrap an environment. Please install client tools on another host once you have granted cluster-admin -privileges to a user. +privileges to a user. {% if openshift.common.deployment_type in ['openshift-enterprise','atomic-enterprise'] %} See https://docs.openshift.com/enterprise/latest/cli_reference/get_started_cli.html {% else %} diff --git a/roles/openshift_docker/tasks/main.yml b/roles/openshift_docker/tasks/main.yml index cff1c6bb4..79efb193b 100644 --- a/roles/openshift_docker/tasks/main.yml +++ b/roles/openshift_docker/tasks/main.yml @@ -17,6 +17,8 @@ register: cli_image_version when: is_containerized | bool and openshift_image_tag is not defined and (upgrading | bool or not has_image_tag_fact | bool) +- debug: var=cli_image_version + # Use the pre-existing image tag from system facts if present, and we're not upgrading. # Ignores explicit openshift_image_tag if it's in the inventory, as this isn't an upgrade. - set_fact: diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index b13343776..6127948bf 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1133,15 +1133,9 @@ def get_openshift_version(facts): if os.path.isfile('/usr/bin/openshift'): _, output, _ = module.run_command(['/usr/bin/openshift', 'version']) version = parse_openshift_version(output) - - # openshift_facts runs before openshift_docker_facts. However, it will be - # called again and set properly throughout the playbook run. This could be - # refactored to simply set the openshift.common.version in the - # openshift_docker_facts role but it would take reworking some assumptions - # on how get_openshift_version is called. - if 'is_containerized' in facts['common'] and safe_get_bool(facts['common']['is_containerized']): - if 'docker' in facts and 'openshift_version' in facts['docker']: - version = facts['docker']['openshift_version'] + elif os.path.isfile('/usr/local/bin/openshift'): + _, output, _ = module.run_command(['/usr/local/bin/openshift', 'version']) + version = parse_openshift_version(output) return version diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml index 56ce0e396..0cbb49758 100644 --- a/roles/openshift_master/tasks/main.yml +++ b/roles/openshift_master/tasks/main.yml @@ -1,6 +1,8 @@ --- # TODO: add ability to configure certificates given either a local file to # point to or certificate contents, set in default cert locations. +- debug: var=openshift_version +- fail: # Authentication Variable Validation # TODO: validate the different identity provider kinds as well -- cgit v1.2.3 From 82a70f9cc1522d239212701ab6c9260cbf9dc8a7 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 20 May 2016 15:52:54 -0300 Subject: Remove now unnecessary pull and ver check in openshift_docker role. --- roles/openshift_docker/tasks/main.yml | 36 ----------------------------------- 1 file changed, 36 deletions(-) (limited to 'roles') diff --git a/roles/openshift_docker/tasks/main.yml b/roles/openshift_docker/tasks/main.yml index 79efb193b..aaa472727 100644 --- a/roles/openshift_docker/tasks/main.yml +++ b/roles/openshift_docker/tasks/main.yml @@ -8,39 +8,3 @@ # in non-upgrade scenarios: has_image_tag_fact: "{{ hostvars[inventory_hostname].openshift.docker.openshift_image_tag is defined }}" -- debug: var=openshift_image_tag -- debug: var=openshift_release - -- name: Set version when containerized - command: > - docker run --rm {{ openshift.common.cli_image }} version - register: cli_image_version - when: is_containerized | bool and openshift_image_tag is not defined and (upgrading | bool or not has_image_tag_fact | bool) - -- debug: var=cli_image_version - -# Use the pre-existing image tag from system facts if present, and we're not upgrading. -# Ignores explicit openshift_image_tag if it's in the inventory, as this isn't an upgrade. -- set_fact: - l_image_tag: "{{ hostvars[inventory_hostname].openshift.docker.openshift_image_tag }}" - when: is_containerized | bool and not upgrading | bool and has_image_tag_fact | bool - -- set_fact: - l_image_tag: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2] | join('-') if openshift.common.deployment_type == 'origin' else - cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0] }}" - when: is_containerized | bool and openshift_image_tag is not defined and (upgrading | bool or not has_image_tag_fact | bool) - -- set_fact: - l_image_tag: "{{ openshift_image_tag }}" - when: is_containerized | bool and openshift_image_tag is defined and (upgrading | bool or not has_image_tag_fact | bool) - -- name: Set post docker install facts - openshift_facts: - role: "{{ item.role }}" - local_facts: "{{ item.local_facts }}" - with_items: - - role: docker - local_facts: - openshift_image_tag: "{{ l_image_tag | default(None) }}" - openshift_version: "{{ l_image_tag.split('-')[0] | oo_image_tag_to_rpm_version if l_image_tag is defined else '' }}" - when: is_containerized | bool -- cgit v1.2.3 From 0c7433838c8c6409b8de907fcc946fc73fe90527 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 24 May 2016 09:46:33 -0300 Subject: Work towards determining openshift_version when unspecified. openshift_docker role was largely useless now, but also almost did what we needed. (deps ordering still needs to be changed) Remove defaulting of openshift_version. --- roles/openshift_cli/tasks/main.yml | 1 + roles/openshift_common/defaults/main.yml | 1 - roles/openshift_docker/tasks/main.yml | 19 ++++++++++++++++--- roles/openshift_docker_facts/defaults/main.yml | 1 - roles/openshift_docker_facts/tasks/main.yml | 4 ++++ roles/openshift_facts/library/openshift_facts.py | 2 ++ roles/openshift_facts/tasks/main.yml | 1 + roles/openshift_master/defaults/main.yml | 2 +- roles/openshift_master/tasks/main.yml | 2 -- roles/openshift_master_ca/vars/main.yml | 1 - roles/openshift_node/defaults/main.yml | 1 - 11 files changed, 25 insertions(+), 10 deletions(-) (limited to 'roles') diff --git a/roles/openshift_cli/tasks/main.yml b/roles/openshift_cli/tasks/main.yml index 95711f95d..8679407dc 100644 --- a/roles/openshift_cli/tasks/main.yml +++ b/roles/openshift_cli/tasks/main.yml @@ -6,6 +6,7 @@ action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-clients state=present" when: not openshift.common.is_containerized | bool +# TODO: handle no openshift_version set? - name: Pull CLI Image command: > docker pull {{ openshift.common.cli_image }}:v{{ openshift_version }} diff --git a/roles/openshift_common/defaults/main.yml b/roles/openshift_common/defaults/main.yml index e46af70c7..267c03605 100644 --- a/roles/openshift_common/defaults/main.yml +++ b/roles/openshift_common/defaults/main.yml @@ -1,4 +1,3 @@ --- openshift_cluster_id: 'default' openshift_debug_level: 2 -openshift_version: "{{ openshift_pkg_version | default('') }}" diff --git a/roles/openshift_docker/tasks/main.yml b/roles/openshift_docker/tasks/main.yml index aaa472727..2ab31de8b 100644 --- a/roles/openshift_docker/tasks/main.yml +++ b/roles/openshift_docker/tasks/main.yml @@ -4,7 +4,20 @@ # openshift_image_tag correctly for upgrades. - set_fact: is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}" - # Does the host already have an image tag fact, used to determine if it's a new node - # in non-upgrade scenarios: - has_image_tag_fact: "{{ hostvars[inventory_hostname].openshift.docker.openshift_image_tag is defined }}" + +# If no openshift_version provided, figure out what to use: +# TODO: May want to move this to another role. +- name: Lookup latest OpenShift version if none specified + command: > + docker run --rm {{ openshift.common.cli_image }}:latest version + register: cli_image_version + when: is_containerized | bool and openshift_version is not defined + +- debug: var=cli_image_version + +- set_fact: + openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2][1:] | join('-') if openshift.common.deployment_type == 'origin' else cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" + when: is_containerized | bool and openshift_version is not defined + +- debug: var=openshift_version diff --git a/roles/openshift_docker_facts/defaults/main.yml b/roles/openshift_docker_facts/defaults/main.yml index 7baa87ab8..ed97d539c 100644 --- a/roles/openshift_docker_facts/defaults/main.yml +++ b/roles/openshift_docker_facts/defaults/main.yml @@ -1,2 +1 @@ --- -openshift_version: "{{ openshift_image_tag | default(openshift.docker.openshift_image_tag | default('')) }}" diff --git a/roles/openshift_docker_facts/tasks/main.yml b/roles/openshift_docker_facts/tasks/main.yml index 43359dcb5..bc3637351 100644 --- a/roles/openshift_docker_facts/tasks/main.yml +++ b/roles/openshift_docker_facts/tasks/main.yml @@ -57,6 +57,8 @@ l_common_version: "{{ common_version.stdout | default('0.0', True) }}" when: not openshift.common.is_containerized | bool +- debug: var=l_common_version + - name: Set docker version to be installed set_fact: docker_version: "{{ '1.8.2' }}" @@ -68,3 +70,5 @@ docker_version: "{{ '1.9.1' }}" when: " ( l_common_version | version_compare('3.2','>') and openshift.common.service_type == 'atomic-openshift' ) or ( l_common_version | version_compare('1.2','>') and openshift.common.service_type == 'origin' )" + +- debug: var=docker_version diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 6127948bf..33596cd3e 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1134,6 +1134,8 @@ def get_openshift_version(facts): _, output, _ = module.run_command(['/usr/bin/openshift', 'version']) version = parse_openshift_version(output) elif os.path.isfile('/usr/local/bin/openshift'): + # TODO: this should probably make sure the actual image is already present, this can take awhile if it has to pull + # and is falsely acting like openshift is already installed _, output, _ = module.run_command(['/usr/local/bin/openshift', 'version']) version = parse_openshift_version(output) diff --git a/roles/openshift_facts/tasks/main.yml b/roles/openshift_facts/tasks/main.yml index ca1a9b1e4..c67f6b86a 100644 --- a/roles/openshift_facts/tasks/main.yml +++ b/roles/openshift_facts/tasks/main.yml @@ -41,3 +41,4 @@ no_proxy: "{{ openshift_no_proxy | default(None) }}" generate_no_proxy_hosts: "{{ openshift_generate_no_proxy_hosts | default(True) }}" no_proxy_internal_hostnames: "{{ openshift_no_proxy_internal_hostnames | default(None) }}" + version_requested: "{{ openshift_version | default(None) }}" diff --git a/roles/openshift_master/defaults/main.yml b/roles/openshift_master/defaults/main.yml index dbd62c80f..14a1daf6c 100644 --- a/roles/openshift_master/defaults/main.yml +++ b/roles/openshift_master/defaults/main.yml @@ -1,4 +1,4 @@ --- openshift_node_ips: [] # TODO: update setting these values based on the facts -openshift_version: "{{ openshift_pkg_version | default(openshift_image_tag | default(openshift.docker.openshift_image_tag | default(''))) }}" +#openshift_version: "{{ openshift_pkg_version | default(openshift_image_tag | default(openshift.docker.openshift_image_tag | default(''))) }}" diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml index 0cbb49758..6870def5f 100644 --- a/roles/openshift_master/tasks/main.yml +++ b/roles/openshift_master/tasks/main.yml @@ -25,8 +25,6 @@ msg: "Pacemaker based HA is not supported at this time when used with containerized installs" when: openshift_master_ha | bool and openshift_master_cluster_method == "pacemaker" and openshift.common.is_containerized | bool -- debug: var=openshift_version - - name: Install Master package action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-master{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" when: not openshift.common.is_containerized | bool diff --git a/roles/openshift_master_ca/vars/main.yml b/roles/openshift_master_ca/vars/main.yml index b35339b18..1f6af808c 100644 --- a/roles/openshift_master_ca/vars/main.yml +++ b/roles/openshift_master_ca/vars/main.yml @@ -3,4 +3,3 @@ openshift_master_config_dir: "{{ openshift.common.config_base }}/master" openshift_master_ca_cert: "{{ openshift_master_config_dir }}/ca.crt" openshift_master_ca_key: "{{ openshift_master_config_dir }}/ca.key" openshift_master_ca_serial: "{{ openshift_master_config_dir }}/ca.serial.txt" -openshift_version: "{{ openshift_pkg_version | default('') }}" diff --git a/roles/openshift_node/defaults/main.yml b/roles/openshift_node/defaults/main.yml index 91aed7aa3..fffbf2994 100644 --- a/roles/openshift_node/defaults/main.yml +++ b/roles/openshift_node/defaults/main.yml @@ -13,4 +13,3 @@ os_firewall_allow: - service: OpenShift OVS sdn port: 4789/udp when: openshift.node.use_openshift_sdn | bool -openshift_version: "{{ openshift_pkg_version | default(openshift_image_tag | default(openshift.docker.openshift_image_tag | default(''))) }}" -- cgit v1.2.3 From 436c287335c3b578aaa2c1c8835583feaee2a3cf Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 24 May 2016 11:13:33 -0300 Subject: Stop downgrading Docker because we don't know what version to install yet. --- roles/openshift_docker_facts/tasks/main.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'roles') diff --git a/roles/openshift_docker_facts/tasks/main.yml b/roles/openshift_docker_facts/tasks/main.yml index bc3637351..2193b8c02 100644 --- a/roles/openshift_docker_facts/tasks/main.yml +++ b/roles/openshift_docker_facts/tasks/main.yml @@ -49,6 +49,8 @@ changed_when: false when: not openshift.common.is_containerized | bool +- debug: var=openshift_version + - set_fact: l_common_version: "{{ openshift_version | default('0.0', True) | oo_image_tag_to_rpm_version }}" when: openshift.common.is_containerized | bool @@ -59,16 +61,20 @@ - debug: var=l_common_version +# TODO: hardcoding specific docker versions here is not going to be maintainable... +# Don't define a docker version if we don't yet know what version we're going to install. - name: Set docker version to be installed set_fact: docker_version: "{{ '1.8.2' }}" - when: " ( l_common_version | version_compare('3.2','<') and openshift.common.service_type in ['openshift', 'atomic-openshift'] ) or - ( l_common_version | version_compare('1.1.4','<') and openshift.common.service_type == 'origin' )" + when: " l_common_version != '0.0' and + (( l_common_version | version_compare('3.2','<') and openshift.common.service_type in ['openshift', 'atomic-openshift'] ) or + ( l_common_version | version_compare('1.1.4','<') and openshift.common.service_type == 'origin' ))" - name: Set docker version to be installed set_fact: docker_version: "{{ '1.9.1' }}" - when: " ( l_common_version | version_compare('3.2','>') and openshift.common.service_type == 'atomic-openshift' ) or - ( l_common_version | version_compare('1.2','>') and openshift.common.service_type == 'origin' )" + when: " l_common_version != '0.0' and + (( l_common_version | version_compare('3.2','>') and openshift.common.service_type == 'atomic-openshift' ) or + ( l_common_version | version_compare('1.2','>') and openshift.common.service_type == 'origin' ))" - debug: var=docker_version -- cgit v1.2.3 From 5c833d9f29e292d11c0cbf08786e9015f133ce17 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 24 May 2016 11:56:11 -0300 Subject: Complete installation of first master containerized. --- roles/openshift_master/tasks/main.yml | 3 +-- roles/openshift_master/templates/atomic-openshift-master.j2 | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'roles') diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml index 6870def5f..86942f055 100644 --- a/roles/openshift_master/tasks/main.yml +++ b/roles/openshift_master/tasks/main.yml @@ -2,7 +2,6 @@ # TODO: add ability to configure certificates given either a local file to # point to or certificate contents, set in default cert locations. - debug: var=openshift_version -- fail: # Authentication Variable Validation # TODO: validate the different identity provider kinds as well @@ -31,7 +30,7 @@ - name: Pull master image command: > - docker pull {{ openshift.master.master_image }}:{{ openshift_version }} + docker pull {{ openshift.master.master_image }}:v{{ openshift_version }} when: openshift.common.is_containerized | bool - name: Create openshift.common.data_dir diff --git a/roles/openshift_master/templates/atomic-openshift-master.j2 b/roles/openshift_master/templates/atomic-openshift-master.j2 index 026787421..ba2974476 100644 --- a/roles/openshift_master/templates/atomic-openshift-master.j2 +++ b/roles/openshift_master/templates/atomic-openshift-master.j2 @@ -1,7 +1,7 @@ OPTIONS=--loglevel={{ openshift.master.debug_level }} CONFIG_FILE={{ openshift_master_config_file }} {% if openshift.common.is_containerized | bool %} -IMAGE_VERSION={{ openshift_version }} +IMAGE_VERSION=v{{ openshift_version }} {% endif %} {% if 'cloudprovider' in openshift and 'aws' in openshift.cloudprovider and 'kind' in openshift.cloudprovider and openshift.cloudprovider.kind == 'aws' and 'access_key' in openshift.cloudprovider.aws and 'secret_key' in openshift.cloudprovider.aws %} -- cgit v1.2.3 From 717012aa4d5df01e5859ce44705abfbf34be8047 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 25 May 2016 09:20:15 -0300 Subject: Hookup node configuration. --- roles/openshift_facts/library/openshift_facts.py | 8 ++++++-- roles/openshift_node/tasks/main.yml | 5 +++-- roles/openshift_node/tasks/systemd_units.yml | 2 +- roles/openshift_node/templates/openvswitch.sysconfig.j2 | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 33596cd3e..eee4d2b8e 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -826,7 +826,7 @@ def set_version_facts_if_unset(facts): if 'common' in facts: deployment_type = facts['common']['deployment_type'] version = get_openshift_version(facts) - if version is not None: + if version: facts['common']['version'] = version if deployment_type == 'origin': version_gte_3_1_or_1_1 = LooseVersion(version) >= LooseVersion('1.1.0') @@ -1150,7 +1150,11 @@ def parse_openshift_version(output): string: the version number """ versions = dict(e.split(' v') for e in output.splitlines() if ' v' in e) - return versions.get('openshift', '') + ver = versions.get('openshift', '') + # Remove trailing build number and commit hash from older versions, we need to return a straight + # w.x.y.z version here for use as openshift_version throughout the playbooks/roles. (i.e. 3.1.1.6-64-g80b61da) + ver = ver.split('-')[0] + return ver def apply_provider_facts(facts, provider_facts): diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml index e8bd13855..ec4252fed 100644 --- a/roles/openshift_node/tasks/main.yml +++ b/roles/openshift_node/tasks/main.yml @@ -1,4 +1,5 @@ --- +- debug: var=openshift_version # TODO: allow for overriding default ports where possible - fail: msg: "SELinux is disabled, This deployment type requires that SELinux is enabled." @@ -39,12 +40,12 @@ - name: Pull node image command: > - docker pull {{ openshift.node.node_image }}:{{ openshift_version }} + docker pull {{ openshift.node.node_image }}:v{{ openshift_version }} when: openshift.common.is_containerized | bool - name: Pull OpenVSwitch image command: > - docker pull {{ openshift.node.ovs_image }}:{{ openshift_version }} + docker pull {{ openshift.node.ovs_image }}:v{{ openshift_version }} when: openshift.common.is_containerized | bool and openshift.common.use_openshift_sdn | bool - name: Install the systemd units diff --git a/roles/openshift_node/tasks/systemd_units.yml b/roles/openshift_node/tasks/systemd_units.yml index e2a268260..0117a5a02 100644 --- a/roles/openshift_node/tasks/systemd_units.yml +++ b/roles/openshift_node/tasks/systemd_units.yml @@ -44,6 +44,6 @@ - regex: '^CONFIG_FILE=' line: "CONFIG_FILE={{ openshift_node_config_file }}" - regex: '^IMAGE_VERSION=' - line: "IMAGE_VERSION={{ openshift_version }}" + line: "IMAGE_VERSION=v{{ openshift_version }}" notify: - restart node diff --git a/roles/openshift_node/templates/openvswitch.sysconfig.j2 b/roles/openshift_node/templates/openvswitch.sysconfig.j2 index 1f8c20e07..53163b359 100644 --- a/roles/openshift_node/templates/openvswitch.sysconfig.j2 +++ b/roles/openshift_node/templates/openvswitch.sysconfig.j2 @@ -1 +1 @@ -IMAGE_VERSION={{ openshift_version }} +IMAGE_VERSION=v{{ openshift_version }} -- cgit v1.2.3 From 0fc4aae17527d8d51b3d3848ccbbf42c6d03fac9 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 25 May 2016 10:28:14 -0300 Subject: Fix version compare with using just 3.2 or 1.2. --- roles/openshift_docker_facts/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'roles') diff --git a/roles/openshift_docker_facts/tasks/main.yml b/roles/openshift_docker_facts/tasks/main.yml index 2193b8c02..dc369e883 100644 --- a/roles/openshift_docker_facts/tasks/main.yml +++ b/roles/openshift_docker_facts/tasks/main.yml @@ -74,7 +74,7 @@ set_fact: docker_version: "{{ '1.9.1' }}" when: " l_common_version != '0.0' and - (( l_common_version | version_compare('3.2','>') and openshift.common.service_type == 'atomic-openshift' ) or - ( l_common_version | version_compare('1.2','>') and openshift.common.service_type == 'origin' ))" + (( l_common_version | version_compare('3.2','>=') and openshift.common.service_type == 'atomic-openshift' ) or + ( l_common_version | version_compare('1.2','>=') and openshift.common.service_type == 'origin' ))" - debug: var=docker_version -- cgit v1.2.3 From c45ccc0ee879e93a4fd4304b4848595fa27014c5 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 25 May 2016 15:40:20 -0300 Subject: Convert generic openshift_version=3.2 to specific early in install. --- roles/openshift_docker/tasks/main.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'roles') diff --git a/roles/openshift_docker/tasks/main.yml b/roles/openshift_docker/tasks/main.yml index 2ab31de8b..1791d20c0 100644 --- a/roles/openshift_docker/tasks/main.yml +++ b/roles/openshift_docker/tasks/main.yml @@ -19,5 +19,17 @@ openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2][1:] | join('-') if openshift.common.deployment_type == 'origin' else cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" when: is_containerized | bool and openshift_version is not defined +# If we got an openshift_version like "3.2", lookup the latest 3.2 container version +# and use that value instead. +- name: Lookup specific OpenShift version if generic release specified + command: > + docker run --rm {{ openshift.common.cli_image }}:v{{ openshift_version }} version + register: cli_image_version + when: is_containerized | bool and openshift_version is defined and openshift_version.split('.') | length == 2 + +- set_fact: + openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2][1:] | join('-') if openshift.common.deployment_type == 'origin' else cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" + when: is_containerized | bool and openshift_version is defined and openshift_version.split('.') | length == 2 + - debug: var=openshift_version -- cgit v1.2.3 From 14b23a8b14636407143375cbac71b090663cee77 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 26 May 2016 14:30:37 -0300 Subject: Get rpm installations functional again. --- roles/openshift_common/meta/main.yml | 2 +- roles/openshift_common/tasks/main.yml | 11 ----------- roles/openshift_docker/tasks/main.yml | 28 +++++++++++++++++++++++++--- roles/openshift_master_ca/tasks/main.yml | 5 ++++- 4 files changed, 30 insertions(+), 16 deletions(-) (limited to 'roles') diff --git a/roles/openshift_common/meta/main.yml b/roles/openshift_common/meta/main.yml index f1cf3e161..d3f8a343f 100644 --- a/roles/openshift_common/meta/main.yml +++ b/roles/openshift_common/meta/main.yml @@ -13,4 +13,4 @@ galaxy_info: - cloud dependencies: - role: openshift_facts -- role: openshift_repos +- role: openshift_docker diff --git a/roles/openshift_common/tasks/main.yml b/roles/openshift_common/tasks/main.yml index 4ec255dbc..d548daae6 100644 --- a/roles/openshift_common/tasks/main.yml +++ b/roles/openshift_common/tasks/main.yml @@ -29,17 +29,6 @@ data_dir: "{{ openshift_data_dir | default(None) }}" use_dnsmasq: "{{ openshift_use_dnsmasq | default(None) }}" -# Using oo_image_tag_to_rpm_version here is a workaround for how -# openshift_version is set. That value is computed based on either RPM -# versions or image tags. openshift_common's usage requires that it be a RPM -# version and openshift_cli expects it to be an image tag. -- name: Install the base package for versioning - action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" - when: not openshift.common.is_containerized | bool - -- name: Set version facts - openshift_facts: - # For enterprise versions < 3.1 and origin versions < 1.1 we want to set the # hostname by default. - set_fact: diff --git a/roles/openshift_docker/tasks/main.yml b/roles/openshift_docker/tasks/main.yml index 1791d20c0..c7b8f504a 100644 --- a/roles/openshift_docker/tasks/main.yml +++ b/roles/openshift_docker/tasks/main.yml @@ -2,12 +2,34 @@ # It's important that we don't explicitly pull this image here. Otherwise we # could result in upgrading a preinstalled environment. We'll have to set # openshift_image_tag correctly for upgrades. + +# Determine openshift_version if none is set for this host, or if a generic "3.2" +# is set, determine the more specific version number by either installing the latest +# rpm, or pulling the v3.2 container and checking the resulting versions. + - set_fact: is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}" -# If no openshift_version provided, figure out what to use: -# TODO: May want to move this to another role. -- name: Lookup latest OpenShift version if none specified +- debug: var=openshift_version + +# RPM openshift_version setup: +- debug: msg="{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }}" +- name: Lookup latest OpenShift rpm version if none specified + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" + when: not is_containerized | bool and openshift_version is not defined + +- name: Reload facts to pick up version + openshift_facts: + when: not is_containerized | bool and openshift_version is not defined + +- set_fact: + openshift_version: "{{ openshift.common.version }}" + when: not is_containerized | bool and openshift_version is not defined + +# TODO: What to do if openshift_version = 3.2 for rpm based installs? + +# Containerized openshift_version setup: +- name: Lookup latest containerized OpenShift version if none specified command: > docker run --rm {{ openshift.common.cli_image }}:latest version register: cli_image_version diff --git a/roles/openshift_master_ca/tasks/main.yml b/roles/openshift_master_ca/tasks/main.yml index 4b7ef1d84..613aecc38 100644 --- a/roles/openshift_master_ca/tasks/main.yml +++ b/roles/openshift_master_ca/tasks/main.yml @@ -1,6 +1,9 @@ --- + +- debug: msg="{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }}" + - name: Install the base package for admin tooling - action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version }} state=present" + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" when: not openshift.common.is_containerized | bool register: install_result -- cgit v1.2.3 From 265daf6b65206fc17ad35e682640477d08efbc43 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 30 May 2016 11:52:48 -0300 Subject: Refactor openshift_version behavior. Very early in playbooks we must init the openshift_version for each host. First we determine it for the master, logic now is pushed into the openshift_docker role which we run only on first master via openshift_cli. Facts are reloaded leaving us with a first master with openshift.common.version fact we can then re-use on all other hosts. The correct version of docker should be installed as well. We then set openshift_version for all other hosts by re-using the master fact. --- roles/openshift_cli/tasks/main.yml | 4 ++++ roles/openshift_docker/tasks/main.yml | 29 +++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) (limited to 'roles') diff --git a/roles/openshift_cli/tasks/main.yml b/roles/openshift_cli/tasks/main.yml index 8679407dc..fe6672a47 100644 --- a/roles/openshift_cli/tasks/main.yml +++ b/roles/openshift_cli/tasks/main.yml @@ -29,3 +29,7 @@ - /usr/local/bin/oc - /usr/local/bin/kubectl when: openshift.common.is_containerized | bool + +- name: Reload facts to pick up installed OpenShift version + openshift_facts: + diff --git a/roles/openshift_docker/tasks/main.yml b/roles/openshift_docker/tasks/main.yml index c7b8f504a..c2ba63a1d 100644 --- a/roles/openshift_docker/tasks/main.yml +++ b/roles/openshift_docker/tasks/main.yml @@ -11,9 +11,24 @@ is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}" - debug: var=openshift_version +- debug: var=openshift_release +- debug: var=openshift_pkg_version +- debug: var=openshift_image_tag # RPM openshift_version setup: -- debug: msg="{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }}" +# TODO: support openshift_release here: +- name: Determine rpm version to configure when openshift_pkg_version specified + set_fact: + # Expects a leading "-" in inventory, strip it off here, and ignore a trailing release, + # openshift_version should always just be "3.2" or "3.2.0.44" + openshift_version: "{{ openshift_pkg_version[1:].split('-')[0] }}" + when: not is_containerized | bool and openshift_pkg_version is defined and openshift_version is not defined + +- name: Use openshift.common.version fact as version to configure if already installed + set_fact: + openshift_version: "{{ openshift.common.version }}" + when: openshift.common.version is defined and openshift_version is not defined + - name: Lookup latest OpenShift rpm version if none specified action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" when: not is_containerized | bool and openshift_version is not defined @@ -26,9 +41,18 @@ openshift_version: "{{ openshift.common.version }}" when: not is_containerized | bool and openshift_version is not defined -# TODO: What to do if openshift_version = 3.2 for rpm based installs? # Containerized openshift_version setup: +- name: Determine version to configure if containerized and release specified + set_fact: + openshift_version: "{{ openshift_release }}" + when: is_containerized | bool and openshift_release is defined and openshift_version is not defined + +- name: Determine container version to configure when openshift_image_tag specified + set_fact: + openshift_version: "{{ openshift_image_tag.split('v',1)[1] }}" + when: is_containerized | bool and openshift_image_tag is defined and openshift_version is not defined + - name: Lookup latest containerized OpenShift version if none specified command: > docker run --rm {{ openshift.common.cli_image }}:latest version @@ -53,5 +77,6 @@ openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2][1:] | join('-') if openshift.common.deployment_type == 'origin' else cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" when: is_containerized | bool and openshift_version is defined and openshift_version.split('.') | length == 2 + - debug: var=openshift_version -- cgit v1.2.3 From 1d4a3de319f3e3f33bd5bd65298c68c04f576085 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 30 May 2016 14:29:50 -0300 Subject: Fix error with containerized etcd install. Role was assuming it could successfully disable the rpm etcd service without checking if it was actuall present. --- roles/etcd/tasks/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'roles') diff --git a/roles/etcd/tasks/main.yml b/roles/etcd/tasks/main.yml index a798dc973..71735dc25 100644 --- a/roles/etcd/tasks/main.yml +++ b/roles/etcd/tasks/main.yml @@ -28,18 +28,18 @@ state: directory mode: 0700 +- name: Check for etcd service presence + command: systemctl show etcd.service + register: etcd_show + changed_when: false + - name: Disable system etcd when containerized - when: etcd_is_containerized | bool + when: etcd_is_containerized | bool and 'LoadState=not-found' not in etcd_show.stdout service: name: etcd state: stopped enabled: no -- name: Check for etcd service presence - command: systemctl show etcd.service - register: etcd_show - changed_when: false - - name: Mask system etcd when containerized when: etcd_is_containerized | bool and 'LoadState=not-found' not in etcd_show.stdout command: systemctl mask etcd -- cgit v1.2.3 From 5b73307fa59680959da5a61e94a0c7316ca0ccb6 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 30 May 2016 16:03:46 -0300 Subject: Fix use of openshift_version in ca role. --- roles/openshift_ca/tasks/main.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'roles') diff --git a/roles/openshift_ca/tasks/main.yml b/roles/openshift_ca/tasks/main.yml index 497473f22..cd72a4e21 100644 --- a/roles/openshift_ca/tasks/main.yml +++ b/roles/openshift_ca/tasks/main.yml @@ -4,10 +4,7 @@ when: openshift_ca_host is not defined - name: Install the base package for admin tooling - action: > - {{ ansible_pkg_mgr }} - name={{ openshift.common.service_type }}{{ openshift_version }} - state=present + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" when: not openshift.common.is_containerized | bool register: install_result delegate_to: "{{ openshift_ca_host }}" -- cgit v1.2.3 From 2b9144e782de10627d44afe977cef98686c78a01 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 30 May 2016 16:04:10 -0300 Subject: Fix error restarting master service that may not be there. --- roles/openshift_master/tasks/main.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'roles') diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml index 86942f055..d50d552c8 100644 --- a/roles/openshift_master/tasks/main.yml +++ b/roles/openshift_master/tasks/main.yml @@ -165,9 +165,14 @@ register: start_result notify: Verify API Server -- name: Stop and disable non HA master when running HA +- name: Check for non-HA master service presence + command: systemctl show {{ openshift.common.service_type }}-master.service + register: master_svc_show + changed_when: false + +- name: Stop and disable non-HA master when running HA service: name={{ openshift.common.service_type }}-master enabled=no state=stopped - when: openshift_master_ha | bool + when: openshift_master_ha | bool and 'LoadState=not-found' not in master_svc_show.stdout - set_fact: master_service_status_changed: "{{ start_result | changed }}" -- cgit v1.2.3 From 4a97c9d0f7409b2be90964647f5712e51df37242 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 30 May 2016 16:06:00 -0300 Subject: Add leading v for remaining IMAGE_VERSION templates. --- .../templates/native-cluster/atomic-openshift-master-api.j2 | 2 +- .../templates/native-cluster/atomic-openshift-master-controllers.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'roles') diff --git a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 index 02c22e374..36e4446b9 100644 --- a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 +++ b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 @@ -1,7 +1,7 @@ OPTIONS=--loglevel={{ openshift.master.debug_level }} --listen={{ 'https' if openshift.master.api_use_ssl else 'http' }}://{{ openshift.master.bind_addr }}:{{ openshift.master.api_port }} --master={{ openshift.master.loopback_api_url }} CONFIG_FILE={{ openshift_master_config_file }} {% if openshift.common.is_containerized | bool %} -IMAGE_VERSION={{ openshift_version }} +IMAGE_VERSION=v{{ openshift_version }} {% endif %} {% if 'cloudprovider' in openshift and 'aws' in openshift.cloudprovider and 'kind' in openshift.cloudprovider and openshift.cloudprovider.kind == 'aws' and 'access_key' in openshift.cloudprovider.aws and 'secret_key' in openshift.cloudprovider.aws %} diff --git a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 index 644640577..ca3ae0ef8 100644 --- a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 +++ b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 @@ -1,7 +1,7 @@ OPTIONS=--loglevel={{ openshift.master.debug_level }} --listen={{ 'https' if openshift.master.api_use_ssl else 'http' }}://{{ openshift.master.bind_addr }}:{{ openshift.master.controllers_port }} CONFIG_FILE={{ openshift_master_config_file }} {% if openshift.common.is_containerized | bool %} -IMAGE_VERSION={{ openshift_version }} +IMAGE_VERSION=v{{ openshift_version }} {% endif %} {% if 'cloudprovider' in openshift and 'aws' in openshift.cloudprovider and 'kind' in openshift.cloudprovider and openshift.cloudprovider.kind == 'aws' and 'access_key' in openshift.cloudprovider.aws and 'secret_key' in openshift.cloudprovider.aws %} -- cgit v1.2.3 From efb153693104976e86a91ebf6bf236448be5a84d Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 31 May 2016 10:26:53 -0300 Subject: Drop unnecessary node playbook version calculation. --- roles/openshift_docker/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/openshift_docker/tasks/main.yml b/roles/openshift_docker/tasks/main.yml index c2ba63a1d..00f761987 100644 --- a/roles/openshift_docker/tasks/main.yml +++ b/roles/openshift_docker/tasks/main.yml @@ -29,7 +29,7 @@ openshift_version: "{{ openshift.common.version }}" when: openshift.common.version is defined and openshift_version is not defined -- name: Lookup latest OpenShift rpm version if none specified +- name: Install latest OpenShift rpm to check version action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" when: not is_containerized | bool and openshift_version is not defined -- cgit v1.2.3 From 47c8c0b1df866b86b111e3e03b827011ec4c341c Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 31 May 2016 11:56:13 -0300 Subject: Break version calc out into a role, separate yaml for containerized/rpm. --- roles/openshift_docker/meta/main.yml | 4 +- roles/openshift_docker/tasks/main.yml | 81 ---------------------- roles/openshift_version/meta/main.yml | 17 +++++ roles/openshift_version/tasks/main.yml | 29 ++++++++ .../tasks/set_version_containerized.yml | 34 +++++++++ roles/openshift_version/tasks/set_version_rpm.yml | 23 ++++++ 6 files changed, 104 insertions(+), 84 deletions(-) create mode 100644 roles/openshift_version/meta/main.yml create mode 100644 roles/openshift_version/tasks/main.yml create mode 100644 roles/openshift_version/tasks/set_version_containerized.yml create mode 100644 roles/openshift_version/tasks/set_version_rpm.yml (limited to 'roles') diff --git a/roles/openshift_docker/meta/main.yml b/roles/openshift_docker/meta/main.yml index d98f953ea..c1a6611d1 100644 --- a/roles/openshift_docker/meta/main.yml +++ b/roles/openshift_docker/meta/main.yml @@ -12,6 +12,4 @@ galaxy_info: categories: - cloud dependencies: -- role: openshift_repos -- role: openshift_docker_facts -- role: docker +- role: openshift_version diff --git a/roles/openshift_docker/tasks/main.yml b/roles/openshift_docker/tasks/main.yml index 00f761987..ed97d539c 100644 --- a/roles/openshift_docker/tasks/main.yml +++ b/roles/openshift_docker/tasks/main.yml @@ -1,82 +1 @@ --- -# It's important that we don't explicitly pull this image here. Otherwise we -# could result in upgrading a preinstalled environment. We'll have to set -# openshift_image_tag correctly for upgrades. - -# Determine openshift_version if none is set for this host, or if a generic "3.2" -# is set, determine the more specific version number by either installing the latest -# rpm, or pulling the v3.2 container and checking the resulting versions. - -- set_fact: - is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}" - -- debug: var=openshift_version -- debug: var=openshift_release -- debug: var=openshift_pkg_version -- debug: var=openshift_image_tag - -# RPM openshift_version setup: -# TODO: support openshift_release here: -- name: Determine rpm version to configure when openshift_pkg_version specified - set_fact: - # Expects a leading "-" in inventory, strip it off here, and ignore a trailing release, - # openshift_version should always just be "3.2" or "3.2.0.44" - openshift_version: "{{ openshift_pkg_version[1:].split('-')[0] }}" - when: not is_containerized | bool and openshift_pkg_version is defined and openshift_version is not defined - -- name: Use openshift.common.version fact as version to configure if already installed - set_fact: - openshift_version: "{{ openshift.common.version }}" - when: openshift.common.version is defined and openshift_version is not defined - -- name: Install latest OpenShift rpm to check version - action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" - when: not is_containerized | bool and openshift_version is not defined - -- name: Reload facts to pick up version - openshift_facts: - when: not is_containerized | bool and openshift_version is not defined - -- set_fact: - openshift_version: "{{ openshift.common.version }}" - when: not is_containerized | bool and openshift_version is not defined - - -# Containerized openshift_version setup: -- name: Determine version to configure if containerized and release specified - set_fact: - openshift_version: "{{ openshift_release }}" - when: is_containerized | bool and openshift_release is defined and openshift_version is not defined - -- name: Determine container version to configure when openshift_image_tag specified - set_fact: - openshift_version: "{{ openshift_image_tag.split('v',1)[1] }}" - when: is_containerized | bool and openshift_image_tag is defined and openshift_version is not defined - -- name: Lookup latest containerized OpenShift version if none specified - command: > - docker run --rm {{ openshift.common.cli_image }}:latest version - register: cli_image_version - when: is_containerized | bool and openshift_version is not defined - -- debug: var=cli_image_version - -- set_fact: - openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2][1:] | join('-') if openshift.common.deployment_type == 'origin' else cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" - when: is_containerized | bool and openshift_version is not defined - -# If we got an openshift_version like "3.2", lookup the latest 3.2 container version -# and use that value instead. -- name: Lookup specific OpenShift version if generic release specified - command: > - docker run --rm {{ openshift.common.cli_image }}:v{{ openshift_version }} version - register: cli_image_version - when: is_containerized | bool and openshift_version is defined and openshift_version.split('.') | length == 2 - -- set_fact: - openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2][1:] | join('-') if openshift.common.deployment_type == 'origin' else cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" - when: is_containerized | bool and openshift_version is defined and openshift_version.split('.') | length == 2 - - -- debug: var=openshift_version - diff --git a/roles/openshift_version/meta/main.yml b/roles/openshift_version/meta/main.yml new file mode 100644 index 000000000..d98f953ea --- /dev/null +++ b/roles/openshift_version/meta/main.yml @@ -0,0 +1,17 @@ +--- +galaxy_info: + author: Jason DeTiberus + description: OpenShift Docker + company: Red Hat, Inc. + license: Apache License, Version 2.0 + min_ansible_version: 1.9 + platforms: + - name: EL + versions: + - 7 + categories: + - cloud +dependencies: +- role: openshift_repos +- role: openshift_docker_facts +- role: docker diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml new file mode 100644 index 000000000..379809eda --- /dev/null +++ b/roles/openshift_version/tasks/main.yml @@ -0,0 +1,29 @@ +--- +# Determine the openshift_version to configure if none has been specified or set previously. + +- set_fact: + is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}" + +- debug: var=openshift_version +- debug: var=openshift_release +- debug: var=openshift_pkg_version +- debug: var=openshift_image_tag + +# Here we protect the version already installed unless something has already set +# an openshift_version to configure. +- name: Use openshift.common.version fact as version to configure if already installed + set_fact: + openshift_version: "{{ openshift.common.version }}" + when: openshift.common.version is defined and openshift_version is not defined + +- name: Set openshift_version for rpm installation + include: set_version_rpm.yml + when: not is_containerized and openshift_version is not defined + +- name: Set openshift_version for containerized installation + include: set_version_containerized.yml + when: is_containerized and openshift_version is not defined + +- debug: var=openshift_version + + diff --git a/roles/openshift_version/tasks/set_version_containerized.yml b/roles/openshift_version/tasks/set_version_containerized.yml new file mode 100644 index 000000000..0da3484a9 --- /dev/null +++ b/roles/openshift_version/tasks/set_version_containerized.yml @@ -0,0 +1,34 @@ +--- +- name: Set containerized version to configure if openshift_image_tag specified + set_fact: + openshift_version: "{{ openshift_image_tag.split('v',1)[1] }}" + when: openshift_image_tag is defined + +- name: Set containerized version to configure if openshift_release specified + set_fact: + openshift_version: "{{ openshift_release }}" + when: openshift_release is defined and openshift_version is not defined + +- name: Lookup latest containerized version if no version specified + command: > + docker run --rm {{ openshift.common.cli_image }}:latest version + register: cli_image_version + when: openshift_version is not defined + +- debug: var=cli_image_version + +- set_fact: + openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2][1:] | join('-') if openshift.common.deployment_type == 'origin' else cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" + when: openshift_version is not defined + +# If we got an openshift_version like "3.2", lookup the latest 3.2 container version +# and use that value instead. +- name: Set precise containerized version to configure if openshift_release specified + command: > + docker run --rm {{ openshift.common.cli_image }}:v{{ openshift_version }} version + register: cli_image_version + when: openshift_version is defined and openshift_version.split('.') | length == 2 + +- set_fact: + openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2][1:] | join('-') if openshift.common.deployment_type == 'origin' else cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" + when: openshift_version is defined and openshift_version.split('.') | length == 2 diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml new file mode 100644 index 000000000..ab8f4b22f --- /dev/null +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -0,0 +1,23 @@ +--- +# TODO: support openshift_release here? +- name: Set rpm version to configure if openshift_pkg_version specified + set_fact: + # Expects a leading "-" in inventory, strip it off here, and ignore a trailing release, + # openshift_version should always just be "3.2" or "3.2.0.44" + openshift_version: "{{ openshift_pkg_version[1:].split('-')[0] }}" + when: openshift_pkg_version is defined + +# We do not have as fine grained control over version to install presently with rpms, +# we just assume the user has configured the correct repos and install the rpm requested. +- name: Install latest rpm available in configured repos to check version + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" + when: openshift_version is not defined + +- name: Reload facts to pick up version + openshift_facts: + when: openshift_version is not defined + +- name: Set rpm version to configure to latest available in repos + set_fact: + openshift_version: "{{ openshift.common.version }}" + when: openshift_version is not defined -- cgit v1.2.3 From 87cf5935b0a480aa2b2f4333a48173ef0b44c749 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 1 Jun 2016 12:45:05 -0300 Subject: Fix installing release 3.1 not converting to precise version. --- roles/openshift_version/tasks/main.yml | 4 ++-- roles/openshift_version/tasks/set_version_containerized.yml | 6 +++++- roles/openshift_version/tasks/set_version_rpm.yml | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'roles') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index 379809eda..ee04ad59f 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -18,11 +18,11 @@ - name: Set openshift_version for rpm installation include: set_version_rpm.yml - when: not is_containerized and openshift_version is not defined + when: not is_containerized - name: Set openshift_version for containerized installation include: set_version_containerized.yml - when: is_containerized and openshift_version is not defined + when: is_containerized - debug: var=openshift_version diff --git a/roles/openshift_version/tasks/set_version_containerized.yml b/roles/openshift_version/tasks/set_version_containerized.yml index 0da3484a9..f3eab4831 100644 --- a/roles/openshift_version/tasks/set_version_containerized.yml +++ b/roles/openshift_version/tasks/set_version_containerized.yml @@ -2,7 +2,7 @@ - name: Set containerized version to configure if openshift_image_tag specified set_fact: openshift_version: "{{ openshift_image_tag.split('v',1)[1] }}" - when: openshift_image_tag is defined + when: openshift_image_tag is defined and openshift_version is not defined - name: Set containerized version to configure if openshift_release specified set_fact: @@ -21,6 +21,9 @@ openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2][1:] | join('-') if openshift.common.deployment_type == 'origin' else cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" when: openshift_version is not defined +- debug: msg="{{ openshift_version }}" +#- debug: var=openshift_version.split('.') + # If we got an openshift_version like "3.2", lookup the latest 3.2 container version # and use that value instead. - name: Set precise containerized version to configure if openshift_release specified @@ -32,3 +35,4 @@ - set_fact: openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2][1:] | join('-') if openshift.common.deployment_type == 'origin' else cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" when: openshift_version is defined and openshift_version.split('.') | length == 2 + diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml index ab8f4b22f..b201f24d8 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -5,7 +5,7 @@ # Expects a leading "-" in inventory, strip it off here, and ignore a trailing release, # openshift_version should always just be "3.2" or "3.2.0.44" openshift_version: "{{ openshift_pkg_version[1:].split('-')[0] }}" - when: openshift_pkg_version is defined + when: openshift_pkg_version is defined and openshift_version is not defined # We do not have as fine grained control over version to install presently with rpms, # we just assume the user has configured the correct repos and install the rpm requested. -- cgit v1.2.3 From 0514bdffca4e06144f4f81db037490d2c0fede40 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 1 Jun 2016 14:28:53 -0300 Subject: Update openshift_version author info. --- roles/openshift_version/meta/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'roles') diff --git a/roles/openshift_version/meta/main.yml b/roles/openshift_version/meta/main.yml index d98f953ea..8142fe823 100644 --- a/roles/openshift_version/meta/main.yml +++ b/roles/openshift_version/meta/main.yml @@ -1,7 +1,7 @@ --- galaxy_info: - author: Jason DeTiberus - description: OpenShift Docker + author: Devan Goodwin + description: Determines the version of OpenShift to install or upgrade to company: Red Hat, Inc. license: Apache License, Version 2.0 min_ansible_version: 1.9 -- cgit v1.2.3 From 88839ab89210ecd3d20d1f10f8f03bf0a801502a Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 6 Jun 2016 11:47:50 -0300 Subject: Do not install rpm for version in openshift_version role. --- roles/openshift_common/meta/main.yml | 3 ++- roles/openshift_common/tasks/main.yml | 11 +++++++++++ .../tasks/set_version_containerized.yml | 1 - roles/openshift_version/tasks/set_version_rpm.yml | 19 +++++++++---------- 4 files changed, 22 insertions(+), 12 deletions(-) (limited to 'roles') diff --git a/roles/openshift_common/meta/main.yml b/roles/openshift_common/meta/main.yml index d3f8a343f..cd8c75ec5 100644 --- a/roles/openshift_common/meta/main.yml +++ b/roles/openshift_common/meta/main.yml @@ -13,4 +13,5 @@ galaxy_info: - cloud dependencies: - role: openshift_facts -- role: openshift_docker +- role: openshift_repos +- role: openshift_version diff --git a/roles/openshift_common/tasks/main.yml b/roles/openshift_common/tasks/main.yml index d548daae6..4ec255dbc 100644 --- a/roles/openshift_common/tasks/main.yml +++ b/roles/openshift_common/tasks/main.yml @@ -29,6 +29,17 @@ data_dir: "{{ openshift_data_dir | default(None) }}" use_dnsmasq: "{{ openshift_use_dnsmasq | default(None) }}" +# Using oo_image_tag_to_rpm_version here is a workaround for how +# openshift_version is set. That value is computed based on either RPM +# versions or image tags. openshift_common's usage requires that it be a RPM +# version and openshift_cli expects it to be an image tag. +- name: Install the base package for versioning + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" + when: not openshift.common.is_containerized | bool + +- name: Set version facts + openshift_facts: + # For enterprise versions < 3.1 and origin versions < 1.1 we want to set the # hostname by default. - set_fact: diff --git a/roles/openshift_version/tasks/set_version_containerized.yml b/roles/openshift_version/tasks/set_version_containerized.yml index f3eab4831..fc15b2d35 100644 --- a/roles/openshift_version/tasks/set_version_containerized.yml +++ b/roles/openshift_version/tasks/set_version_containerized.yml @@ -22,7 +22,6 @@ when: openshift_version is not defined - debug: msg="{{ openshift_version }}" -#- debug: var=openshift_version.split('.') # If we got an openshift_version like "3.2", lookup the latest 3.2 container version # and use that value instead. diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml index b201f24d8..bcf275135 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -7,17 +7,16 @@ openshift_version: "{{ openshift_pkg_version[1:].split('-')[0] }}" when: openshift_pkg_version is defined and openshift_version is not defined -# We do not have as fine grained control over version to install presently with rpms, -# we just assume the user has configured the correct repos and install the rpm requested. -- name: Install latest rpm available in configured repos to check version - action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" +- name: Gather common package version + command: > + {{ repoquery_cmd }} --qf '%{version}' "{{ openshift.common.service_type}}" + register: common_version + failed_when: false + changed_when: false when: openshift_version is not defined -- name: Reload facts to pick up version - openshift_facts: - when: openshift_version is not defined +- debug: var=common_version -- name: Set rpm version to configure to latest available in repos - set_fact: - openshift_version: "{{ openshift.common.version }}" +- set_fact: + openshift_version: "{{ common_version.stdout | default('0.0', True) }}" when: openshift_version is not defined -- cgit v1.2.3 From dd8501ca8199484531e0a6d2b40139d4085afefa Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 7 Jun 2016 14:37:34 -0300 Subject: Force version to latest 3.2 during upgrade. --- roles/openshift_version/tasks/main.yml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'roles') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index ee04ad59f..1cfbff1b0 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -26,4 +26,8 @@ - debug: var=openshift_version +# At this point we know openshift_version is set appropriately. Now we set +# openshift_image_tag and openshift_pkg_version, so all roles can always assume +# each of this variables *will* be set correctly and can use them per their +# intended purpose. -- cgit v1.2.3 From 258ea62f3bb1bfc89eb4e676c77d1610aa067c43 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 7 Jun 2016 15:17:28 -0300 Subject: Respect image tag/pkg version during upgrade. --- roles/openshift_version/tasks/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'roles') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index 1cfbff1b0..39accf579 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -9,12 +9,12 @@ - debug: var=openshift_pkg_version - debug: var=openshift_image_tag -# Here we protect the version already installed unless something has already set -# an openshift_version to configure. +# Protect the installed version by default unless explicitly told not to, or given an +# openshift_version already. - name: Use openshift.common.version fact as version to configure if already installed set_fact: openshift_version: "{{ openshift.common.version }}" - when: openshift.common.version is defined and openshift_version is not defined + when: openshift.common.version is defined and openshift_version is not defined and openshift_protect_installed_version - name: Set openshift_version for rpm installation include: set_version_rpm.yml -- cgit v1.2.3 From bcf414e8b559d35909f26420d9e7dec3cd0a1897 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 9 Jun 2016 12:48:40 -0300 Subject: Fix missing openshift.common.version fact on containerized nodes. --- roles/openshift_facts/library/openshift_facts.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 8824a663c..856dcbdb8 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1138,6 +1138,9 @@ def get_openshift_version(facts): # and is falsely acting like openshift is already installed _, output, _ = module.run_command(['/usr/local/bin/openshift', 'version']) version = parse_openshift_version(output) + elif 'node' in facts and 'common' in facts and 'is_containerized' in facts['common']: + _, output, _ = module.run_command(['docker', 'run', '--rm', facts['common']['cli_image'], 'version']) + version = parse_openshift_version(output) return version -- cgit v1.2.3 From 755a48c4ebf1061ce19892e5378fba769027bfc1 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 10 Jun 2016 10:21:19 -0300 Subject: Fix version unset bug, and set common ver fact on containerized nodes. --- roles/openshift_facts/library/openshift_facts.py | 14 ++++++++++++-- roles/openshift_version/tasks/main.yml | 5 +++++ 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 856dcbdb8..9d7705af7 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1139,11 +1139,21 @@ def get_openshift_version(facts): _, output, _ = module.run_command(['/usr/local/bin/openshift', 'version']) version = parse_openshift_version(output) elif 'node' in facts and 'common' in facts and 'is_containerized' in facts['common']: - _, output, _ = module.run_command(['docker', 'run', '--rm', facts['common']['cli_image'], 'version']) - version = parse_openshift_version(output) + version = get_containerized_node_openshift_version(facts) return version +def get_containerized_node_openshift_version(facts): + node_svc = "%s-node" % facts['common']['service_type'] + rc, _, _ = module.run_command(['systemctl', 'is-active', node_svc]) + if rc > 0: + # Node service not running or doesn't exist: + return None + # Node service running, exec in and get the version: + _, output, _ = module.run_command(['docker', 'exec', '-ti', node_svc, 'openshift', 'version']) + return parse_openshift_version(output) + + def parse_openshift_version(output): """ Apply provider facts to supplied facts dict diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index 39accf579..29724a9e5 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -4,6 +4,11 @@ - set_fact: is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}" +# Make sure we copy this to a fact if given a var: +- set_fact: + openshift_version: "{{ openshift_version }}" + when: openshift_version is defined + - debug: var=openshift_version - debug: var=openshift_release - debug: var=openshift_pkg_version -- cgit v1.2.3 From 3a30afcdfaf115ab0fb455127cdafbe25f52e7ed Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 10 Jun 2016 10:47:46 -0300 Subject: Remove unused docker facts tasks. --- roles/openshift_docker_facts/tasks/main.yml | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'roles') diff --git a/roles/openshift_docker_facts/tasks/main.yml b/roles/openshift_docker_facts/tasks/main.yml index 866b6a5fe..2e68809ca 100644 --- a/roles/openshift_docker_facts/tasks/main.yml +++ b/roles/openshift_docker_facts/tasks/main.yml @@ -38,24 +38,3 @@ - set_fact: docker_options: "{{ openshift.docker.options | default(omit) }}" when: not openshift.docker.hosted_registry_insecure | default(False) | bool - -# Avoid docker 1.9 when installing origin < 1.2 or OSE < 3.2 on RHEL/Centos and -# See: https://bugzilla.redhat.com/show_bug.cgi?id=1304038 -- name: Gather common package version - command: > - {{ repoquery_cmd }} --qf '%{version}' "{{ openshift.common.service_type}}" - register: common_version - failed_when: false - changed_when: false - when: not openshift.common.is_containerized | bool - -- debug: var=openshift_version - -- set_fact: - l_common_version: "{{ openshift_version | default('0.0', True) | oo_image_tag_to_rpm_version }}" - when: openshift.common.is_containerized | bool - -- set_fact: - l_common_version: "{{ common_version.stdout | default('0.0', True) }}" - when: not openshift.common.is_containerized | bool - -- cgit v1.2.3 From ef37abd3dd236d1c7129527a057ca2ac6377cb75 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 13 Jun 2016 13:02:32 -0300 Subject: Fix rpm installs. --- roles/openshift_facts/tasks/main.yml | 1 - roles/openshift_version/tasks/main.yml | 16 +++++++++------- roles/openshift_version/tasks/set_version_rpm.yml | 2 ++ 3 files changed, 11 insertions(+), 8 deletions(-) (limited to 'roles') diff --git a/roles/openshift_facts/tasks/main.yml b/roles/openshift_facts/tasks/main.yml index c67f6b86a..ca1a9b1e4 100644 --- a/roles/openshift_facts/tasks/main.yml +++ b/roles/openshift_facts/tasks/main.yml @@ -41,4 +41,3 @@ no_proxy: "{{ openshift_no_proxy | default(None) }}" generate_no_proxy_hosts: "{{ openshift_generate_no_proxy_hosts | default(True) }}" no_proxy_internal_hostnames: "{{ openshift_no_proxy_internal_hostnames | default(None) }}" - version_requested: "{{ openshift_version | default(None) }}" diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index 29724a9e5..e27add09e 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -9,11 +9,6 @@ openshift_version: "{{ openshift_version }}" when: openshift_version is defined -- debug: var=openshift_version -- debug: var=openshift_release -- debug: var=openshift_pkg_version -- debug: var=openshift_image_tag - # Protect the installed version by default unless explicitly told not to, or given an # openshift_version already. - name: Use openshift.common.version fact as version to configure if already installed @@ -21,13 +16,20 @@ openshift_version: "{{ openshift.common.version }}" when: openshift.common.version is defined and openshift_version is not defined and openshift_protect_installed_version +- debug: var=is_containerized +- debug: var=openshift_version +- debug: msg="{{ openshift_version is defined }}" +- debug: var=openshift_release +- debug: var=openshift_pkg_version +- debug: var=openshift_image_tag + - name: Set openshift_version for rpm installation include: set_version_rpm.yml - when: not is_containerized + when: not is_containerized | bool - name: Set openshift_version for containerized installation include: set_version_containerized.yml - when: is_containerized + when: is_containerized | bool - debug: var=openshift_version diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml index bcf275135..b15f0e993 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -7,6 +7,8 @@ openshift_version: "{{ openshift_pkg_version[1:].split('-')[0] }}" when: openshift_pkg_version is defined and openshift_version is not defined +- debug: var=openshift_version + - name: Gather common package version command: > {{ repoquery_cmd }} --qf '%{version}' "{{ openshift.common.service_type}}" -- cgit v1.2.3 From ba525e1ebfe44b1993f0b37801122c4030e72d48 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 13 Jun 2016 13:02:41 -0300 Subject: Make openshift_version role docker dep conditional. --- roles/openshift_version/meta/main.yml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'roles') diff --git a/roles/openshift_version/meta/main.yml b/roles/openshift_version/meta/main.yml index 8142fe823..bddb20708 100644 --- a/roles/openshift_version/meta/main.yml +++ b/roles/openshift_version/meta/main.yml @@ -14,4 +14,6 @@ galaxy_info: dependencies: - role: openshift_repos - role: openshift_docker_facts + when: openshift.common.is_containerized | default(False) | bool - role: docker + when: openshift.common.is_containerized | default(False) | bool -- cgit v1.2.3 From af2cc5587132427faae21785599280b1f05e6cda Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 13 Jun 2016 15:15:50 -0300 Subject: Restore 3.2 RPM version check before upgrading. --- roles/openshift_version/meta/main.yml | 1 - 1 file changed, 1 deletion(-) (limited to 'roles') diff --git a/roles/openshift_version/meta/main.yml b/roles/openshift_version/meta/main.yml index bddb20708..70974da17 100644 --- a/roles/openshift_version/meta/main.yml +++ b/roles/openshift_version/meta/main.yml @@ -14,6 +14,5 @@ galaxy_info: dependencies: - role: openshift_repos - role: openshift_docker_facts - when: openshift.common.is_containerized | default(False) | bool - role: docker when: openshift.common.is_containerized | default(False) | bool -- cgit v1.2.3 From 04643670db5709358fe55916705a9ce15ff0bb1e Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 13 Jun 2016 15:32:10 -0300 Subject: Remove the use of the upgrading variable. --- roles/openshift_docker/defaults/main.yml | 1 - 1 file changed, 1 deletion(-) (limited to 'roles') diff --git a/roles/openshift_docker/defaults/main.yml b/roles/openshift_docker/defaults/main.yml index aebef75d6..ed97d539c 100644 --- a/roles/openshift_docker/defaults/main.yml +++ b/roles/openshift_docker/defaults/main.yml @@ -1,2 +1 @@ --- -upgrading: False -- cgit v1.2.3 From a836a35b63ff1476eca5a8545a6c11ab389026d0 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 14 Jun 2016 09:06:39 -0300 Subject: Always populate openshift_image_tag and openshift_pkg_version. Allows the use of arbitrary tags, precise control over containers and rpms, and likely mixed environments. --- roles/openshift_ca/tasks/main.yml | 2 +- roles/openshift_cli/tasks/main.yml | 3 +-- roles/openshift_common/tasks/main.yml | 6 +----- roles/openshift_master/tasks/main.yml | 5 ++--- .../templates/atomic-openshift-master.j2 | 2 +- .../native-cluster/atomic-openshift-master-api.j2 | 2 +- .../atomic-openshift-master-controllers.j2 | 2 +- roles/openshift_master_ca/tasks/main.yml | 4 +--- roles/openshift_node/tasks/main.yml | 9 ++++---- roles/openshift_node/tasks/systemd_units.yml | 2 +- .../templates/openvswitch.sysconfig.j2 | 2 +- roles/openshift_version/tasks/main.yml | 24 ++++++++++++++++++++-- .../tasks/set_version_containerized.yml | 4 +++- roles/openshift_version/tasks/set_version_rpm.yml | 2 +- 14 files changed, 41 insertions(+), 28 deletions(-) (limited to 'roles') diff --git a/roles/openshift_ca/tasks/main.yml b/roles/openshift_ca/tasks/main.yml index cd72a4e21..4d9768ce7 100644 --- a/roles/openshift_ca/tasks/main.yml +++ b/roles/openshift_ca/tasks/main.yml @@ -4,7 +4,7 @@ when: openshift_ca_host is not defined - name: Install the base package for admin tooling - action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_pkg_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" when: not openshift.common.is_containerized | bool register: install_result delegate_to: "{{ openshift_ca_host }}" diff --git a/roles/openshift_cli/tasks/main.yml b/roles/openshift_cli/tasks/main.yml index cdd0564c7..097c05483 100644 --- a/roles/openshift_cli/tasks/main.yml +++ b/roles/openshift_cli/tasks/main.yml @@ -6,10 +6,9 @@ action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-clients state=present" when: not openshift.common.is_containerized | bool -# TODO: handle no openshift_version set? - name: Pull CLI Image command: > - docker pull {{ openshift.common.cli_image }}{{ ':v' + openshift_version if openshift_version is defined and openshift_version != '' else '' }} + docker pull {{ openshift.common.cli_image }}:{{ openshift_image_tag }} when: openshift.common.is_containerized | bool - name: Create /usr/local/bin/openshift cli wrapper diff --git a/roles/openshift_common/tasks/main.yml b/roles/openshift_common/tasks/main.yml index 4ec255dbc..77f3811c1 100644 --- a/roles/openshift_common/tasks/main.yml +++ b/roles/openshift_common/tasks/main.yml @@ -29,12 +29,8 @@ data_dir: "{{ openshift_data_dir | default(None) }}" use_dnsmasq: "{{ openshift_use_dnsmasq | default(None) }}" -# Using oo_image_tag_to_rpm_version here is a workaround for how -# openshift_version is set. That value is computed based on either RPM -# versions or image tags. openshift_common's usage requires that it be a RPM -# version and openshift_cli expects it to be an image tag. - name: Install the base package for versioning - action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_pkg_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" when: not openshift.common.is_containerized | bool - name: Set version facts diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml index 6b3893570..7a80ed8e3 100644 --- a/roles/openshift_master/tasks/main.yml +++ b/roles/openshift_master/tasks/main.yml @@ -1,7 +1,6 @@ --- # TODO: add ability to configure certificates given either a local file to # point to or certificate contents, set in default cert locations. -- debug: var=openshift_version # Authentication Variable Validation # TODO: validate the different identity provider kinds as well @@ -25,12 +24,12 @@ when: openshift_master_ha | bool and openshift_master_cluster_method == "pacemaker" and openshift.common.is_containerized | bool - name: Install Master package - action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-master{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-master{{ openshift_pkg_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" when: not openshift.common.is_containerized | bool - name: Pull master image command: > - docker pull {{ openshift.master.master_image }}{{ ':v' + openshift_version if openshift_version is defined and openshift_version != '' else '' }} + docker pull {{ openshift.master.master_image }}:{{ openshift_image_tag }} when: openshift.common.is_containerized | bool - name: Create openshift.common.data_dir diff --git a/roles/openshift_master/templates/atomic-openshift-master.j2 b/roles/openshift_master/templates/atomic-openshift-master.j2 index ba2974476..fb9e7c13c 100644 --- a/roles/openshift_master/templates/atomic-openshift-master.j2 +++ b/roles/openshift_master/templates/atomic-openshift-master.j2 @@ -1,7 +1,7 @@ OPTIONS=--loglevel={{ openshift.master.debug_level }} CONFIG_FILE={{ openshift_master_config_file }} {% if openshift.common.is_containerized | bool %} -IMAGE_VERSION=v{{ openshift_version }} +IMAGE_VERSION={{ openshift_image_tag }} {% endif %} {% if 'cloudprovider' in openshift and 'aws' in openshift.cloudprovider and 'kind' in openshift.cloudprovider and openshift.cloudprovider.kind == 'aws' and 'access_key' in openshift.cloudprovider.aws and 'secret_key' in openshift.cloudprovider.aws %} diff --git a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 index 36e4446b9..fe439a7b8 100644 --- a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 +++ b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 @@ -1,7 +1,7 @@ OPTIONS=--loglevel={{ openshift.master.debug_level }} --listen={{ 'https' if openshift.master.api_use_ssl else 'http' }}://{{ openshift.master.bind_addr }}:{{ openshift.master.api_port }} --master={{ openshift.master.loopback_api_url }} CONFIG_FILE={{ openshift_master_config_file }} {% if openshift.common.is_containerized | bool %} -IMAGE_VERSION=v{{ openshift_version }} +IMAGE_VERSION={{ openshift_image_tag }} {% endif %} {% if 'cloudprovider' in openshift and 'aws' in openshift.cloudprovider and 'kind' in openshift.cloudprovider and openshift.cloudprovider.kind == 'aws' and 'access_key' in openshift.cloudprovider.aws and 'secret_key' in openshift.cloudprovider.aws %} diff --git a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 index ca3ae0ef8..44101ea42 100644 --- a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 +++ b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 @@ -1,7 +1,7 @@ OPTIONS=--loglevel={{ openshift.master.debug_level }} --listen={{ 'https' if openshift.master.api_use_ssl else 'http' }}://{{ openshift.master.bind_addr }}:{{ openshift.master.controllers_port }} CONFIG_FILE={{ openshift_master_config_file }} {% if openshift.common.is_containerized | bool %} -IMAGE_VERSION=v{{ openshift_version }} +IMAGE_VERSION={{ openshift_image_tag }} {% endif %} {% if 'cloudprovider' in openshift and 'aws' in openshift.cloudprovider and 'kind' in openshift.cloudprovider and openshift.cloudprovider.kind == 'aws' and 'access_key' in openshift.cloudprovider.aws and 'secret_key' in openshift.cloudprovider.aws %} diff --git a/roles/openshift_master_ca/tasks/main.yml b/roles/openshift_master_ca/tasks/main.yml index 613aecc38..ae99467f0 100644 --- a/roles/openshift_master_ca/tasks/main.yml +++ b/roles/openshift_master_ca/tasks/main.yml @@ -1,9 +1,7 @@ --- -- debug: msg="{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }}" - - name: Install the base package for admin tooling - action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_pkg_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" when: not openshift.common.is_containerized | bool register: install_result diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml index 36f69645f..60d5081d3 100644 --- a/roles/openshift_node/tasks/main.yml +++ b/roles/openshift_node/tasks/main.yml @@ -1,5 +1,4 @@ --- -- debug: var=openshift_version # TODO: allow for overriding default ports where possible - fail: msg: "SELinux is disabled, This deployment type requires that SELinux is enabled." @@ -31,21 +30,21 @@ # We have to add tuned-profiles in the same transaction otherwise we run into depsolving # problems because the rpms don't pin the version properly. This was fixed in 3.1 packaging. - name: Install Node package - action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-node{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }},tuned-profiles-{{ openshift.common.service_type }}-node{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-node{{ openshift_pkg_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }},tuned-profiles-{{ openshift.common.service_type }}-node{{ openshift_pkg_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" when: not openshift.common.is_containerized | bool - name: Install sdn-ovs package - action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-sdn-ovs{{ openshift_version | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-sdn-ovs{{ openshift_pkg_version | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" when: openshift.common.use_openshift_sdn and not openshift.common.is_containerized | bool - name: Pull node image command: > - docker pull {{ openshift.node.node_image }}{{ ':v' + openshift_version if openshift_version is defined and openshift_version != '' else '' }} + docker pull {{ openshift.node.node_image }}:{{ openshift_image_tag }} when: openshift.common.is_containerized | bool - name: Pull OpenVSwitch image command: > - docker pull {{ openshift.node.ovs_image }}{{ ':v' + openshift_version if openshift_version is defined and openshift_version != '' else '' }} + docker pull {{ openshift.node.ovs_image }}:{{ openshift_image_tag }} when: openshift.common.is_containerized | bool and openshift.common.use_openshift_sdn | bool - name: Install the systemd units diff --git a/roles/openshift_node/tasks/systemd_units.yml b/roles/openshift_node/tasks/systemd_units.yml index 0117a5a02..39e5386d4 100644 --- a/roles/openshift_node/tasks/systemd_units.yml +++ b/roles/openshift_node/tasks/systemd_units.yml @@ -44,6 +44,6 @@ - regex: '^CONFIG_FILE=' line: "CONFIG_FILE={{ openshift_node_config_file }}" - regex: '^IMAGE_VERSION=' - line: "IMAGE_VERSION=v{{ openshift_version }}" + line: "IMAGE_VERSION={{ openshift_image_tag }}" notify: - restart node diff --git a/roles/openshift_node/templates/openvswitch.sysconfig.j2 b/roles/openshift_node/templates/openvswitch.sysconfig.j2 index 53163b359..da7c3742a 100644 --- a/roles/openshift_node/templates/openvswitch.sysconfig.j2 +++ b/roles/openshift_node/templates/openvswitch.sysconfig.j2 @@ -1 +1 @@ -IMAGE_VERSION=v{{ openshift_version }} +IMAGE_VERSION={{ openshift_image_tag }} diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index e27add09e..d896eb151 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -31,10 +31,30 @@ include: set_version_containerized.yml when: is_containerized | bool -- debug: var=openshift_version - # At this point we know openshift_version is set appropriately. Now we set # openshift_image_tag and openshift_pkg_version, so all roles can always assume # each of this variables *will* be set correctly and can use them per their # intended purpose. +- set_fact: + openshift_image_tag: v{{ openshift_version }} + when: openshift_image_tag is not defined + +- set_fact: + openshift_pkg_version: -{{ openshift_version }} + when: openshift_pkg_version is not defined + +# TODO: fail if any of these is unset or looks wrong: +- debug: var=openshift_version +- debug: var=openshift_pkg_version +- debug: var=openshift_image_tag + +- fail: openshift_version role was unable to set openshift_version + when: openshift_version is not defined + +- fail: openshift_version role was unable to set openshift_image_tag + when: openshift_image_tag is not defined + +- fail: openshift_version role was unable to set openshift_pkg_version + when: openshift_pkg_version is not defined + diff --git a/roles/openshift_version/tasks/set_version_containerized.yml b/roles/openshift_version/tasks/set_version_containerized.yml index fc15b2d35..6d31d0ddc 100644 --- a/roles/openshift_version/tasks/set_version_containerized.yml +++ b/roles/openshift_version/tasks/set_version_containerized.yml @@ -1,7 +1,9 @@ --- - name: Set containerized version to configure if openshift_image_tag specified set_fact: - openshift_version: "{{ openshift_image_tag.split('v',1)[1] }}" + # Expects a leading "v" in inventory, strip it off here: + # openshift_version should always just be "3.2" or "3.2.0.44" + openshift_version: "{{ openshift_image_tag[1:].split('-')[0] }}" when: openshift_image_tag is defined and openshift_version is not defined - name: Set containerized version to configure if openshift_release specified diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml index b15f0e993..90229b0e9 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -2,7 +2,7 @@ # TODO: support openshift_release here? - name: Set rpm version to configure if openshift_pkg_version specified set_fact: - # Expects a leading "-" in inventory, strip it off here, and ignore a trailing release, + # Expects a leading "-" in inventory, strip it off here, and remove trailing release, # openshift_version should always just be "3.2" or "3.2.0.44" openshift_version: "{{ openshift_pkg_version[1:].split('-')[0] }}" when: openshift_pkg_version is defined and openshift_version is not defined -- cgit v1.2.3 From b26b6f8c5bd0767495ee3d256f0772e769029923 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 15 Jun 2016 10:24:00 -0300 Subject: Fix performance hit in openshift_facts. --- roles/openshift_facts/library/openshift_facts.py | 5 ----- 1 file changed, 5 deletions(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 9d7705af7..97cca2e5c 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1133,11 +1133,6 @@ def get_openshift_version(facts): if os.path.isfile('/usr/bin/openshift'): _, output, _ = module.run_command(['/usr/bin/openshift', 'version']) version = parse_openshift_version(output) - elif os.path.isfile('/usr/local/bin/openshift'): - # TODO: this should probably make sure the actual image is already present, this can take awhile if it has to pull - # and is falsely acting like openshift is already installed - _, output, _ = module.run_command(['/usr/local/bin/openshift', 'version']) - version = parse_openshift_version(output) elif 'node' in facts and 'common' in facts and 'is_containerized' in facts['common']: version = get_containerized_node_openshift_version(facts) -- cgit v1.2.3 From 5346266575045e1a42914e10249dc6e9874da7ec Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 15 Jun 2016 12:07:05 -0300 Subject: More stable containerized version lookup. --- roles/openshift_facts/library/openshift_facts.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 97cca2e5c..eb6369f50 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1133,7 +1133,10 @@ def get_openshift_version(facts): if os.path.isfile('/usr/bin/openshift'): _, output, _ = module.run_command(['/usr/bin/openshift', 'version']) version = parse_openshift_version(output) - elif 'node' in facts and 'common' in facts and 'is_containerized' in facts['common']: + # TODO: it probably makes more sense to read this from sysconfig service env files, + # these control the running versions when containerized, and would work even if the service + # is dead for some reason. + elif 'common' in facts and 'is_containerized' in facts['common']: version = get_containerized_node_openshift_version(facts) return version @@ -1148,6 +1151,23 @@ def get_containerized_node_openshift_version(facts): _, output, _ = module.run_command(['docker', 'exec', '-ti', node_svc, 'openshift', 'version']) return parse_openshift_version(output) + # If containerized, see if we can determine the installed version via the systemd environment files: + node_env = '/etc/sysconfig/%s-node' % facts['common']['service_type'] + if not os.path.exists(node_env): + return None + + with open(node_env) as f: + for line in f: + if line.startwith("IMAGE_VERSION="): + tag = line[len("IMAGE_VERSION="):] + # Remove leading "v" and any trailing release info, we just want + # a version number here: + version = tag[1:].split("-")[0] + return version + return None + + + def parse_openshift_version(output): """ Apply provider facts to supplied facts dict -- cgit v1.2.3 From 955d295652c59f0e8ed4ddd77f50d4c6e09293a5 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 15 Jun 2016 15:04:13 -0300 Subject: Support origin alpha tags. --- roles/openshift_version/tasks/main.yml | 1 + .../tasks/set_version_containerized.yml | 19 ++++++++++++++++--- roles/openshift_version/tasks/set_version_rpm.yml | 1 - 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'roles') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index d896eb151..ee277d1ca 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -22,6 +22,7 @@ - debug: var=openshift_release - debug: var=openshift_pkg_version - debug: var=openshift_image_tag +- debug: var=openshift.common.version - name: Set openshift_version for rpm installation include: set_version_rpm.yml diff --git a/roles/openshift_version/tasks/set_version_containerized.yml b/roles/openshift_version/tasks/set_version_containerized.yml index 6d31d0ddc..7a09c0310 100644 --- a/roles/openshift_version/tasks/set_version_containerized.yml +++ b/roles/openshift_version/tasks/set_version_containerized.yml @@ -2,7 +2,6 @@ - name: Set containerized version to configure if openshift_image_tag specified set_fact: # Expects a leading "v" in inventory, strip it off here: - # openshift_version should always just be "3.2" or "3.2.0.44" openshift_version: "{{ openshift_image_tag[1:].split('-')[0] }}" when: openshift_image_tag is defined and openshift_version is not defined @@ -19,12 +18,26 @@ - debug: var=cli_image_version +# Origin latest = released version (i.e. 1.2.0) - set_fact: - openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2][1:] | join('-') if openshift.common.deployment_type == 'origin' else cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" - when: openshift_version is not defined + openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" + when: openshift_version is not defined and openshift.common.deployment_type == 'origin' and cli_image_version.stdout_lines[0].split('-') | length == 0 + + +# Origin latest = pre-release version (i.e. v1.3.0-alpha.1-321-gb095e3a) +- set_fact: + openshift_version: "{{ (cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2] | join('-'))[1:] }}" + when: openshift_version is not defined and openshift.common.deployment_type == 'origin' and cli_image_version.stdout_lines[0].split('-') | length > 1 + +# OSE +- set_fact: + openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" + when: openshift_version is not defined and openshift.common.deployment_type != 'origin' - debug: msg="{{ openshift_version }}" + + # If we got an openshift_version like "3.2", lookup the latest 3.2 container version # and use that value instead. - name: Set precise containerized version to configure if openshift_release specified diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml index 90229b0e9..889ecc56c 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -3,7 +3,6 @@ - name: Set rpm version to configure if openshift_pkg_version specified set_fact: # Expects a leading "-" in inventory, strip it off here, and remove trailing release, - # openshift_version should always just be "3.2" or "3.2.0.44" openshift_version: "{{ openshift_pkg_version[1:].split('-')[0] }}" when: openshift_pkg_version is defined and openshift_version is not defined -- cgit v1.2.3 From 42dec74c57fa76e31a588b2a58f913c68825360d Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 16 Jun 2016 12:17:14 -0300 Subject: More version fixes. --- roles/openshift_cli/templates/openshift.j2 | 2 +- roles/openshift_version/tasks/main.yml | 1 - roles/openshift_version/tasks/set_version_containerized.yml | 9 +-------- 3 files changed, 2 insertions(+), 10 deletions(-) (limited to 'roles') diff --git a/roles/openshift_cli/templates/openshift.j2 b/roles/openshift_cli/templates/openshift.j2 index 1c82e02a2..7786acead 100644 --- a/roles/openshift_cli/templates/openshift.j2 +++ b/roles/openshift_cli/templates/openshift.j2 @@ -5,7 +5,7 @@ fi cmd=`basename $0` user=`id -u` group=`id -g` -image_tag="v{{ openshift_version }}" +image_tag="{{ openshift_image_tag }}" >&2 echo """ ================================================================================ diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index ee277d1ca..e3bdad691 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -45,7 +45,6 @@ openshift_pkg_version: -{{ openshift_version }} when: openshift_pkg_version is not defined -# TODO: fail if any of these is unset or looks wrong: - debug: var=openshift_version - debug: var=openshift_pkg_version - debug: var=openshift_image_tag diff --git a/roles/openshift_version/tasks/set_version_containerized.yml b/roles/openshift_version/tasks/set_version_containerized.yml index 7a09c0310..d822ee164 100644 --- a/roles/openshift_version/tasks/set_version_containerized.yml +++ b/roles/openshift_version/tasks/set_version_containerized.yml @@ -18,21 +18,14 @@ - debug: var=cli_image_version -# Origin latest = released version (i.e. 1.2.0) -- set_fact: - openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" - when: openshift_version is not defined and openshift.common.deployment_type == 'origin' and cli_image_version.stdout_lines[0].split('-') | length == 0 - - # Origin latest = pre-release version (i.e. v1.3.0-alpha.1-321-gb095e3a) - set_fact: openshift_version: "{{ (cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2] | join('-'))[1:] }}" when: openshift_version is not defined and openshift.common.deployment_type == 'origin' and cli_image_version.stdout_lines[0].split('-') | length > 1 -# OSE - set_fact: openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" - when: openshift_version is not defined and openshift.common.deployment_type != 'origin' + when: openshift_version is not defined - debug: msg="{{ openshift_version }}" -- cgit v1.2.3 From 78dd487871796a71c450a1a1daf78b079a3a1090 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 16 Jun 2016 14:27:20 -0300 Subject: Cleanup, fix 3.1 version bug in facts. --- roles/openshift_facts/library/openshift_facts.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index eb6369f50..a979639f8 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1113,7 +1113,9 @@ def get_docker_version_info(): return result def get_openshift_version(facts): - """ Get current version of openshift on the host + """ Get current version of openshift on the host. + + Checks a variety of ways ranging from fastest to slowest. Args: facts (dict): existing facts @@ -1139,18 +1141,17 @@ def get_openshift_version(facts): elif 'common' in facts and 'is_containerized' in facts['common']: version = get_containerized_node_openshift_version(facts) + # Handle containerized masters that have not yet been configured as a node. + # This can be very slow and may get re-run multiple times, so we only use this + # if other methods failed to find a version. + if not version and os.path.isfile('/usr/local/bin/openshift'): + _, output, _ = module.run_command(['/usr/local/bin/openshift', 'version']) + version = parse_openshift_version(output) + return version -def get_containerized_node_openshift_version(facts): - node_svc = "%s-node" % facts['common']['service_type'] - rc, _, _ = module.run_command(['systemctl', 'is-active', node_svc]) - if rc > 0: - # Node service not running or doesn't exist: - return None - # Node service running, exec in and get the version: - _, output, _ = module.run_command(['docker', 'exec', '-ti', node_svc, 'openshift', 'version']) - return parse_openshift_version(output) +def get_containerized_node_openshift_version(facts): # If containerized, see if we can determine the installed version via the systemd environment files: node_env = '/etc/sysconfig/%s-node' % facts['common']['service_type'] if not os.path.exists(node_env): @@ -1167,8 +1168,6 @@ def get_containerized_node_openshift_version(facts): return None - - def parse_openshift_version(output): """ Apply provider facts to supplied facts dict -- cgit v1.2.3 From f0f69623f6852badb7b912064de539371da6e2f1 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 16 Jun 2016 14:58:15 -0300 Subject: Fix typo in facts. --- roles/openshift_facts/library/openshift_facts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index a979639f8..6c31f0fa8 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1159,7 +1159,7 @@ def get_containerized_node_openshift_version(facts): with open(node_env) as f: for line in f: - if line.startwith("IMAGE_VERSION="): + if line.startswith("IMAGE_VERSION="): tag = line[len("IMAGE_VERSION="):] # Remove leading "v" and any trailing release info, we just want # a version number here: -- cgit v1.2.3 From 63ea5cce369710363dd09b2b64c40871c6ce55f9 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 17 Jun 2016 09:10:20 -0300 Subject: More stable lookup of running openshift version. --- roles/openshift_facts/library/openshift_facts.py | 29 ++++++++++++------------ 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 6c31f0fa8..62d478bfc 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1139,7 +1139,7 @@ def get_openshift_version(facts): # these control the running versions when containerized, and would work even if the service # is dead for some reason. elif 'common' in facts and 'is_containerized' in facts['common']: - version = get_containerized_node_openshift_version(facts) + version = get_containerized_openshift_version(facts) # Handle containerized masters that have not yet been configured as a node. # This can be very slow and may get re-run multiple times, so we only use this @@ -1151,20 +1151,21 @@ def get_openshift_version(facts): return version -def get_containerized_node_openshift_version(facts): +def get_containerized_openshift_version(facts): # If containerized, see if we can determine the installed version via the systemd environment files: - node_env = '/etc/sysconfig/%s-node' % facts['common']['service_type'] - if not os.path.exists(node_env): - return None - - with open(node_env) as f: - for line in f: - if line.startswith("IMAGE_VERSION="): - tag = line[len("IMAGE_VERSION="):] - # Remove leading "v" and any trailing release info, we just want - # a version number here: - version = tag[1:].split("-")[0] - return version + for filename in ['/etc/sysconfig/%s-master', '/etc/sysconfig/%s-node']: + env_file = filename % facts['common']['service_type'] + if not os.path.exists(env_file): + continue + + with open(env_file) as f: + for line in f: + if line.startswith("IMAGE_VERSION="): + tag = line[len("IMAGE_VERSION="):] + # Remove leading "v" and any trailing release info, we just want + # a version number here: + version = tag[1:].split("-")[0] + return version return None -- cgit v1.2.3 From e60b8976ef638c3368dd229906078f1077f00a99 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 17 Jun 2016 09:10:39 -0300 Subject: Block attempts to install origin without specifying any release info. --- roles/openshift_version/tasks/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'roles') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index e3bdad691..9ff13d35c 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -1,6 +1,13 @@ --- # Determine the openshift_version to configure if none has been specified or set previously. +# Block attempts to install origin without specifying some kind of version information. +# This is because the latest tags for origin are usually alpha builds, which should not +# be used by default. Users must indicate what they want. +- fail: + msg: "Must specify openshift_release, openshift_image_tag, or openshift_pkg_version in inventory to install origin. (suggestion: add openshift_release=\"1.2\" to inventory)" + when: openshift.common.deployment_type == 'origin' and openshift_release is not defined and openshift_pkg_version is not defined and openshift_image_tag is not defined + - set_fact: is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}" -- cgit v1.2.3 From dc75bf3a6c7913c519706e69a3ea82efd191b378 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 17 Jun 2016 10:48:38 -0300 Subject: Check that detected version matches openshift_release in rpm installations. --- roles/openshift_version/tasks/main.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'roles') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index 9ff13d35c..b11bf62fe 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -1,15 +1,15 @@ --- # Determine the openshift_version to configure if none has been specified or set previously. +- set_fact: + is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}" + # Block attempts to install origin without specifying some kind of version information. # This is because the latest tags for origin are usually alpha builds, which should not # be used by default. Users must indicate what they want. - fail: - msg: "Must specify openshift_release, openshift_image_tag, or openshift_pkg_version in inventory to install origin. (suggestion: add openshift_release=\"1.2\" to inventory)" - when: openshift.common.deployment_type == 'origin' and openshift_release is not defined and openshift_pkg_version is not defined and openshift_image_tag is not defined - -- set_fact: - is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}" + msg: "Must specify openshift_release or openshift_image_tag in inventory to install origin. (suggestion: add openshift_release=\"1.2\" to inventory)" + when: is_containerized | bool and openshift.common.deployment_type == 'origin' and openshift_release is not defined and openshift_image_tag is not defined # Make sure we copy this to a fact if given a var: - set_fact: @@ -65,3 +65,8 @@ - fail: openshift_version role was unable to set openshift_pkg_version when: openshift_pkg_version is not defined +# We can't map an openshift_release to full rpm version like we can with containers, make sure +# the rpm version we looked up matches the release requested and error out if not. +- fail: + msg: "Detected openshift version {{ openshift_version }} does not match requested openshift_release {{ openshift_release }}. You may need to adjust your yum repositories or specify an exact openshift_pkg_version." + when: not is_containerized | bool and openshift_release is defined and not openshift_version | oo_startswith(openshift_release) | bool -- cgit v1.2.3 From 2cab796e15d834dfb9f3743941dd5311731fc70f Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 17 Jun 2016 10:54:14 -0300 Subject: Normalize some of the version inventory vars which users might mistakenly enter wrong. --- roles/openshift_version/tasks/main.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'roles') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index b11bf62fe..ac3efe7e9 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -11,6 +11,19 @@ msg: "Must specify openshift_release or openshift_image_tag in inventory to install origin. (suggestion: add openshift_release=\"1.2\" to inventory)" when: is_containerized | bool and openshift.common.deployment_type == 'origin' and openshift_release is not defined and openshift_image_tag is not defined +# Normalize some values that we need in a certain format that might be confusing: +- set_fact: + openshift_release: "{{ openshift_release[1:] }}" + when: openshift_release is defined and openshift_release[0] == 'v' + +- set_fact: + openshift_image_tag: "{{ 'v' + openshift_image_tag }}" + when: openshift_image_tag is defined and openshift_image_tag[0] != 'v' + +- set_fact: + openshift_pkg_version: "{{ '-' + openshift_pkg_version }}" + when: openshift_pkg_version is defined and openshift_pkg_version[0] != '-' + # Make sure we copy this to a fact if given a var: - set_fact: openshift_version: "{{ openshift_version }}" -- cgit v1.2.3 From 9ce7443cefb53a400f5b38ac004c41e1b443635c Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 17 Jun 2016 15:40:31 -0300 Subject: Fix version facts with trailing newline. --- roles/openshift_facts/library/openshift_facts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 62d478bfc..43cca90d6 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1161,7 +1161,7 @@ def get_containerized_openshift_version(facts): with open(env_file) as f: for line in f: if line.startswith("IMAGE_VERSION="): - tag = line[len("IMAGE_VERSION="):] + tag = line[len("IMAGE_VERSION="):].strip() # Remove leading "v" and any trailing release info, we just want # a version number here: version = tag[1:].split("-")[0] -- cgit v1.2.3 From 4966c635ed19154cace877fcd2b613c798faa7f8 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 20 Jun 2016 11:19:03 -0300 Subject: Support setting a docker version in inventory. --- roles/docker/tasks/main.yml | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 1f5f891c7..34be0a666 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -2,10 +2,42 @@ - stat: path=/etc/sysconfig/docker-storage register: docker_storage_check +- debug: var=docker_version + +- name: Get current installed Docker version + command: "{{ repoquery_cmd }} --installed --qf '%{version}' docker" + when: docker_version is defined and not openshift.common.is_atomic | bool + register: curr_docker_version + changed_when: false + +- name: Get latest available version of Docker + command: > + {{ repoquery_cmd }} --qf '%{version}' "docker" + register: avail_docker_version + failed_when: false + changed_when: false + when: docker_version is defined and not openshift.common.is_atomic | bool + +# TODO: Should we use docker_version defaulted to 1.10 here? + +# If a docker_version was requested, sanity check that we can install or upgrade to it, and +# no downgrade is required. +- name: Fail if Docker version requested but downgrade is required + fail: + msg: "Docker {{ curr_docker_version.stdout }} is installed, but version {{ docker_version }} was requested." + when: not curr_docker_version | skipped and curr_docker_version.stdout | default('0.0', True) | version_compare(docker_version, '>') + +# This involves an extremely slow migration process, users should instead run the +# Docker 1.10 upgrade playbook to accomplish this. +- name: Error out if attempting to upgrade Docker across the 1.10 boundary + fail: + msg: "Cannot upgrade Docker to >= 1.10, please use the Docker upgrade playbook for this." + when: not curr_docker_version | skipped and curr_docker_version.stdout | default('0.0', True) | version_compare('1.10', '<') and docker_version | version_compare('1.10', '>=') + # Make sure Docker is installed, but does not update a running version. # Docker upgrades are handled by a separate playbook. - name: Install Docker - action: "{{ ansible_pkg_mgr }} name=docker state=present" + action: "{{ ansible_pkg_mgr }} name=docker{{ '-' + docker_version if docker_version is defined else '' }} state=present" when: not openshift.common.is_atomic | bool - name: Start the Docker service @@ -60,6 +92,9 @@ - restart docker when: "{{ 'http_proxy' in openshift.common or 'https_proxy' in openshift.common and docker_check.stat.isreg }}" +- debug: var=openshift.docker.options +- debug: var=docker_options + - name: Set various Docker options lineinfile: dest: /etc/sysconfig/docker -- cgit v1.2.3 From 8c9ed6719bdbc0ce7574fa9261c60e4978c203e6 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 20 Jun 2016 14:45:42 -0300 Subject: Fix docker restarts during openshift_version role. The variable here must be explicitly passed to the docker role, if it's passed sometimes and not others, the docker config changes triggers a docker restart effectively killing everything on the node in an unsafe manner. Instead lets make sure the value is set. --- roles/docker/defaults/main.yml | 1 - roles/openshift_docker_facts/tasks/main.yml | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'roles') diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 1b26af0dd..ed97d539c 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -1,2 +1 @@ --- -docker_version: '' \ No newline at end of file diff --git a/roles/openshift_docker_facts/tasks/main.yml b/roles/openshift_docker_facts/tasks/main.yml index 2e68809ca..eb8b5e99b 100644 --- a/roles/openshift_docker_facts/tasks/main.yml +++ b/roles/openshift_docker_facts/tasks/main.yml @@ -34,7 +34,8 @@ - set_fact: docker_options: "--insecure-registry={{ openshift.docker.hosted_registry_network }} {{ openshift.docker.options | default ('') }}" when: openshift.docker.hosted_registry_insecure | default(False) | bool and openshift.docker.hosted_registry_network is defined + register: hosted_registry_options - set_fact: docker_options: "{{ openshift.docker.options | default(omit) }}" - when: not openshift.docker.hosted_registry_insecure | default(False) | bool + when: hosted_registry_options | skipped -- cgit v1.2.3 From ea99abc4461f3e2edb7993b9c7961a13c727ab7c Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 22 Jun 2016 16:20:06 -0300 Subject: Add missing defaults file. --- roles/openshift_version/defaults/main.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 roles/openshift_version/defaults/main.yml (limited to 'roles') diff --git a/roles/openshift_version/defaults/main.yml b/roles/openshift_version/defaults/main.yml new file mode 100644 index 000000000..01a1a7472 --- /dev/null +++ b/roles/openshift_version/defaults/main.yml @@ -0,0 +1,2 @@ +--- +openshift_protect_installed_version: True -- cgit v1.2.3 From 08f1caed84d46d0263f0c1aaaf2da891946b1a96 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 27 Jun 2016 11:15:40 -0300 Subject: Only nuke images when crossing the Docker 1.10 boundary in upgrade. --- roles/docker/defaults/main.yml | 1 + roles/docker/tasks/main.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index ed97d539c..da11ed0af 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -1 +1,2 @@ --- +docker_protect_installed_version: False diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 34be0a666..a52a28375 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -37,7 +37,7 @@ # Make sure Docker is installed, but does not update a running version. # Docker upgrades are handled by a separate playbook. - name: Install Docker - action: "{{ ansible_pkg_mgr }} name=docker{{ '-' + docker_version if docker_version is defined else '' }} state=present" + action: "{{ ansible_pkg_mgr }} name=docker{{ '-' + docker_version if docker_version is defined and not docker_protect_installed_version | bool else '' }} state=present" when: not openshift.common.is_atomic | bool - name: Start the Docker service -- cgit v1.2.3 From 0071ab46bf9ae73bbb09c9fa0c9eb8a342a81ba1 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 4 Jul 2016 10:08:36 -0300 Subject: Fix unsafe bool usage. --- roles/openshift_version/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index ac3efe7e9..8cd66cbe9 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -34,7 +34,7 @@ - name: Use openshift.common.version fact as version to configure if already installed set_fact: openshift_version: "{{ openshift.common.version }}" - when: openshift.common.version is defined and openshift_version is not defined and openshift_protect_installed_version + when: openshift.common.version is defined and openshift_version is not defined and openshift_protect_installed_version | bool - debug: var=is_containerized - debug: var=openshift_version -- cgit v1.2.3 From cf737735ffdbc2a83d03361e57538a5bff903f6f Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 4 Jul 2016 12:52:06 -0300 Subject: Fixes for Ansible 2.1. --- roles/openshift_version/tasks/main.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'roles') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index 8cd66cbe9..a27ddeaee 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -69,13 +69,16 @@ - debug: var=openshift_pkg_version - debug: var=openshift_image_tag -- fail: openshift_version role was unable to set openshift_version +- fail: + msg: openshift_version role was unable to set openshift_version when: openshift_version is not defined -- fail: openshift_version role was unable to set openshift_image_tag +- fail: + msg: openshift_version role was unable to set openshift_image_tag when: openshift_image_tag is not defined -- fail: openshift_version role was unable to set openshift_pkg_version +- fail: + msg: openshift_version role was unable to set openshift_pkg_version when: openshift_pkg_version is not defined # We can't map an openshift_release to full rpm version like we can with containers, make sure -- cgit v1.2.3 From c1728c8847177988e4532b9c9c777e1a23223410 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 7 Jul 2016 12:28:28 -0300 Subject: Move repoquery fact definition to openshift_common. --- roles/openshift_common/tasks/main.yml | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'roles') diff --git a/roles/openshift_common/tasks/main.yml b/roles/openshift_common/tasks/main.yml index 77f3811c1..afddef125 100644 --- a/roles/openshift_common/tasks/main.yml +++ b/roles/openshift_common/tasks/main.yml @@ -45,3 +45,8 @@ command: > hostnamectl set-hostname {{ openshift.common.hostname }} when: openshift_set_hostname | default(set_hostname_default) | bool + +- name: Set repoquery command + set_fact: + repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery --plugins' }}" + -- cgit v1.2.3 From 5628e0ce7c86efd47f11310dee204f4a4a8dfc04 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 8 Jul 2016 11:43:25 -0300 Subject: Remove all debug used during devel of openshift_version. --- roles/docker/tasks/main.yml | 5 ----- roles/openshift_cli/tasks/main.yml | 3 --- roles/openshift_version/tasks/main.yml | 12 ------------ roles/openshift_version/tasks/set_version_containerized.yml | 6 ------ roles/openshift_version/tasks/set_version_rpm.yml | 4 ---- 5 files changed, 30 deletions(-) (limited to 'roles') diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index a52a28375..aba852e63 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -2,8 +2,6 @@ - stat: path=/etc/sysconfig/docker-storage register: docker_storage_check -- debug: var=docker_version - - name: Get current installed Docker version command: "{{ repoquery_cmd }} --installed --qf '%{version}' docker" when: docker_version is defined and not openshift.common.is_atomic | bool @@ -92,9 +90,6 @@ - restart docker when: "{{ 'http_proxy' in openshift.common or 'https_proxy' in openshift.common and docker_check.stat.isreg }}" -- debug: var=openshift.docker.options -- debug: var=docker_options - - name: Set various Docker options lineinfile: dest: /etc/sysconfig/docker diff --git a/roles/openshift_cli/tasks/main.yml b/roles/openshift_cli/tasks/main.yml index 097c05483..6b4f16c78 100644 --- a/roles/openshift_cli/tasks/main.yml +++ b/roles/openshift_cli/tasks/main.yml @@ -1,7 +1,4 @@ --- -- debug: var=openshift_version -- debug: var=openshift.common - - name: Install clients action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-clients state=present" when: not openshift.common.is_containerized | bool diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index a27ddeaee..b4f3fb36d 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -36,14 +36,6 @@ openshift_version: "{{ openshift.common.version }}" when: openshift.common.version is defined and openshift_version is not defined and openshift_protect_installed_version | bool -- debug: var=is_containerized -- debug: var=openshift_version -- debug: msg="{{ openshift_version is defined }}" -- debug: var=openshift_release -- debug: var=openshift_pkg_version -- debug: var=openshift_image_tag -- debug: var=openshift.common.version - - name: Set openshift_version for rpm installation include: set_version_rpm.yml when: not is_containerized | bool @@ -65,10 +57,6 @@ openshift_pkg_version: -{{ openshift_version }} when: openshift_pkg_version is not defined -- debug: var=openshift_version -- debug: var=openshift_pkg_version -- debug: var=openshift_image_tag - - fail: msg: openshift_version role was unable to set openshift_version when: openshift_version is not defined diff --git a/roles/openshift_version/tasks/set_version_containerized.yml b/roles/openshift_version/tasks/set_version_containerized.yml index d822ee164..8e2702391 100644 --- a/roles/openshift_version/tasks/set_version_containerized.yml +++ b/roles/openshift_version/tasks/set_version_containerized.yml @@ -16,8 +16,6 @@ register: cli_image_version when: openshift_version is not defined -- debug: var=cli_image_version - # Origin latest = pre-release version (i.e. v1.3.0-alpha.1-321-gb095e3a) - set_fact: openshift_version: "{{ (cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2] | join('-'))[1:] }}" @@ -27,10 +25,6 @@ openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" when: openshift_version is not defined -- debug: msg="{{ openshift_version }}" - - - # If we got an openshift_version like "3.2", lookup the latest 3.2 container version # and use that value instead. - name: Set precise containerized version to configure if openshift_release specified diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml index 889ecc56c..cf0a3b51f 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -6,8 +6,6 @@ openshift_version: "{{ openshift_pkg_version[1:].split('-')[0] }}" when: openshift_pkg_version is defined and openshift_version is not defined -- debug: var=openshift_version - - name: Gather common package version command: > {{ repoquery_cmd }} --qf '%{version}' "{{ openshift.common.service_type}}" @@ -16,8 +14,6 @@ changed_when: false when: openshift_version is not defined -- debug: var=common_version - - set_fact: openshift_version: "{{ common_version.stdout | default('0.0', True) }}" when: openshift_version is not defined -- cgit v1.2.3 From 2a8b144073f474bf966c6ab92329442a1a526bde Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 8 Jul 2016 11:48:12 -0300 Subject: Remove/update TODOs. --- roles/docker/tasks/main.yml | 2 -- roles/openshift_facts/library/openshift_facts.py | 3 --- roles/openshift_version/tasks/set_version_rpm.yml | 1 - 3 files changed, 6 deletions(-) (limited to 'roles') diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index aba852e63..ac065ea51 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -16,8 +16,6 @@ changed_when: false when: docker_version is defined and not openshift.common.is_atomic | bool -# TODO: Should we use docker_version defaulted to 1.10 here? - # If a docker_version was requested, sanity check that we can install or upgrade to it, and # no downgrade is required. - name: Fail if Docker version requested but downgrade is required diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 135224c16..fdd3e8708 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1142,9 +1142,6 @@ def get_openshift_version(facts): if os.path.isfile('/usr/bin/openshift'): _, output, _ = module.run_command(['/usr/bin/openshift', 'version']) version = parse_openshift_version(output) - # TODO: it probably makes more sense to read this from sysconfig service env files, - # these control the running versions when containerized, and would work even if the service - # is dead for some reason. elif 'common' in facts and 'is_containerized' in facts['common']: version = get_containerized_openshift_version(facts) diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml index cf0a3b51f..7fa74e24f 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -1,5 +1,4 @@ --- -# TODO: support openshift_release here? - name: Set rpm version to configure if openshift_pkg_version specified set_fact: # Expects a leading "-" in inventory, strip it off here, and remove trailing release, -- cgit v1.2.3 From 02d4470e1ff26350a2e02567246627aaf09455eb Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 11 Jul 2016 10:08:14 -0300 Subject: Use proper startswith. --- roles/openshift_version/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index b4f3fb36d..2d96d2765 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -73,4 +73,4 @@ # the rpm version we looked up matches the release requested and error out if not. - fail: msg: "Detected openshift version {{ openshift_version }} does not match requested openshift_release {{ openshift_release }}. You may need to adjust your yum repositories or specify an exact openshift_pkg_version." - when: not is_containerized | bool and openshift_release is defined and not openshift_version | oo_startswith(openshift_release) | bool + when: not is_containerized | bool and openshift_release is defined and not openshift_version.startswith(openshift_release) | bool -- cgit v1.2.3 From 02fde33acd3022b1a684c3aaa42b4d2052d1c830 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 11 Jul 2016 16:06:27 -0300 Subject: Add dependency on docker to openshift_docker role. I think this is intended anytime a role uses openshift_docker. Fixes issue where docker_version is ignored for rpm based installs. We made the dependency in openshift_version conditional to allow use of openshift_version without significantly impacting the system, however nothing ever actually ran the docker role after that, resulting in docker simply being installed via the rpm dependency on atomic-openshift. --- roles/openshift_docker/meta/main.yml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'roles') diff --git a/roles/openshift_docker/meta/main.yml b/roles/openshift_docker/meta/main.yml index c1a6611d1..10131f717 100644 --- a/roles/openshift_docker/meta/main.yml +++ b/roles/openshift_docker/meta/main.yml @@ -13,3 +13,5 @@ galaxy_info: - cloud dependencies: - role: openshift_version +- role: openshift_docker_facts +- role: docker -- cgit v1.2.3 From b9d00cb5bf5d81b6c94e08a67021c32f3239103c Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 11 Jul 2016 16:27:59 -0300 Subject: Move repoquery_cmd fact setting into a more logical place. --- roles/openshift_common/tasks/main.yml | 4 ---- roles/openshift_facts/tasks/main.yml | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'roles') diff --git a/roles/openshift_common/tasks/main.yml b/roles/openshift_common/tasks/main.yml index afddef125..ece335fbf 100644 --- a/roles/openshift_common/tasks/main.yml +++ b/roles/openshift_common/tasks/main.yml @@ -46,7 +46,3 @@ hostnamectl set-hostname {{ openshift.common.hostname }} when: openshift_set_hostname | default(set_hostname_default) | bool -- name: Set repoquery command - set_fact: - repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery --plugins' }}" - diff --git a/roles/openshift_facts/tasks/main.yml b/roles/openshift_facts/tasks/main.yml index ca1a9b1e4..c3723672d 100644 --- a/roles/openshift_facts/tasks/main.yml +++ b/roles/openshift_facts/tasks/main.yml @@ -41,3 +41,8 @@ no_proxy: "{{ openshift_no_proxy | default(None) }}" generate_no_proxy_hosts: "{{ openshift_generate_no_proxy_hosts | default(True) }}" no_proxy_internal_hostnames: "{{ openshift_no_proxy_internal_hostnames | default(None) }}" + +- name: Set repoquery command + set_fact: + repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery --plugins' }}" + -- cgit v1.2.3 From af2c6f8fee050173b846221371c34538f4dc8f79 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 13 Jul 2016 11:56:17 -0300 Subject: Add checks to docker role for 1.9.1+. If Docker 1.8.2 is pre-installed, and no docker_version was requested, role will now error out because 1.9.1 is required. If docker_version is set to <= 1.9.1, we also error out as this is not supported. --- roles/docker/tasks/main.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'roles') diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index ac065ea51..8b6ce7eae 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -4,10 +4,20 @@ - name: Get current installed Docker version command: "{{ repoquery_cmd }} --installed --qf '%{version}' docker" - when: docker_version is defined and not openshift.common.is_atomic | bool + when: not openshift.common.is_atomic | bool register: curr_docker_version changed_when: false +- name: Error out if Docker pre-installed but too old + fail: + msg: "Docker {{ curr_docker_version.stdout }} is installed, but >= 1.9.1 is required." + when: not curr_docker_version | skipped and curr_docker_version.stdout != '' and curr_docker_version.stdout | version_compare('1.9.1', '<') and not docker_version is defined + +- name: Error out if requested Docker is too old + fail: + msg: "Docker {{ docker_version }} requested, but >= 1.9.1 is required." + when: docker_version is defined and docker_version | version_compare('1.9.1', '<') + - name: Get latest available version of Docker command: > {{ repoquery_cmd }} --qf '%{version}' "docker" @@ -21,14 +31,14 @@ - name: Fail if Docker version requested but downgrade is required fail: msg: "Docker {{ curr_docker_version.stdout }} is installed, but version {{ docker_version }} was requested." - when: not curr_docker_version | skipped and curr_docker_version.stdout | default('0.0', True) | version_compare(docker_version, '>') + when: not curr_docker_version | skipped and curr_docker_version.stdout != '' and curr_docker_version.stdout | version_compare(docker_version, '>') # This involves an extremely slow migration process, users should instead run the # Docker 1.10 upgrade playbook to accomplish this. - name: Error out if attempting to upgrade Docker across the 1.10 boundary fail: msg: "Cannot upgrade Docker to >= 1.10, please use the Docker upgrade playbook for this." - when: not curr_docker_version | skipped and curr_docker_version.stdout | default('0.0', True) | version_compare('1.10', '<') and docker_version | version_compare('1.10', '>=') + when: not curr_docker_version | skipped and curr_docker_version.stdout != '' and curr_docker_version.stdout | version_compare('1.10', '<') and docker_version | version_compare('1.10', '>=') # Make sure Docker is installed, but does not update a running version. # Docker upgrades are handled by a separate playbook. -- cgit v1.2.3 From e1a032988800da90219af2944a1b34328ca6ae9e Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 13 Jul 2016 12:04:51 -0300 Subject: Fix more docker role logic. --- roles/docker/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'roles') diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 8b6ce7eae..545317890 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -31,14 +31,14 @@ - name: Fail if Docker version requested but downgrade is required fail: msg: "Docker {{ curr_docker_version.stdout }} is installed, but version {{ docker_version }} was requested." - when: not curr_docker_version | skipped and curr_docker_version.stdout != '' and curr_docker_version.stdout | version_compare(docker_version, '>') + when: not curr_docker_version | skipped and curr_docker_version.stdout != '' and docker_version is defined and curr_docker_version.stdout | version_compare(docker_version, '>') # This involves an extremely slow migration process, users should instead run the # Docker 1.10 upgrade playbook to accomplish this. - name: Error out if attempting to upgrade Docker across the 1.10 boundary fail: msg: "Cannot upgrade Docker to >= 1.10, please use the Docker upgrade playbook for this." - when: not curr_docker_version | skipped and curr_docker_version.stdout != '' and curr_docker_version.stdout | version_compare('1.10', '<') and docker_version | version_compare('1.10', '>=') + when: not curr_docker_version | skipped and curr_docker_version.stdout != '' and curr_docker_version.stdout | version_compare('1.10', '<') and docker_version is defined and docker_version | version_compare('1.10', '>=') # Make sure Docker is installed, but does not update a running version. # Docker upgrades are handled by a separate playbook. -- cgit v1.2.3 From 2a4f65ad4b19fc594851195b3180d1fe81853909 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 13 Jul 2016 14:18:09 -0300 Subject: pylint fixes --- roles/openshift_facts/library/openshift_facts.py | 53 ++++++++++++------------ 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index fdd3e8708..3de8faace 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -7,16 +7,6 @@ """Ansible module for retrieving and setting openshift related facts""" -DOCUMENTATION = ''' ---- -module: openshift_facts -short_description: Cluster Facts -author: Jason DeTiberus -requirements: [ ] -''' -EXAMPLES = ''' -''' - import ConfigParser import copy import io @@ -30,6 +20,17 @@ from dbus import SystemBus, Interface from dbus.exceptions import DBusException +DOCUMENTATION = ''' +--- +module: openshift_facts +short_description: Cluster Facts +author: Jason DeTiberus +requirements: [ ] +''' +EXAMPLES = ''' +''' + + def migrate_docker_facts(facts): """ Apply migrations for docker facts """ params = { @@ -499,10 +500,8 @@ def set_dnsmasq_facts_if_unset(facts): """ if 'common' in facts: - if 'use_dnsmasq' not in facts['common'] and safe_get_bool(facts['common']['version_gte_3_2_or_1_2']): - facts['common']['use_dnsmasq'] = True - else: - facts['common']['use_dnsmasq'] = False + facts['common']['use_dnsmasq'] = bool('use_dnsmasq' not in facts['common'] and + safe_get_bool(facts['common']['version_gte_3_2_or_1_2'])) if 'master' in facts and 'dns_port' not in facts['master']: if safe_get_bool(facts['common']['use_dnsmasq']): facts['master']['dns_port'] = 8053 @@ -1143,7 +1142,7 @@ def get_openshift_version(facts): _, output, _ = module.run_command(['/usr/bin/openshift', 'version']) version = parse_openshift_version(output) elif 'common' in facts and 'is_containerized' in facts['common']: - version = get_containerized_openshift_version(facts) + version = get_container_openshift_version(facts) # Handle containerized masters that have not yet been configured as a node. # This can be very slow and may get re-run multiple times, so we only use this @@ -1155,15 +1154,18 @@ def get_openshift_version(facts): return version -def get_containerized_openshift_version(facts): - # If containerized, see if we can determine the installed version via the systemd environment files: +def get_container_openshift_version(facts): + """ + If containerized, see if we can determine the installed version via the + systemd environment files. + """ for filename in ['/etc/sysconfig/%s-master', '/etc/sysconfig/%s-node']: - env_file = filename % facts['common']['service_type'] - if not os.path.exists(env_file): + env_path = filename % facts['common']['service_type'] + if not os.path.exists(env_path): continue - with open(env_file) as f: - for line in f: + with open(env_path) as env_file: + for line in env_file: if line.startswith("IMAGE_VERSION="): tag = line[len("IMAGE_VERSION="):].strip() # Remove leading "v" and any trailing release info, we just want @@ -1218,7 +1220,7 @@ def apply_provider_facts(facts, provider_facts): # Disabling pylint too many branches. This function needs refactored # but is a very core part of openshift_facts. -# pylint: disable=too-many-branches +# pylint: disable=too-many-branches,too-many-nested-blocks def merge_facts(orig, new, additive_facts_to_overwrite, protected_facts_to_overwrite): """ Recursively merge facts dicts @@ -1766,10 +1768,7 @@ class OpenShiftFacts(object): if 'clock' in roles: exit_code, _, _ = module.run_command(['rpm', '-q', 'chrony']) - if exit_code == 0: - chrony_installed = True - else: - chrony_installed = False + chrony_installed = bool(exit_code == 0) defaults['clock'] = dict( enabled=True, chrony_installed=chrony_installed) @@ -2153,7 +2152,7 @@ def main(): ansible_facts=openshift_facts.facts) # ignore pylint errors related to the module_utils import -# pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import +# pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import, wrong-import-position # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.facts import * -- cgit v1.2.3 From 6bfa3dee1efb32f20dcdcb4c7964ffd02969d1f1 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 13 Jul 2016 15:11:49 -0300 Subject: Remove too recent pylint option keys. --- roles/openshift_facts/library/openshift_facts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 3de8faace..226d707dc 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1220,7 +1220,7 @@ def apply_provider_facts(facts, provider_facts): # Disabling pylint too many branches. This function needs refactored # but is a very core part of openshift_facts. -# pylint: disable=too-many-branches,too-many-nested-blocks +# pylint: disable=too-many-branches def merge_facts(orig, new, additive_facts_to_overwrite, protected_facts_to_overwrite): """ Recursively merge facts dicts @@ -2152,7 +2152,7 @@ def main(): ansible_facts=openshift_facts.facts) # ignore pylint errors related to the module_utils import -# pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import, wrong-import-position +# pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.facts import * -- cgit v1.2.3 From 3073846a8c9e02af06d4d56f0141766b2337424b Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 14 Jul 2016 14:09:59 -0300 Subject: Fix upgrade with docker_version set. --- roles/docker/tasks/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'roles') diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 545317890..89a248d9e 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -11,7 +11,7 @@ - name: Error out if Docker pre-installed but too old fail: msg: "Docker {{ curr_docker_version.stdout }} is installed, but >= 1.9.1 is required." - when: not curr_docker_version | skipped and curr_docker_version.stdout != '' and curr_docker_version.stdout | version_compare('1.9.1', '<') and not docker_version is defined + when: not curr_docker_version | skipped and curr_docker_version.stdout != '' and curr_docker_version.stdout | version_compare('1.9.1', '<') and not docker_version is defined and not docker_protect_installed_version | bool - name: Error out if requested Docker is too old fail: @@ -31,14 +31,14 @@ - name: Fail if Docker version requested but downgrade is required fail: msg: "Docker {{ curr_docker_version.stdout }} is installed, but version {{ docker_version }} was requested." - when: not curr_docker_version | skipped and curr_docker_version.stdout != '' and docker_version is defined and curr_docker_version.stdout | version_compare(docker_version, '>') + when: not curr_docker_version | skipped and curr_docker_version.stdout != '' and docker_version is defined and curr_docker_version.stdout | version_compare(docker_version, '>') and not docker_protect_installed_version | bool # This involves an extremely slow migration process, users should instead run the # Docker 1.10 upgrade playbook to accomplish this. - name: Error out if attempting to upgrade Docker across the 1.10 boundary fail: msg: "Cannot upgrade Docker to >= 1.10, please use the Docker upgrade playbook for this." - when: not curr_docker_version | skipped and curr_docker_version.stdout != '' and curr_docker_version.stdout | version_compare('1.10', '<') and docker_version is defined and docker_version | version_compare('1.10', '>=') + when: not curr_docker_version | skipped and curr_docker_version.stdout != '' and curr_docker_version.stdout | version_compare('1.10', '<') and docker_version is defined and docker_version | version_compare('1.10', '>=') and not docker_protect_installed_version | bool # Make sure Docker is installed, but does not update a running version. # Docker upgrades are handled by a separate playbook. -- cgit v1.2.3