From 4c47f15b8a1328528cd6365b2d05578ab7fc1439 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 10 Feb 2017 15:24:53 +0100 Subject: master: support HA deployments with system containers Signed-off-by: Giuseppe Scrivano --- roles/openshift_master/tasks/system_container.yml | 41 +++++++++++++++++++++++ roles/openshift_master/tasks/systemd_units.yml | 8 +++-- 2 files changed, 47 insertions(+), 2 deletions(-) (limited to 'roles/openshift_master') diff --git a/roles/openshift_master/tasks/system_container.yml b/roles/openshift_master/tasks/system_container.yml index e3e3d7948..90cbc243d 100644 --- a/roles/openshift_master/tasks/system_container.yml +++ b/roles/openshift_master/tasks/system_container.yml @@ -18,6 +18,7 @@ when: - ("master" in result.stdout) - (openshift.common.version is defined) and (openshift.common.version == openshift_version) | bool + - openshift.master.ha is not defined or not openshift.master.ha | bool - name: Uninstall Master system container package command: > @@ -26,11 +27,51 @@ when: - ("master" in result.stdout) - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) | bool + - openshift.master.ha is not defined or not openshift.master.ha | bool - name: Install Master system container package command: > atomic install --system --name={{ openshift.common.service_type }}-master {{ openshift.common.system_images_registry }}/{{ openshift.master.master_system_image }}:{{ openshift_image_tag }} when: - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) or ("master" not in result.stdout) | bool + - openshift.master.ha is not defined or not openshift.master.ha | bool + notify: + - restart master + +# HA +- name: Update Master HA system container package + command: > + atomic containers update {{ openshift.common.service_type }}-master-{{ item }} + register: update_result + changed_when: "'Extracting' in update_result.stdout" + with_items: + - api + - controllers + when: + - ("master" in result.stdout) + - (openshift.common.version is defined) and (openshift.common.version == openshift_version) | bool + - openshift.master.ha is defined and openshift.master.ha | bool + +- name: Uninstall Master HA system container package + command: > + atomic uninstall {{ openshift.common.service_type }}-master-{{ item }} + failed_when: False + with_items: + - api + - controllers + when: + - ("master" in result.stdout) + - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) | bool + - openshift.master.ha is defined and openshift.master.ha | bool + +- name: Install Master HA system container package + command: > + atomic install --system --set COMMAND={{ item }} --name={{ openshift.common.service_type }}-master-{{ item }} {{ openshift.common.system_images_registry }}/{{ openshift.master.master_system_image }}:{{ openshift_image_tag }} + with_items: + - api + - controllers + when: + - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) or ("master" not in result.stdout) | bool + - openshift.master.ha is defined and openshift.master.ha | bool notify: - restart master diff --git a/roles/openshift_master/tasks/systemd_units.yml b/roles/openshift_master/tasks/systemd_units.yml index 4ab98cbbb..506c8b129 100644 --- a/roles/openshift_master/tasks/systemd_units.yml +++ b/roles/openshift_master/tasks/systemd_units.yml @@ -27,7 +27,9 @@ template: src: "master_docker/master.docker.service.j2" dest: "{{ containerized_svc_dir }}/{{ openshift.common.service_type }}-master.service" - when: openshift.common.is_containerized | bool and (openshift.master.ha is not defined or not openshift.master.ha | bool and not openshift.common.is_master_system_container | bool) + when: + - openshift.common.is_containerized | bool and (openshift.master.ha is not defined or not openshift.master.ha) | bool + - not openshift.common.is_master_system_container | bool register: create_master_unit_file - command: systemctl daemon-reload @@ -37,7 +39,9 @@ template: src: "{{ ha_svc_template_path }}/atomic-openshift-master-{{ item }}.service.j2" dest: "{{ containerized_svc_dir }}/{{ openshift.common.service_type }}-master-{{ item }}.service" - when: openshift.master.ha is defined and openshift.master.ha | bool and openshift_master_cluster_method == "native" + when: + - openshift.master.ha is defined and openshift.master.ha | bool and openshift_master_cluster_method == "native" + - not openshift.common.is_master_system_container | bool with_items: - api - controllers -- cgit v1.2.3 From 95cf33d8b8e9bfeffbf1cc80bf55fc3c603be190 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Sun, 12 Feb 2017 19:25:15 +0100 Subject: master, vars/main.yml: define l_is_ha and l_is_same_version Signed-off-by: Giuseppe Scrivano --- roles/openshift_master/tasks/system_container.yml | 24 +++++++++++------------ roles/openshift_master/vars/main.yml | 3 +++ 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'roles/openshift_master') diff --git a/roles/openshift_master/tasks/system_container.yml b/roles/openshift_master/tasks/system_container.yml index 90cbc243d..a0e1ac75e 100644 --- a/roles/openshift_master/tasks/system_container.yml +++ b/roles/openshift_master/tasks/system_container.yml @@ -17,8 +17,8 @@ changed_when: "'Extracting' in update_result.stdout" when: - ("master" in result.stdout) - - (openshift.common.version is defined) and (openshift.common.version == openshift_version) | bool - - openshift.master.ha is not defined or not openshift.master.ha | bool + - l_is_same_version + - not l_is_ha - name: Uninstall Master system container package command: > @@ -26,15 +26,15 @@ failed_when: False when: - ("master" in result.stdout) - - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) | bool - - openshift.master.ha is not defined or not openshift.master.ha | bool + - not l_is_same_version + - not l_is_ha - name: Install Master system container package command: > atomic install --system --name={{ openshift.common.service_type }}-master {{ openshift.common.system_images_registry }}/{{ openshift.master.master_system_image }}:{{ openshift_image_tag }} when: - - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) or ("master" not in result.stdout) | bool - - openshift.master.ha is not defined or not openshift.master.ha | bool + - not l_is_same_version or ("master" not in result.stdout) | bool + - not l_is_ha notify: - restart master @@ -49,8 +49,8 @@ - controllers when: - ("master" in result.stdout) - - (openshift.common.version is defined) and (openshift.common.version == openshift_version) | bool - - openshift.master.ha is defined and openshift.master.ha | bool + - l_is_same_version + - l_is_ha - name: Uninstall Master HA system container package command: > @@ -61,8 +61,8 @@ - controllers when: - ("master" in result.stdout) - - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) | bool - - openshift.master.ha is defined and openshift.master.ha | bool + - not l_is_same_version + - l_is_ha - name: Install Master HA system container package command: > @@ -71,7 +71,7 @@ - api - controllers when: - - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) or ("master" not in result.stdout) | bool - - openshift.master.ha is defined and openshift.master.ha | bool + - not l_is_same_version or ("master" not in result.stdout) | bool + - l_is_ha notify: - restart master diff --git a/roles/openshift_master/vars/main.yml b/roles/openshift_master/vars/main.yml index 01cd28c66..1e157097d 100644 --- a/roles/openshift_master/vars/main.yml +++ b/roles/openshift_master/vars/main.yml @@ -18,3 +18,6 @@ openshift_master_valid_grant_methods: - auto - prompt - deny + +l_is_ha: "{{ openshift.master.ha is defined and openshift.master.ha | bool }}" +l_is_same_version: "{{ (openshift.common.version is defined) and (openshift.common.version == openshift_version) | bool }}" -- cgit v1.2.3