diff options
Diffstat (limited to 'roles')
60 files changed, 209 insertions, 131 deletions
diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index e60dbe2d6..0c2b16acf 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -5,12 +5,13 @@  - include: udev_workaround.yml    when: docker_udev_workaround | default(False) | bool +- set_fact: +    l_use_system_container: "{{ openshift.docker.use_system_container | default(False) }}" +  - name: Use Package Docker if Requested    include: package_docker.yml -  when: openshift.docker.use_system_container is not defined or openshift.docker.use_system_container == False +  when: not l_use_system_container  - name: Use System Container Docker if Requested    include: systemcontainer_docker.yml -  when: -  - openshift.docker.use_system_container is defined -  - openshift.docker.use_system_container is True +  when: l_use_system_container diff --git a/roles/docker/tasks/systemcontainer_docker.yml b/roles/docker/tasks/systemcontainer_docker.yml index 6db95bf12..722232a9b 100644 --- a/roles/docker/tasks/systemcontainer_docker.yml +++ b/roles/docker/tasks/systemcontainer_docker.yml @@ -53,29 +53,29 @@      - name: Set to default prepend        set_fact: -        l_docker_image_prepend: "gscrivano/" +        l_docker_image_prepend: "gscrivano"      - name: Use Red Hat Registry for image when distribution is Red Hat        set_fact: -        l_docker_image_prepend: "registry.access.redhat.com/openshift3/" +        l_docker_image_prepend: "registry.access.redhat.com/openshift3"        when: ansible_distribution == 'RedHat'      - name: Use Fedora Registry for image when distribution is Fedora        set_fact: -        l_docker_image_prepend: "registry.fedoraproject.org/" +        l_docker_image_prepend: "registry.fedoraproject.org"        when: ansible_distribution == 'Fedora'      # For https://github.com/openshift/openshift-ansible/pull/4049#discussion_r114478504      - name: Use a testing registry if requested        set_fact: -        l_docker_image_prepend: "{{ openshift.docker.systemcontainer_image_registry_override }}/" +        l_docker_image_prepend: "{{ openshift_docker_systemcontainer_image_registry_override }}"        when: -        - openshift.docker.systemcontainer_image_registry_override is defined -        - openshift.docker.systemcontainer_image_registry_override != "" +        - openshift_docker_systemcontainer_image_registry_override is defined +        - openshift_docker_systemcontainer_image_registry_override != ""      - name: Set the full image name        set_fact: -        l_docker_image: "{{ l_docker_image_prepend }}container-engine-docker:latest" +        l_docker_image: "{{ l_docker_image_prepend }}/{{ openshift.docker.service_name }}:latest"  - name: Pre-pull Container Enginer System Container image    command: "atomic pull --storage ostree {{ l_docker_image }}" @@ -103,21 +103,29 @@  - name: Install Container Enginer System Container    oc_atomic_container: -    name: container-engine-docker -    image: "container-engine-docker" +    name: "{{ openshift.docker.service_name }}" +    image: "{{ l_docker_image }}"      state: latest      values: -      - "system-package no" +      - "system-package=no"  - name: Configure Container Engine Service File    template:      dest: "{{ docker_systemd_dir }}/custom.conf"      src: systemcontainercustom.conf.j2 +# Set local versions of facts that must be in json format for daemon.json +# NOTE: When jinja2.9+ is used the daemon.json file can move to using tojson +- set_fact: +    l_docker_insecure_registries: "{{ docker_insecure_registries | default([]) | to_json }}" +    l_docker_log_options: "{{ docker_log_options | default({}) | to_json }}" +    l_docker_additional_registries: "{{ docker_additional_registries | default([]) | to_json }}" +    l_docker_blocked_registries: "{{ docker_blocked_registries | default([]) | to_json }}" +  # Configure container-engine using the daemon.json file  - name: Configure Container Engine    template: -    dest: "{{ docker_conf }}/daemon.json" +    dest: "{{ docker_conf_dir }}/daemon.json"      src: daemon.json  # Enable and start the container-engine service diff --git a/roles/docker/templates/daemon.json b/roles/docker/templates/daemon.json index bd085d2be..7ea8164b3 100644 --- a/roles/docker/templates/daemon.json +++ b/roles/docker/templates/daemon.json @@ -12,7 +12,7 @@      "default-gateway": "",      "default-gateway-v6": "",      "default-runtime": "oci", -    "containerd": "/var/run/containerd.sock", +    "containerd": "/run/containerd.sock",      "default-ulimits": {},      "disable-legacy-registry": false,      "dns": [], @@ -26,7 +26,7 @@      "group": "",      "hosts": [],      "icc": false, -    "insecure-registries": {{ docker_insecure_registries|default([]) }}, +    "insecure-registries": {{ l_docker_insecure_registries }},      "ip": "0.0.0.0",      "iptables": false,      "ipv6": false, @@ -34,9 +34,11 @@      "ip-masq": false,      "labels": [],      "live-restore": true, +{% if docker_log_driver is defined  %}      "log-driver": "{{ docker_log_driver }}", +{%- endif %}      "log-level": "", -    "log-opts": {{ docker_log_options|default({}) }}, +    "log-opts": {{ l_docker_log_options }},      "max-concurrent-downloads": 3,      "max-concurrent-uploads": 5,      "mtu": 0, @@ -58,7 +60,7 @@      "tlskey": "",      "tlsverify": true,      "userns-remap": "", -    "add-registry": {{  docker_additional_registries|default([]) }}, -    "blocked-registries": {{ docker_blocked_registries|defaukt([]) }}, +    "add-registry": {{ l_docker_additional_registries }}, +    "blocked-registries": {{ l_docker_blocked_registries }},      "userland-proxy-path": "/usr/libexec/docker/docker-proxy-current"  } diff --git a/roles/docker/templates/systemcontainercustom.conf.j2 b/roles/docker/templates/systemcontainercustom.conf.j2 index a2cfed8a9..a4fb01d2b 100644 --- a/roles/docker/templates/systemcontainercustom.conf.j2 +++ b/roles/docker/templates/systemcontainercustom.conf.j2 @@ -1,13 +1,13 @@  # {{ ansible_managed }}  [Service] -{%- if docker_http_proxy %} +{%- if "http_proxy" in openshift.common %}  ENVIRONMENT=HTTP_PROXY={{ docker_http_proxy }}  {%- endif -%} -{%- if docker_https_proxy %} +{%- if "https_proxy" in openshift.common %}  ENVIRONMENT=HTTPS_PROXY={{ docker_http_proxy }}  {%- endif -%} -{%- if docker_no_proxy %} +{%- if "no_proxy" in openshift.common %}  ENVIRONMENT=NO_PROXY={{ docker_no_proxy }}  {%- endif %}  {%- if os_firewall_use_firewalld|default(true) %} diff --git a/roles/etcd/tasks/main.yml b/roles/etcd/tasks/main.yml index 35117225b..fa2f44609 100644 --- a/roles/etcd/tasks/main.yml +++ b/roles/etcd/tasks/main.yml @@ -120,7 +120,9 @@      enabled: yes    register: start_result -- include: etcdctl.yml +- include_role: +    name: etcd_common +    tasks_from: etcdctl.yml    when: openshift_etcd_etcdctl_profile | default(true) | bool  - name: Set fact etcd_service_status_changed diff --git a/roles/etcd/tasks/etcdctl.yml b/roles/etcd_common/tasks/etcdctl.yml index 6cb456677..6cb456677 100644 --- a/roles/etcd/tasks/etcdctl.yml +++ b/roles/etcd_common/tasks/etcdctl.yml diff --git a/roles/etcd/templates/etcdctl.sh.j2 b/roles/etcd_common/templates/etcdctl.sh.j2 index ac7d9c72f..ac7d9c72f 100644 --- a/roles/etcd/templates/etcdctl.sh.j2 +++ b/roles/etcd_common/templates/etcdctl.sh.j2 diff --git a/roles/lib_openshift/library/oc_adm_ca_server_cert.py b/roles/lib_openshift/library/oc_adm_ca_server_cert.py index 8a311cd0f..7039a0cec 100644 --- a/roles/lib_openshift/library/oc_adm_ca_server_cert.py +++ b/roles/lib_openshift/library/oc_adm_ca_server_cert.py @@ -1080,7 +1080,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_adm_manage_node.py b/roles/lib_openshift/library/oc_adm_manage_node.py index 0930faadb..ae5806137 100644 --- a/roles/lib_openshift/library/oc_adm_manage_node.py +++ b/roles/lib_openshift/library/oc_adm_manage_node.py @@ -1066,7 +1066,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_adm_policy_group.py b/roles/lib_openshift/library/oc_adm_policy_group.py index 6a7be65d0..36eb294a8 100644 --- a/roles/lib_openshift/library/oc_adm_policy_group.py +++ b/roles/lib_openshift/library/oc_adm_policy_group.py @@ -1052,7 +1052,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_adm_policy_user.py b/roles/lib_openshift/library/oc_adm_policy_user.py index 44923ecd2..bedd45922 100644 --- a/roles/lib_openshift/library/oc_adm_policy_user.py +++ b/roles/lib_openshift/library/oc_adm_policy_user.py @@ -1052,7 +1052,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_adm_registry.py b/roles/lib_openshift/library/oc_adm_registry.py index 3722f38b3..c6fa85f90 100644 --- a/roles/lib_openshift/library/oc_adm_registry.py +++ b/roles/lib_openshift/library/oc_adm_registry.py @@ -1170,7 +1170,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_adm_router.py b/roles/lib_openshift/library/oc_adm_router.py index bdcf94a58..8a4f93372 100644 --- a/roles/lib_openshift/library/oc_adm_router.py +++ b/roles/lib_openshift/library/oc_adm_router.py @@ -1195,7 +1195,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_clusterrole.py b/roles/lib_openshift/library/oc_clusterrole.py index af48ce636..d81c29784 100644 --- a/roles/lib_openshift/library/oc_clusterrole.py +++ b/roles/lib_openshift/library/oc_clusterrole.py @@ -1044,7 +1044,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_configmap.py b/roles/lib_openshift/library/oc_configmap.py index 385ed888b..bdcb3f278 100644 --- a/roles/lib_openshift/library/oc_configmap.py +++ b/roles/lib_openshift/library/oc_configmap.py @@ -1050,7 +1050,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_edit.py b/roles/lib_openshift/library/oc_edit.py index 649de547e..be1b3a01e 100644 --- a/roles/lib_openshift/library/oc_edit.py +++ b/roles/lib_openshift/library/oc_edit.py @@ -1094,7 +1094,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_env.py b/roles/lib_openshift/library/oc_env.py index 74bf63353..4ac6e4aeb 100644 --- a/roles/lib_openshift/library/oc_env.py +++ b/roles/lib_openshift/library/oc_env.py @@ -1061,7 +1061,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_group.py b/roles/lib_openshift/library/oc_group.py index 2dd3d28ec..b6f058340 100644 --- a/roles/lib_openshift/library/oc_group.py +++ b/roles/lib_openshift/library/oc_group.py @@ -1034,7 +1034,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_image.py b/roles/lib_openshift/library/oc_image.py index bb7f97689..c094c9472 100644 --- a/roles/lib_openshift/library/oc_image.py +++ b/roles/lib_openshift/library/oc_image.py @@ -1053,7 +1053,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_label.py b/roles/lib_openshift/library/oc_label.py index ec9abcda7..a76dd44c4 100644 --- a/roles/lib_openshift/library/oc_label.py +++ b/roles/lib_openshift/library/oc_label.py @@ -1070,7 +1070,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_obj.py b/roles/lib_openshift/library/oc_obj.py index 3abd50a2e..e12137b51 100644 --- a/roles/lib_openshift/library/oc_obj.py +++ b/roles/lib_openshift/library/oc_obj.py @@ -1073,7 +1073,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_objectvalidator.py b/roles/lib_openshift/library/oc_objectvalidator.py index bc5245216..aeb4e5686 100644 --- a/roles/lib_openshift/library/oc_objectvalidator.py +++ b/roles/lib_openshift/library/oc_objectvalidator.py @@ -1005,7 +1005,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_process.py b/roles/lib_openshift/library/oc_process.py index de5426c51..f7aa8c0d2 100644 --- a/roles/lib_openshift/library/oc_process.py +++ b/roles/lib_openshift/library/oc_process.py @@ -1062,7 +1062,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_project.py b/roles/lib_openshift/library/oc_project.py index 02cd810ce..b044a47ce 100644 --- a/roles/lib_openshift/library/oc_project.py +++ b/roles/lib_openshift/library/oc_project.py @@ -1059,7 +1059,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_pvc.py b/roles/lib_openshift/library/oc_pvc.py index a9103ebf6..8604cc2f3 100644 --- a/roles/lib_openshift/library/oc_pvc.py +++ b/roles/lib_openshift/library/oc_pvc.py @@ -1054,7 +1054,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_route.py b/roles/lib_openshift/library/oc_route.py index f005adffc..fef48daf0 100644 --- a/roles/lib_openshift/library/oc_route.py +++ b/roles/lib_openshift/library/oc_route.py @@ -1104,7 +1104,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_scale.py b/roles/lib_openshift/library/oc_scale.py index 9dcb38216..384df0ee3 100644 --- a/roles/lib_openshift/library/oc_scale.py +++ b/roles/lib_openshift/library/oc_scale.py @@ -1048,7 +1048,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_secret.py b/roles/lib_openshift/library/oc_secret.py index 2ac0abcec..443750c5d 100644 --- a/roles/lib_openshift/library/oc_secret.py +++ b/roles/lib_openshift/library/oc_secret.py @@ -1094,7 +1094,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_service.py b/roles/lib_openshift/library/oc_service.py index 0af695e08..7537bdb5b 100644 --- a/roles/lib_openshift/library/oc_service.py +++ b/roles/lib_openshift/library/oc_service.py @@ -1100,7 +1100,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_serviceaccount.py b/roles/lib_openshift/library/oc_serviceaccount.py index ba8a1fdac..03a4dd3b9 100644 --- a/roles/lib_openshift/library/oc_serviceaccount.py +++ b/roles/lib_openshift/library/oc_serviceaccount.py @@ -1046,7 +1046,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_serviceaccount_secret.py b/roles/lib_openshift/library/oc_serviceaccount_secret.py index 5bff7621c..db1010694 100644 --- a/roles/lib_openshift/library/oc_serviceaccount_secret.py +++ b/roles/lib_openshift/library/oc_serviceaccount_secret.py @@ -1046,7 +1046,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_user.py b/roles/lib_openshift/library/oc_user.py index 450a30f57..c3885c1ac 100644 --- a/roles/lib_openshift/library/oc_user.py +++ b/roles/lib_openshift/library/oc_user.py @@ -1106,7 +1106,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_version.py b/roles/lib_openshift/library/oc_version.py index 0937df5a1..5c4596c09 100644 --- a/roles/lib_openshift/library/oc_version.py +++ b/roles/lib_openshift/library/oc_version.py @@ -1018,7 +1018,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/library/oc_volume.py b/roles/lib_openshift/library/oc_volume.py index d0e7e77e1..5a507348c 100644 --- a/roles/lib_openshift/library/oc_volume.py +++ b/roles/lib_openshift/library/oc_volume.py @@ -1083,7 +1083,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/src/lib/base.py b/roles/lib_openshift/src/lib/base.py index fc1b6f1ec..2bf795e25 100644 --- a/roles/lib_openshift/src/lib/base.py +++ b/roles/lib_openshift/src/lib/base.py @@ -256,7 +256,7 @@ class OpenShiftCLI(object):          stdout, stderr = proc.communicate(input_data) -        return proc.returncode, stdout.decode(), stderr.decode() +        return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')      # pylint: disable=too-many-arguments,too-many-branches      def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None): diff --git a/roles/lib_openshift/src/test/integration/filter_plugins/filters.py b/roles/lib_openshift/src/test/integration/filter_plugins/filters.py index 6990a11a8..f350bd25d 100644 --- a/roles/lib_openshift/src/test/integration/filter_plugins/filters.py +++ b/roles/lib_openshift/src/test/integration/filter_plugins/filters.py @@ -1,6 +1,5 @@  #!/usr/bin/python  # -*- coding: utf-8 -*- -# vim: expandtab:tabstop=4:shiftwidth=4  '''  Custom filters for use in testing  ''' diff --git a/roles/openshift_certificate_expiry/filter_plugins/oo_cert_expiry.py b/roles/openshift_certificate_expiry/filter_plugins/oo_cert_expiry.py index 577a14b9a..a2bc9ecdb 100644 --- a/roles/openshift_certificate_expiry/filter_plugins/oo_cert_expiry.py +++ b/roles/openshift_certificate_expiry/filter_plugins/oo_cert_expiry.py @@ -1,6 +1,5 @@  #!/usr/bin/python  # -*- coding: utf-8 -*- -# vim: expandtab:tabstop=4:shiftwidth=4  """  Custom filters for use in openshift-ansible  """ diff --git a/roles/openshift_cli/library/openshift_container_binary_sync.py b/roles/openshift_cli/library/openshift_container_binary_sync.py index 4ed3e1f01..57ac16602 100644 --- a/roles/openshift_cli/library/openshift_container_binary_sync.py +++ b/roles/openshift_cli/library/openshift_container_binary_sync.py @@ -1,8 +1,6 @@  #!/usr/bin/python  # -*- coding: utf-8 -*- -# vim: expandtab:tabstop=4:shiftwidth=4  # pylint: disable=missing-docstring,invalid-name -#  import random  import tempfile diff --git a/roles/openshift_docker_facts/tasks/main.yml b/roles/openshift_docker_facts/tasks/main.yml index 049ceffe0..350512452 100644 --- a/roles/openshift_docker_facts/tasks/main.yml +++ b/roles/openshift_docker_facts/tasks/main.yml @@ -16,6 +16,7 @@        disable_push_dockerhub: "{{ openshift_disable_push_dockerhub | default(None) }}"        hosted_registry_insecure: "{{ openshift_docker_hosted_registry_insecure | default(openshift.docker.hosted_registry_insecure | default(False)) }}"        hosted_registry_network: "{{ openshift_docker_hosted_registry_network | default(None) }}" +      use_system_container: "{{ openshift_docker_use_system_container | default(False) }}"  - set_fact:      docker_additional_registries: "{{ openshift.docker.additional_registries diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 9528784b5..914e46c05 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1,7 +1,6 @@  #!/usr/bin/python  # pylint: disable=too-many-lines  # -*- coding: utf-8 -*- -# vim: expandtab:tabstop=4:shiftwidth=4  # Reason: Disable pylint too-many-lines because we don't want to split up this file.  # Status: Permanently disabled to keep this module as self-contained as possible. @@ -59,8 +58,7 @@ def migrate_docker_facts(facts):              'additional_registries',              'insecure_registries',              'blocked_registries', -            'options', -            'use_system_container', +            'options'          ),          'node': (              'log_driver', @@ -1795,9 +1793,9 @@ def set_container_facts_if_unset(facts):      facts['common']['is_atomic'] = os.path.isfile('/run/ostree-booted')      # If openshift_docker_use_system_container is set and is True ....      if 'use_system_container' in list(facts['docker'].keys()): -        if facts['docker']['use_system_container'] is True: -            # ... set the service name to container-engine-docker -            facts['docker']['service_name'] = 'container-engine-docker' +        if facts['docker']['use_system_container']: +            # ... set the service name to container-engine +            facts['docker']['service_name'] = 'container-engine'      if 'is_containerized' not in facts['common']:          facts['common']['is_containerized'] = facts['common']['is_atomic'] diff --git a/roles/openshift_health_checker/callback_plugins/zz_failure_summary.py b/roles/openshift_health_checker/callback_plugins/zz_failure_summary.py index 208e81048..7bce7f107 100644 --- a/roles/openshift_health_checker/callback_plugins/zz_failure_summary.py +++ b/roles/openshift_health_checker/callback_plugins/zz_failure_summary.py @@ -1,4 +1,3 @@ -# vim: expandtab:tabstop=4:shiftwidth=4  '''  Ansible callback plugin.  ''' diff --git a/roles/openshift_health_checker/library/aos_version.py b/roles/openshift_health_checker/library/aos_version.py index a46589443..4460ec324 100755 --- a/roles/openshift_health_checker/library/aos_version.py +++ b/roles/openshift_health_checker/library/aos_version.py @@ -1,5 +1,4 @@  #!/usr/bin/python -# vim: expandtab:tabstop=4:shiftwidth=4  '''  Ansible module for yum-based systems determining if multiple releases  of an OpenShift package are available, and if the release requested diff --git a/roles/openshift_health_checker/library/check_yum_update.py b/roles/openshift_health_checker/library/check_yum_update.py index 630ebc848..433795b67 100755 --- a/roles/openshift_health_checker/library/check_yum_update.py +++ b/roles/openshift_health_checker/library/check_yum_update.py @@ -1,5 +1,4 @@  #!/usr/bin/python -# vim: expandtab:tabstop=4:shiftwidth=4  '''  Ansible module to test whether a yum update or install will succeed,  without actually performing it or running yum. diff --git a/roles/openshift_logging/handlers/main.yml b/roles/openshift_logging/handlers/main.yml index ffb812271..69c5a1663 100644 --- a/roles/openshift_logging/handlers/main.yml +++ b/roles/openshift_logging/handlers/main.yml @@ -4,6 +4,15 @@    when: (openshift.master.ha is not defined or not openshift.master.ha | bool) and (not (master_service_status_changed | default(false) | bool))    notify: Verify API Server +- name: restart master api +  systemd: name={{ openshift.common.service_type }}-master-api state=restarted +  when: (openshift.master.ha is defined and openshift.master.ha | bool) and (not (master_api_service_status_changed | default(false) | bool)) and openshift.master.cluster_method == 'native' +  notify: Verify API Server + +- name: restart master controllers +  systemd: name={{ openshift.common.service_type }}-master-controllers state=restarted +  when: (openshift.master.ha is defined and openshift.master.ha | bool) and (not (master_controllers_service_status_changed | default(false) | bool)) and openshift.master.cluster_method == 'native' +  - name: Verify API Server    # Using curl here since the uri module requires python-httplib2 and    # wait_for port doesn't provide health information. diff --git a/roles/openshift_logging/tasks/install_elasticsearch.yaml b/roles/openshift_logging/tasks/install_elasticsearch.yaml index 29c866e08..a981e7f7f 100644 --- a/roles/openshift_logging/tasks/install_elasticsearch.yaml +++ b/roles/openshift_logging/tasks/install_elasticsearch.yaml @@ -5,6 +5,9 @@  - set_fact: openshift_logging_es_pvc_prefix="logging-es"    when: not openshift_logging_es_pvc_prefix or openshift_logging_es_pvc_prefix == '' +- set_fact: es_indices={{ es_indices | default([]) + [item | int - 1] }} +  with_sequence: count={{ openshift_logging_facts.elasticsearch.deploymentconfigs.keys() | count }} +  ### evaluate if the PVC attached to the dc currently matches the provided vars  ## if it does then we reuse that pvc in the DC  - include: set_es_storage.yaml @@ -12,8 +15,9 @@      es_component: es      es_name: "{{ deployment.0 }}"      es_spec: "{{ deployment.1 }}" +    es_pvc_count: "{{ deployment.2 | int }}"      es_node_selector: "{{ openshift_logging_es_nodeselector | default({}) }}" -    es_pvc_names: "{{ openshift_logging_facts.elasticsearch.pvcs.keys() }}" +    es_pvc_names_count: "{{ openshift_logging_facts.elasticsearch.pvcs.keys() | count }}"      es_pvc_size: "{{ openshift_logging_es_pvc_size }}"      es_pvc_prefix: "{{ openshift_logging_es_pvc_prefix }}"      es_pvc_dynamic: "{{ openshift_logging_es_pvc_dynamic | bool }}" @@ -23,6 +27,7 @@    with_together:    - "{{ openshift_logging_facts.elasticsearch.deploymentconfigs.keys() }}"    - "{{ openshift_logging_facts.elasticsearch.deploymentconfigs.values() }}" +  - "{{ es_indices | default([]) }}"    loop_control:      loop_var: deployment  ## if it does not then we should create one that does and attach it @@ -33,8 +38,9 @@      es_component: es      es_name: "logging-es-{{'abcdefghijklmnopqrstuvwxyz0123456789'|random_word(8)}}"      es_spec: "{}" +    es_pvc_count: "{{ item | int - 1 }}"      es_node_selector: "{{ openshift_logging_es_nodeselector | default({}) }}" -    es_pvc_names: "{{ openshift_logging_facts.elasticsearch.pvcs.keys() }}" +    es_pvc_names_count: "{{ [openshift_logging_facts.elasticsearch.pvcs.keys() | count, openshift_logging_facts.elasticsearch.deploymentconfigs.keys() | count] | max }}"      es_pvc_size: "{{ openshift_logging_es_pvc_size }}"      es_pvc_prefix: "{{ openshift_logging_es_pvc_prefix }}"      es_pvc_dynamic: "{{ openshift_logging_es_pvc_dynamic | bool }}" @@ -63,13 +69,19 @@  - set_fact: openshift_logging_es_ops_pvc_prefix="logging-es-ops"    when: not openshift_logging_es_ops_pvc_prefix or openshift_logging_es_ops_pvc_prefix == '' +- set_fact: es_ops_indices={{ es_ops_indices | default([]) + [item | int - 1] }} +  with_sequence: count={{ openshift_logging_facts.elasticsearch_ops.deploymentconfigs.keys() | count }} +  when: +  - openshift_logging_use_ops | bool +  - include: set_es_storage.yaml    vars:      es_component: es-ops      es_name: "{{ deployment.0 }}"      es_spec: "{{ deployment.1 }}" +    es_pvc_count: "{{ deployment.2 | int }}"      es_node_selector: "{{ openshift_logging_es_ops_nodeselector | default({}) }}" -    es_pvc_names: "{{ openshift_logging_facts.elasticsearch_ops.pvcs.keys() }}" +    es_pvc_names_count: "{{ openshift_logging_facts.elasticsearch_ops.pvcs.keys() | count }}"      es_pvc_size: "{{ openshift_logging_es_ops_pvc_size }}"      es_pvc_prefix: "{{ openshift_logging_es_ops_pvc_prefix }}"      es_pvc_dynamic: "{{ openshift_logging_es_ops_pvc_dynamic | bool }}" @@ -79,6 +91,7 @@    with_together:    - "{{ openshift_logging_facts.elasticsearch_ops.deploymentconfigs.keys() }}"    - "{{ openshift_logging_facts.elasticsearch_ops.deploymentconfigs.values() }}" +  - "{{ es_ops_indices | default([]) }}"    loop_control:      loop_var: deployment    when: @@ -91,8 +104,9 @@      es_component: es-ops      es_name: "logging-es-ops-{{'abcdefghijklmnopqrstuvwxyz0123456789'|random_word(8)}}"      es_spec: "{}" +    es_pvc_count: "{{ item | int - 1 }}"      es_node_selector: "{{ openshift_logging_es_ops_nodeselector | default({}) }}" -    es_pvc_names: "{{ openshift_logging_facts.elasticsearch_ops.pvcs.keys() }}" +    es_pvc_names_count: "{{ [openshift_logging_facts.elasticsearch_ops.pvcs.keys() | count, openshift_logging_facts.elasticsearch_ops.deploymentconfigs.keys() | count] | max }}"      es_pvc_size: "{{ openshift_logging_es_ops_pvc_size }}"      es_pvc_prefix: "{{ openshift_logging_es_ops_pvc_prefix }}"      es_pvc_dynamic: "{{ openshift_logging_es_ops_pvc_dynamic | bool }}" diff --git a/roles/openshift_logging/tasks/oc_apply.yaml b/roles/openshift_logging/tasks/oc_apply.yaml index c4db7d033..a0ed56ebd 100644 --- a/roles/openshift_logging/tasks/oc_apply.yaml +++ b/roles/openshift_logging/tasks/oc_apply.yaml @@ -6,7 +6,7 @@      namespace: "{{ namespace }}"      files:      - "{{ file_name }}" -  when: file_content.kind != "Service" +  when: file_content.kind not in ["Service", "Route"]  ## still need to do this for services until the template logic is replaced by oc_*  - block: @@ -49,4 +49,4 @@      failed_when: "'error' in generation_apply.stderr"      changed_when: generation_apply.rc == 0      when: "'field is immutable' in generation_apply.stderr" -  when: file_content.kind == "Service" +  when: file_content.kind in ["Service", "Route"] diff --git a/roles/openshift_logging/tasks/set_es_storage.yaml b/roles/openshift_logging/tasks/set_es_storage.yaml index 0bb4d5ee5..4afe4e641 100644 --- a/roles/openshift_logging/tasks/set_es_storage.yaml +++ b/roles/openshift_logging/tasks/set_es_storage.yaml @@ -36,7 +36,7 @@    - name: Generating PersistentVolumeClaims      template: src=pvc.j2 dest={{mktemp.stdout}}/templates/logging-{{obj_name}}-pvc.yaml      vars: -      obj_name: "{{ es_pvc_prefix }}-{{ es_pvc_names | count }}" +      obj_name: "{{ es_pvc_prefix }}-{{ es_pvc_names_count | int + es_pvc_count | int }}"        size: "{{ es_pvc_size }}"        access_modes: "{{ openshift_logging_storage_access_modes }}"        pv_selector: "{{ es_pv_selector }}" @@ -47,7 +47,7 @@    - name: Generating PersistentVolumeClaims - Dynamic      template: src=pvc.j2 dest={{mktemp.stdout}}/templates/logging-{{obj_name}}-pvc.yaml      vars: -      obj_name: "{{ es_pvc_prefix }}-{{ es_pvc_names | count }}" +      obj_name: "{{ es_pvc_prefix }}-{{ es_pvc_names_count | int + es_pvc_count | int }}"        annotations:          volume.alpha.kubernetes.io/storage-class: "dynamic"        size: "{{ es_pvc_size }}" @@ -57,7 +57,7 @@      check_mode: no      changed_when: no -  - set_fact: es_storage_claim="{{ es_pvc_prefix }}-{{ es_pvc_names | count }}" +  - set_fact: es_storage_claim="{{ es_pvc_prefix }}-{{ es_pvc_names_count | int + es_pvc_count | int }}"    when:    - es_pvc_size | search('^\d.*') diff --git a/roles/openshift_logging/tasks/start_cluster.yaml b/roles/openshift_logging/tasks/start_cluster.yaml index 7fec5db42..c1592b830 100644 --- a/roles/openshift_logging/tasks/start_cluster.yaml +++ b/roles/openshift_logging/tasks/start_cluster.yaml @@ -36,7 +36,7 @@      name: "{{ object }}"      namespace: "{{openshift_logging_namespace}}"      replicas: "{{ openshift_logging_mux_replica_count | default (1) }}" -  with_items: "{{ mux_dc.results.results[0]['items'] if 'results' in mux_dc else {} | map(attribute='metadata.name') | list }}" +  with_items: "{{ mux_dc.results.results[0]['items'] | map(attribute='metadata.name') | list if 'results' in mux_dc else [] }}"    loop_control:      loop_var: object    when: diff --git a/roles/openshift_logging/tasks/stop_cluster.yaml b/roles/openshift_logging/tasks/stop_cluster.yaml index c078e4b2f..f4b419d84 100644 --- a/roles/openshift_logging/tasks/stop_cluster.yaml +++ b/roles/openshift_logging/tasks/stop_cluster.yaml @@ -36,7 +36,7 @@      name: "{{ object }}"      namespace: "{{openshift_logging_namespace}}"      replicas: 0 -  with_items: "{{ mux_dc.results.results[0]['items'] if 'results' in mux_dc else {} | map(attribute='metadata.name') | list }}" +  with_items: "{{ mux_dc.results.results[0]['items'] | map(attribute='metadata.name') | list if 'results' in mux_dc else [] }}"    loop_control:      loop_var: object    when: openshift_logging_use_mux diff --git a/roles/openshift_logging/tasks/update_master_config.yaml b/roles/openshift_logging/tasks/update_master_config.yaml index cef835668..10f522b61 100644 --- a/roles/openshift_logging/tasks/update_master_config.yaml +++ b/roles/openshift_logging/tasks/update_master_config.yaml @@ -4,6 +4,9 @@      dest: "{{ openshift.common.config_base }}/master/master-config.yaml"      yaml_key: assetConfig.loggingPublicURL      yaml_value: "https://{{ openshift_logging_kibana_hostname }}" -  notify: restart master +  notify: +  - restart master +  - restart master api +  - restart master controllers    tags: -    - update_master_config +  - update_master_config diff --git a/roles/openshift_master_certificates/tasks/main.yml b/roles/openshift_master_certificates/tasks/main.yml index 33a0af07f..2617efaf1 100644 --- a/roles/openshift_master_certificates/tasks/main.yml +++ b/roles/openshift_master_certificates/tasks/main.yml @@ -64,7 +64,7 @@      --signer-key={{ openshift_ca_key }}      --signer-serial={{ openshift_ca_serial }}      --overwrite=false -  when: inventory_hostname != openshift_ca_host +  when: item != openshift_ca_host    with_items: "{{ hostvars                    | oo_select_keys(groups['oo_masters_to_config'])                    | oo_collect(attribute='inventory_hostname', filters={'master_certs_missing':True}) }}" @@ -95,7 +95,7 @@    with_items: "{{ hostvars                    | oo_select_keys(groups['oo_masters_to_config'])                    | oo_collect(attribute='inventory_hostname', filters={'master_certs_missing':True}) }}" -  when: inventory_hostname != openshift_ca_host +  when: item != openshift_ca_host    delegate_to: "{{ openshift_ca_host }}"    run_once: true diff --git a/roles/openshift_master_facts/filter_plugins/openshift_master.py b/roles/openshift_master_facts/filter_plugins/openshift_master.py index e570392ff..65f85066e 100644 --- a/roles/openshift_master_facts/filter_plugins/openshift_master.py +++ b/roles/openshift_master_facts/filter_plugins/openshift_master.py @@ -1,6 +1,5 @@  #!/usr/bin/python  # -*- coding: utf-8 -*- -# vim: expandtab:tabstop=4:shiftwidth=4  '''  Custom filters for use in openshift-master  ''' diff --git a/roles/openshift_metrics/handlers/main.yml b/roles/openshift_metrics/handlers/main.yml index ffb812271..69c5a1663 100644 --- a/roles/openshift_metrics/handlers/main.yml +++ b/roles/openshift_metrics/handlers/main.yml @@ -4,6 +4,15 @@    when: (openshift.master.ha is not defined or not openshift.master.ha | bool) and (not (master_service_status_changed | default(false) | bool))    notify: Verify API Server +- name: restart master api +  systemd: name={{ openshift.common.service_type }}-master-api state=restarted +  when: (openshift.master.ha is defined and openshift.master.ha | bool) and (not (master_api_service_status_changed | default(false) | bool)) and openshift.master.cluster_method == 'native' +  notify: Verify API Server + +- name: restart master controllers +  systemd: name={{ openshift.common.service_type }}-master-controllers state=restarted +  when: (openshift.master.ha is defined and openshift.master.ha | bool) and (not (master_controllers_service_status_changed | default(false) | bool)) and openshift.master.cluster_method == 'native' +  - name: Verify API Server    # Using curl here since the uri module requires python-httplib2 and    # wait_for port doesn't provide health information. diff --git a/roles/openshift_metrics/tasks/generate_hawkular_certificates.yaml b/roles/openshift_metrics/tasks/generate_hawkular_certificates.yaml index 07b7eca33..fb4fe2f03 100644 --- a/roles/openshift_metrics/tasks/generate_hawkular_certificates.yaml +++ b/roles/openshift_metrics/tasks/generate_hawkular_certificates.yaml @@ -14,20 +14,22 @@    changed_when: no  - name: generate password for hawkular metrics -  local_action: copy dest="{{ local_tmp.stdout}}/{{ item }}.pwd" content="{{ 15 | oo_random_word }}" +  local_action: copy dest="{{ local_tmp.stdout }}/{{ item }}.pwd" content="{{ 15 | oo_random_word }}"    with_items:    - hawkular-metrics +- local_action: slurp src="{{ local_tmp.stdout }}/hawkular-metrics.pwd" +  register: hawkular_metrics_pwd +  no_log: true +  - name: generate htpasswd file for hawkular metrics -  local_action: > -    shell htpasswd -ci -    '{{ local_tmp.stdout }}/hawkular-metrics.htpasswd' hawkular -    < '{{ local_tmp.stdout }}/hawkular-metrics.pwd' +  local_action: htpasswd path="{{ local_tmp.stdout }}/hawkular-metrics.htpasswd" name=hawkular password="{{ hawkular_metrics_pwd.content | b64decode }}" +  no_log: true  - name: copy local generated passwords to target    copy: -    src: "{{local_tmp.stdout}}/{{item}}" -    dest: "{{mktemp.stdout}}/{{item}}" +    src: "{{ local_tmp.stdout }}/{{ item }}" +    dest: "{{ mktemp.stdout }}/{{ item }}"    with_items:    - hawkular-metrics.pwd    - hawkular-metrics.htpasswd diff --git a/roles/openshift_metrics/tasks/update_master_config.yaml b/roles/openshift_metrics/tasks/update_master_config.yaml index 20fc45fd4..be1e3c3a0 100644 --- a/roles/openshift_metrics/tasks/update_master_config.yaml +++ b/roles/openshift_metrics/tasks/update_master_config.yaml @@ -4,6 +4,9 @@      dest: "{{ openshift.common.config_base }}/master/master-config.yaml"      yaml_key: assetConfig.metricsPublicURL      yaml_value: "https://{{ openshift_metrics_hawkular_hostname}}/hawkular/metrics" -  notify: restart master +  notify: +  - restart master +  - restart master api +  - restart master controllers    tags: -    - update_master_config +  - update_master_config diff --git a/roles/openshift_repos/tasks/main.yaml b/roles/openshift_repos/tasks/main.yaml index 84a0905cc..9a9436fcb 100644 --- a/roles/openshift_repos/tasks/main.yaml +++ b/roles/openshift_repos/tasks/main.yaml @@ -40,4 +40,21 @@      - openshift_deployment_type == 'origin'      - openshift_enable_origin_repo | default(true) | bool +  # Singleton block +  - when: r_osr_first_run | default(true) +    block: +    - name: Ensure clean repo cache in the event repos have been changed manually +      debug: +        msg: "First run of openshift_repos" +      changed_when: true +      notify: refresh cache + +    - name: Set fact r_osr_first_run false +      set_fact: +        r_osr_first_run: false + +  # Force running ALL handlers now, because we expect repo cache to be cleared +  # if changes have been made. +  - meta: flush_handlers +    when: not ostree_booted.stat.exists diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index fa9b20e92..d8b1158a6 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -86,8 +86,16 @@    include: set_version_rpm.yml    when: not is_containerized | bool -- name: Set openshift_version for containerized installation -  include: set_version_containerized.yml +- block: +  - name: Set openshift_version for containerized installation +    include: set_version_containerized.yml +  - name: Determine openshift rpm version +    include: rpm_version.yml +  - name: Fail if rpm version and docker image version are different +    fail: +      msg: "OCP rpm version {{ openshift_rpm_version }} is different from OCP image version {{ openshift_version }}" +    # Both versions have the same string representation +    when: openshift_rpm_version != openshift_version    when: is_containerized | bool  # Warn if the user has provided an openshift_image_tag but is not doing a containerized install diff --git a/roles/openshift_version/tasks/rpm_version.yml b/roles/openshift_version/tasks/rpm_version.yml new file mode 100644 index 000000000..bd5e94b43 --- /dev/null +++ b/roles/openshift_version/tasks/rpm_version.yml @@ -0,0 +1,44 @@ +--- +# input_variables: +# - repoquery_cmd +# - openshift.common.service_type +# output_variables: +# - openshift_rpm_version + +# if {{ openshift.common.service_type}}-excluder is enabled, +# the repoquery for {{ openshift.common.service_type}} will not work. +# Thus, create a temporary yum,conf file where exclude= is set to an empty list +- name: Create temporary yum.conf file +  command: mktemp -d /tmp/yum.conf.XXXXXX +  register: yum_conf_temp_file_result + +- set_fact: +    yum_conf_temp_file: "{{yum_conf_temp_file_result.stdout}}/yum.conf" + +- name: Copy yum.conf into the temporary file +  copy: +    src: /etc/yum.conf +    dest: "{{ yum_conf_temp_file }}" +    remote_src: True + +- name: Clear the exclude= list in the temporary yum.conf +  lineinfile: +    # since ansible 2.3 s/dest/path +    dest: "{{ yum_conf_temp_file }}" +    regexp: '^exclude=' +    line: 'exclude=' + +- name: Gather common package version +  command: > +    {{ repoquery_cmd }} --config "{{ yum_conf_temp_file }}" --qf '%{version}' "{{ openshift.common.service_type}}" +  register: common_version +  failed_when: false +  changed_when: false + +- name: Delete the temporary yum.conf +  file: +    path: "{{ yum_conf_temp_file_result.stdout }}" +    state: absent + +- set_fact: +    openshift_rpm_version: "{{ common_version.stdout | default('0.0', True) }}" diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml index c7604af1a..3cf78068b 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -7,42 +7,8 @@    - openshift_pkg_version is defined    - openshift_version is not defined -# if {{ openshift.common.service_type}}-excluder is enabled, -# the repoquery for {{ openshift.common.service_type}} will not work. -# Thus, create a temporary yum,conf file where exclude= is set to an empty list -- name: Create temporary yum.conf file -  command: mktemp -d /tmp/yum.conf.XXXXXX -  register: yum_conf_temp_file_result - -- set_fact: -    yum_conf_temp_file: "{{yum_conf_temp_file_result.stdout}}/yum.conf" - -- name: Copy yum.conf into the temporary file -  copy: -    src: /etc/yum.conf -    dest: "{{ yum_conf_temp_file }}" -    remote_src: True - -- name: Clear the exclude= list in the temporary yum.conf -  lineinfile: -    # since ansible 2.3 s/dest/path -    dest: "{{ yum_conf_temp_file }}" -    regexp: '^exclude=' -    line: 'exclude=' - -- name: Gather common package version -  command: > -    {{ repoquery_cmd }} --config "{{ yum_conf_temp_file }}" --qf '%{version}' "{{ openshift.common.service_type}}" -  register: common_version -  failed_when: false -  changed_when: false -  when: openshift_version is not defined - -- name: Delete the temporary yum.conf -  file: -    path: "{{ yum_conf_temp_file_result.stdout }}" -    state: absent - -- set_fact: -    openshift_version: "{{ common_version.stdout | default('0.0', True) }}" +- block: +  - include: rpm_version.yml +  - set_fact: +      openshift_version: "{{ openshift_rpm_version }}"    when: openshift_version is not defined diff --git a/roles/os_firewall/library/os_firewall_manage_iptables.py b/roles/os_firewall/library/os_firewall_manage_iptables.py index 8d4878fa7..aeee3ede8 100755 --- a/roles/os_firewall/library/os_firewall_manage_iptables.py +++ b/roles/os_firewall/library/os_firewall_manage_iptables.py @@ -1,6 +1,5 @@  #!/usr/bin/python  # -*- coding: utf-8 -*- -# vim: expandtab:tabstop=4:shiftwidth=4  # pylint: disable=fixme, missing-docstring  import subprocess  | 
