summaryrefslogtreecommitdiffstats
path: root/roles/openshift_master/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/openshift_master/tasks/main.yml')
-rw-r--r--roles/openshift_master/tasks/main.yml75
1 files changed, 70 insertions, 5 deletions
diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml
index 43647cc49..9caf15f9e 100644
--- a/roles/openshift_master/tasks/main.yml
+++ b/roles/openshift_master/tasks/main.yml
@@ -20,6 +20,9 @@
- fail:
msg: "openshift_master_cluster_password must be set for multi-master installations"
when: openshift_master_ha | bool and openshift_master_cluster_method == "pacemaker" and (openshift_master_cluster_password is not defined or not openshift_master_cluster_password)
+- fail:
+ 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
- name: Set master facts
openshift_facts:
@@ -76,9 +79,52 @@
disabled_features: "{{ osm_disabled_features | default(None) }}"
master_count: "{{ openshift_master_count | default(None) }}"
controller_lease_ttl: "{{ osm_controller_lease_ttl | default(None) }}"
+ master_image: "{{ osm_image | default(None) }}"
- name: Install Master package
action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-master{{ openshift_version }} state=present"
+ when: not openshift.common.is_containerized | bool
+
+- name: Get docker images
+ command: docker images
+ changed_when: false
+ when: openshift.common.is_containerized | bool
+ register: docker_images
+
+- name: Pull master image
+ command: >
+ docker pull {{ openshift.master.master_image }}
+ when: openshift.common.is_containerized | bool and openshift.master.master_image not in docker_images.stdout
+
+- name: Wait for master image
+ command: >
+ docker images
+ register: docker_images
+ until: openshift.master.master_image in docker_images.stdout
+ retries: 30
+ delay: 10
+ changed_when: false
+ when: openshift.common.is_containerized | bool
+
+- name: Install Master docker service file
+ template:
+ dest: "/etc/systemd/system/{{ openshift.common.service_type }}-master.service"
+ src: master.docker.service.j2
+ register: install_result
+ when: openshift.common.is_containerized | bool and not openshift_master_ha | bool
+
+- name: Create openshift.common.data_dir
+ file:
+ path: "{{ openshift.common.data_dir }}"
+ state: directory
+ mode: 0755
+ owner: root
+ group: root
+ when: openshift.common.is_containerized | bool
+
+- name: Reload systemd units
+ command: systemctl daemon-reload
+ when: openshift.common.is_containerized | bool and install_result | changed
- name: Re-gather package dependent master facts
openshift_facts:
@@ -111,7 +157,8 @@
- name: Install httpd-tools if needed
action: "{{ ansible_pkg_mgr }} name=httpd-tools state=present"
- when: (item.kind == 'HTPasswdPasswordIdentityProvider')
+ when: (item.kind == 'HTPasswdPasswordIdentityProvider') and
+ not openshift.common.is_atomic | bool
with_items: openshift.master.identity_providers
- name: Ensure htpasswd directory exists
@@ -130,16 +177,27 @@
when: item.kind == 'HTPasswdPasswordIdentityProvider'
with_items: openshift.master.identity_providers
+- name: Init HA Service Info
+ set_fact:
+ ha_suffix: ""
+ ha_svcdir: "/usr/lib/systemd/system"
+
+- name: Set HA Service Info for containerized installs
+ set_fact:
+ ha_suffix: ".docker"
+ ha_svcdir: "/etc/systemd/system"
+ when: openshift.common.is_containerized | bool
+
# workaround for missing systemd unit files for controllers/api
- name: Create the api service file
template:
- src: atomic-openshift-master-api.service.j2
- dest: /usr/lib/systemd/system/{{ openshift.common.service_type }}-master-api.service
+ src: atomic-openshift-master-api{{ ha_suffix }}.service.j2
+ dest: "{{ ha_svcdir }}/{{ openshift.common.service_type }}-master-api.service"
when: openshift_master_ha | bool and openshift_master_cluster_method == "native"
- name: Create the controllers service file
template:
- src: atomic-openshift-master-controllers.service.j2
- dest: /usr/lib/systemd/system/{{ openshift.common.service_type }}-master-controllers.service
+ src: atomic-openshift-master-controllers{{ ha_suffix }}.service.j2
+ dest: "{{ ha_svcdir }}/{{ openshift.common.service_type }}-master-controllers.service"
when: openshift_master_ha | bool and openshift_master_cluster_method == "native"
- name: Create the api env file
template:
@@ -227,6 +285,10 @@
when: not openshift_master_ha | bool
register: start_result
+- 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
+
- set_fact:
master_service_status_changed: start_result | changed
when: not openshift_master_ha | bool
@@ -252,11 +314,13 @@
- name: Install cluster packages
action: "{{ ansible_pkg_mgr }} name=pcs state=present"
when: openshift_master_ha | bool and openshift.master.cluster_method == 'pacemaker'
+ and not openshift.common.is_containerized | bool
register: install_result
- name: Start and enable cluster service
service: name=pcsd enabled=yes state=started
when: openshift_master_ha | bool and openshift.master.cluster_method == 'pacemaker'
+ and not openshift.common.is_containerized | bool
- name: Set the cluster user password
shell: echo {{ openshift_master_cluster_password | quote }} | passwd --stdin hacluster
@@ -264,6 +328,7 @@
- name: Lookup default group for ansible_ssh_user
command: "/usr/bin/id -g {{ ansible_ssh_user }}"
+ changed_when: false
register: _ansible_ssh_user_gid
- name: Create the client config dir(s)