summaryrefslogtreecommitdiffstats
path: root/roles/openshift_master
diff options
context:
space:
mode:
authorRussell Teague <rteague@redhat.com>2016-11-18 14:26:02 -0500
committerRussell Teague <rteague@redhat.com>2016-11-28 11:11:44 -0500
commitec9c22ca6a376b7d1139a384dcb78f3f5bb5b607 (patch)
treea8c3897b9765b9b6dc02582a851b704be8f0828e /roles/openshift_master
parentb45db4c7e0b278623f7531cee50127aa24686139 (diff)
downloadopenshift-ec9c22ca6a376b7d1139a384dcb78f3f5bb5b607.tar.gz
openshift-ec9c22ca6a376b7d1139a384dcb78f3f5bb5b607.tar.bz2
openshift-ec9c22ca6a376b7d1139a384dcb78f3f5bb5b607.tar.xz
openshift-ec9c22ca6a376b7d1139a384dcb78f3f5bb5b607.zip
Refactored to use Ansible systemd module
* Ansible systemd module used in place of service module * Refactored command tasks which are no longer necessary * Applying rules from openshift-ansible Best Practices Guide
Diffstat (limited to 'roles/openshift_master')
-rw-r--r--roles/openshift_master/README.md3
-rw-r--r--roles/openshift_master/handlers/main.yml6
-rw-r--r--roles/openshift_master/meta/main.yml2
-rw-r--r--roles/openshift_master/tasks/main.yml64
4 files changed, 42 insertions, 33 deletions
diff --git a/roles/openshift_master/README.md b/roles/openshift_master/README.md
index 663ac08b8..c3300a7ef 100644
--- a/roles/openshift_master/README.md
+++ b/roles/openshift_master/README.md
@@ -6,7 +6,8 @@ Master service installation
Requirements
------------
-A RHEL 7.1 host pre-configured with access to the rhel-7-server-rpms,
+* Ansible 2.2
+* A RHEL 7.1 host pre-configured with access to the rhel-7-server-rpms,
rhel-7-server-extras-rpms, and rhel-7-server-ose-3.0-rpms repos.
Role Variables
diff --git a/roles/openshift_master/handlers/main.yml b/roles/openshift_master/handlers/main.yml
index e119db1a2..69c5a1663 100644
--- a/roles/openshift_master/handlers/main.yml
+++ b/roles/openshift_master/handlers/main.yml
@@ -1,16 +1,16 @@
---
- name: restart master
- service: name={{ openshift.common.service_type }}-master state=restarted
+ systemd: name={{ openshift.common.service_type }}-master state=restarted
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
- service: name={{ openshift.common.service_type }}-master-api state=restarted
+ 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
- service: name={{ openshift.common.service_type }}-master-controllers state=restarted
+ 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
diff --git a/roles/openshift_master/meta/main.yml b/roles/openshift_master/meta/main.yml
index a2f665702..7457e4378 100644
--- a/roles/openshift_master/meta/main.yml
+++ b/roles/openshift_master/meta/main.yml
@@ -4,7 +4,7 @@ galaxy_info:
description: Master
company: Red Hat, Inc.
license: Apache License, Version 2.0
- min_ansible_version: 2.1
+ min_ansible_version: 2.2
platforms:
- name: EL
versions:
diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml
index 79c62e985..2de5cd3f3 100644
--- a/roles/openshift_master/tasks/main.yml
+++ b/roles/openshift_master/tasks/main.yml
@@ -64,9 +64,9 @@
args:
creates: "{{ openshift_master_policy }}"
notify:
- - restart master
- - restart master api
- - restart master controllers
+ - restart master
+ - restart master api
+ - restart master controllers
- name: Create the scheduler config
copy:
@@ -74,9 +74,9 @@
dest: "{{ openshift_master_scheduler_conf }}"
backup: true
notify:
- - restart master
- - restart master api
- - restart master controllers
+ - restart master
+ - restart master api
+ - restart master controllers
- name: Install httpd-tools if needed
package: name=httpd-tools state=present
@@ -147,8 +147,8 @@
mode: 0600
when: openshift.master.session_auth_secrets is defined and openshift.master.session_encryption_secrets is defined
notify:
- - restart master
- - restart master api
+ - restart master
+ - restart master api
- set_fact:
translated_identity_providers: "{{ openshift.master.identity_providers | translate_idps('v1', openshift.common.version, openshift.common.deployment_type) }}"
@@ -163,9 +163,9 @@
group: root
mode: 0600
notify:
- - restart master
- - restart master api
- - restart master controllers
+ - restart master
+ - restart master api
+ - restart master controllers
- include: set_loopback_context.yml
when: openshift.common.version_gte_3_2_or_1_2
@@ -179,7 +179,10 @@
# https://github.com/openshift/origin/issues/6065
# https://github.com/openshift/origin/issues/6447
- name: Start and enable master
- service: name={{ openshift.common.service_type }}-master enabled=yes state=started
+ systemd:
+ name: "{{ openshift.common.service_type }}-master"
+ enabled: yes
+ state: started
when: not openshift_master_ha | bool
register: start_result
until: not start_result | failed
@@ -187,29 +190,30 @@
delay: 60
notify: Verify API Server
-- name: Check for non-HA master service presence
- command: systemctl show {{ openshift.common.service_type }}-master.service
- register: master_svc_show
- changed_when: false
- failed_when: false
-
- name: Stop and disable non-HA master when running HA
- service:
+ systemd:
name: "{{ openshift.common.service_type }}-master"
enabled: no
state: stopped
- when: openshift_master_ha | bool and master_svc_show.rc == 0 and 'LoadState=not-found' not in master_svc_show.stdout
+ when: openshift_master_ha | bool
+ register: task_result
+ failed_when: "task_result|failed and 'could not' not in task_result.msg|lower"
- set_fact:
master_service_status_changed: "{{ start_result | changed }}"
when: not openshift_master_ha | bool
- name: Mask master service
- command: systemctl mask {{ openshift.common.service_type }}-master
- when: openshift_master_ha | bool and openshift.master.cluster_method == 'native' and not openshift.common.is_containerized | bool
+ systemd:
+ name: "{{ openshift.common.service_type }}-master"
+ masked: yes
+ when: >
+ openshift_master_ha | bool and
+ openshift.master.cluster_method == 'native' and
+ not openshift.common.is_containerized | bool
- name: Start and enable master api on first master
- service:
+ systemd:
name: "{{ openshift.common.service_type }}-master-api"
enabled: yes
state: started
@@ -228,7 +232,7 @@
when: openshift_master_ha | bool and openshift.master.cluster_method == 'native'
- name: Start and enable master api all masters
- service:
+ systemd:
name: "{{ openshift.common.service_type }}-master-api"
enabled: yes
state: started
@@ -264,7 +268,7 @@
when: openshift_master_ha | bool and openshift.master.cluster_method == 'native' and master_api_service_status_changed | bool
- name: Start and enable master controller on first master
- service:
+ systemd:
name: "{{ openshift.common.service_type }}-master-controllers"
enabled: yes
state: started
@@ -274,12 +278,13 @@
retries: 1
delay: 60
-- pause:
+- name: Wait for master controller service to start on first master
+ pause:
seconds: 15
when: openshift_master_ha | bool and openshift.master.cluster_method == 'native'
- name: Start and enable master controller on all masters
- service:
+ systemd:
name: "{{ openshift.common.service_type }}-master-controllers"
enabled: yes
state: started
@@ -300,7 +305,10 @@
register: install_result
- name: Start and enable cluster service
- service: name=pcsd enabled=yes state=started
+ systemd:
+ name: pcsd
+ enabled: yes
+ state: started
when: openshift_master_ha | bool and openshift.master.cluster_method == 'pacemaker'
and not openshift.common.is_containerized | bool