summaryrefslogtreecommitdiffstats
path: root/roles/openshift_master/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/openshift_master/tasks')
-rw-r--r--roles/openshift_master/tasks/main.yml23
-rw-r--r--roles/openshift_master/tasks/systemd_units.yml46
2 files changed, 64 insertions, 5 deletions
diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml
index fe0784ea2..28faee155 100644
--- a/roles/openshift_master/tasks/main.yml
+++ b/roles/openshift_master/tasks/main.yml
@@ -29,7 +29,7 @@
- name: Pull master image
command: >
- docker pull {{ openshift.master.master_image }}:{{ openshift_version }}
+ docker pull {{ openshift.master.master_image }}{{ ':' + openshift_version if openshift_version is defined and openshift_version != '' else '' }}
when: openshift.common.is_containerized | bool
- name: Create openshift.common.data_dir
@@ -91,8 +91,16 @@
template:
dest: "{{ item.filename }}"
src: htpasswd.j2
- mode: 0600
backup: yes
+ when: item.kind == 'HTPasswdPasswordIdentityProvider' and openshift.master.manage_htpasswd | bool
+ with_items: "{{ openshift.master.identity_providers }}"
+
+- name: Ensure htpasswd file exists
+ copy:
+ dest: "{{ item.filename }}"
+ force: no
+ content: ""
+ mode: 0600
when: item.kind == 'HTPasswdPasswordIdentityProvider'
with_items: "{{ openshift.master.identity_providers }}"
@@ -139,7 +147,7 @@
- restart master api
- set_fact:
- translated_identity_providers: "{{ openshift.master.identity_providers | translate_idps('v1') }}"
+ translated_identity_providers: "{{ openshift.master.identity_providers | translate_idps('v1', openshift.common.version, openshift.common.deployment_type) }}"
# TODO: add the validate parameter when there is a validation command to run
- name: Create master config
@@ -164,9 +172,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 }}"
diff --git a/roles/openshift_master/tasks/systemd_units.yml b/roles/openshift_master/tasks/systemd_units.yml
index a81270bab..458b56fd1 100644
--- a/roles/openshift_master/tasks/systemd_units.yml
+++ b/roles/openshift_master/tasks/systemd_units.yml
@@ -38,22 +38,54 @@
when: create_ha_unit_files | changed
# end workaround for missing systemd unit files
+- name: Preserve Master API Proxy Config options
+ command: grep PROXY /etc/sysconfig/{{ openshift.common.service_type }}-master-api
+ register: master_api_proxy
+ when: openshift.master.ha is defined and openshift.master.ha | bool and openshift_master_cluster_method == "native"
+ failed_when: false
+ changed_when: false
+
- name: Create the master api service env file
template:
src: "{{ ha_svc_template_path }}/atomic-openshift-master-api.j2"
dest: /etc/sysconfig/{{ openshift.common.service_type }}-master-api
+ backup: true
when: openshift.master.ha is defined and openshift.master.ha | bool and openshift_master_cluster_method == "native"
notify:
- restart master api
+- name: Restore Master API Proxy Config Options
+ when: openshift.master.ha is defined and openshift.master.ha | bool and openshift_master_cluster_method == "native"
+ and master_api_proxy.rc == 0 and 'http_proxy' not in openshift.common and 'https_proxy' not in openshift.common
+ lineinfile:
+ dest: /etc/sysconfig/{{ openshift.common.service_type }}-master-api
+ line: "{{ item }}"
+ with_items: "{{ master_api_proxy.stdout_lines | default([]) }}"
+
+- name: Preserve Master Controllers Proxy Config options
+ command: grep PROXY /etc/sysconfig/{{ openshift.common.service_type }}-master-api
+ register: master_controllers_proxy
+ when: openshift.master.ha is defined and openshift.master.ha | bool and openshift_master_cluster_method == "native"
+ failed_when: false
+ changed_when: false
+
- name: Create the master controllers service env file
template:
src: "{{ ha_svc_template_path }}/atomic-openshift-master-controllers.j2"
dest: /etc/sysconfig/{{ openshift.common.service_type }}-master-controllers
+ backup: true
when: openshift.master.ha is defined and openshift.master.ha | bool and openshift_master_cluster_method == "native"
notify:
- restart master controllers
+- name: Restore Master Controllers Proxy Config Options
+ lineinfile:
+ dest: /etc/sysconfig/{{ openshift.common.service_type }}-master-controllers
+ line: "{{ item }}"
+ with_items: "{{ master_controllers_proxy.stdout_lines | default([]) }}"
+ when: openshift.master.ha is defined and openshift.master.ha | bool and openshift_master_cluster_method == "native"
+ and master_controllers_proxy.rc == 0 and 'http_proxy' not in openshift.common and 'https_proxy' not in openshift.common
+
- name: Install Master docker service file
template:
dest: "/etc/systemd/system/{{ openshift.common.service_type }}-master.service"
@@ -61,9 +93,23 @@
register: install_result
when: openshift.common.is_containerized | bool and openshift.master.ha is defined and not openshift.master.ha | bool
+- name: Preserve Master Proxy Config options
+ command: grep PROXY /etc/sysconfig/{{ openshift.common.service_type }}-master
+ register: master_proxy
+ failed_when: false
+ changed_when: false
+
- name: Create the master service env file
template:
src: "atomic-openshift-master.j2"
dest: /etc/sysconfig/{{ openshift.common.service_type }}-master
+ backup: true
notify:
- restart master
+
+- name: Restore Master Proxy Config Options
+ lineinfile:
+ dest: /etc/sysconfig/{{ openshift.common.service_type }}-master
+ line: "{{ item }}"
+ with_items: "{{ master_proxy.stdout_lines | default([]) }}"
+ when: master_proxy.rc == 0 and 'http_proxy' not in openshift.common and 'https_proxy' not in openshift.common \ No newline at end of file