summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/etcd/defaults/main.yaml4
-rw-r--r--roles/etcd/tasks/main.yml8
-rw-r--r--roles/etcd/tasks/restart.yml21
-rw-r--r--roles/etcd/tasks/version_detect.yml55
-rw-r--r--roles/installer_checkpoint/callback_plugins/installer_checkpoint.py4
-rw-r--r--roles/openshift_prometheus/tasks/install_prometheus.yaml22
-rw-r--r--roles/openshift_prometheus/tasks/main.yaml6
-rw-r--r--roles/openshift_prometheus/tasks/uninstall_prometheus.yaml7
8 files changed, 107 insertions, 20 deletions
diff --git a/roles/etcd/defaults/main.yaml b/roles/etcd/defaults/main.yaml
index 9a3652a2b..a069e4d87 100644
--- a/roles/etcd/defaults/main.yaml
+++ b/roles/etcd/defaults/main.yaml
@@ -2,8 +2,10 @@
r_etcd_common_backup_tag: ''
r_etcd_common_backup_sufix_name: ''
+l_is_etcd_system_container: "{{ (openshift_use_etcd_system_container | default(openshift_use_system_containers | default(false)) | bool) }}"
+
# runc, docker, host
-r_etcd_common_etcd_runtime: "docker"
+r_etcd_common_etcd_runtime: "{{ 'runc' if l_is_etcd_system_container else 'docker' if l_is_containerized else 'host' }}"
r_etcd_common_embedded_etcd: false
osm_etcd_image: 'registry.access.redhat.com/rhel7/etcd'
diff --git a/roles/etcd/tasks/main.yml b/roles/etcd/tasks/main.yml
index fabe66b91..78ec2cedb 100644
--- a/roles/etcd/tasks/main.yml
+++ b/roles/etcd/tasks/main.yml
@@ -30,7 +30,7 @@
src: etcd.docker.service
when:
- etcd_is_containerized | bool
- - not openshift.common.is_etcd_system_container | bool
+ - not l_is_etcd_system_container | bool
# Start secondary etcd instance for third party integrations
# TODO: Determine an alternative to using thirdparty variable
@@ -90,7 +90,7 @@
enabled: no
masked: yes
daemon_reload: yes
- when: not openshift.common.is_etcd_system_container | bool
+ when: not l_is_etcd_system_container | bool
register: task_result
failed_when: task_result|failed and 'could not' not in task_result.msg|lower
@@ -98,11 +98,11 @@
template:
dest: "/etc/systemd/system/etcd_container.service"
src: etcd.docker.service
- when: not openshift.common.is_etcd_system_container | bool
+ when: not l_is_etcd_system_container | bool
- name: Install Etcd system container
include: system_container.yml
- when: openshift.common.is_etcd_system_container | bool
+ when: l_is_etcd_system_container | bool
when: etcd_is_containerized | bool
- name: Validate permissions on the config dir
diff --git a/roles/etcd/tasks/restart.yml b/roles/etcd/tasks/restart.yml
new file mode 100644
index 000000000..d4a016eec
--- /dev/null
+++ b/roles/etcd/tasks/restart.yml
@@ -0,0 +1,21 @@
+---
+
+- name: restart etcd
+ service:
+ name: "{{ etcd_service }}"
+ state: restarted
+ when:
+ - not g_etcd_certificates_expired | default(false) | bool
+
+- name: stop etcd
+ service:
+ name: "{{ etcd_service }}"
+ state: stopped
+ when:
+ - g_etcd_certificates_expired | default(false) | bool
+- name: start etcd
+ service:
+ name: "{{ etcd_service }}"
+ state: started
+ when:
+ - g_etcd_certificates_expired | default(false) | bool
diff --git a/roles/etcd/tasks/version_detect.yml b/roles/etcd/tasks/version_detect.yml
new file mode 100644
index 000000000..fe1e418d8
--- /dev/null
+++ b/roles/etcd/tasks/version_detect.yml
@@ -0,0 +1,55 @@
+---
+- block:
+ - name: Record RPM based etcd version
+ command: rpm -qa --qf '%{version}' etcd\*
+ args:
+ warn: no
+ register: etcd_rpm_version
+ failed_when: false
+ # AUDIT:changed_when: `false` because we are only inspecting
+ # state, not manipulating anything
+ changed_when: false
+ - debug:
+ msg: "Etcd rpm version {{ etcd_rpm_version.stdout }} detected"
+ when:
+ - not openshift.common.is_containerized | bool
+
+- block:
+ - name: Record containerized etcd version (docker)
+ command: docker exec etcd_container rpm -qa --qf '%{version}' etcd\*
+ register: etcd_container_version_docker
+ failed_when: false
+ # AUDIT:changed_when: `false` because we are only inspecting
+ # state, not manipulating anything
+ changed_when: false
+ when:
+ - not l_is_etcd_system_container | bool
+
+ # Given a register variables is set even if the whwen condition
+ # is false, we need to set etcd_container_version separately
+ - set_fact:
+ etcd_container_version: "{{ etcd_container_version_docker.stdout }}"
+ when:
+ - not l_is_etcd_system_container | bool
+
+ - name: Record containerized etcd version (runc)
+ command: runc exec etcd rpm -qa --qf '%{version}' etcd\*
+ register: etcd_container_version_runc
+ failed_when: false
+ # AUDIT:changed_when: `false` because we are only inspecting
+ # state, not manipulating anything
+ changed_when: false
+ when:
+ - l_is_etcd_system_container | bool
+
+ # Given a register variables is set even if the whwen condition
+ # is false, we need to set etcd_container_version separately
+ - set_fact:
+ etcd_container_version: "{{ etcd_container_version_runc.stdout }}"
+ when:
+ - l_is_etcd_system_container | bool
+
+ - debug:
+ msg: "Etcd containerized version {{ etcd_container_version }} detected"
+ when:
+ - openshift.common.is_containerized | bool
diff --git a/roles/installer_checkpoint/callback_plugins/installer_checkpoint.py b/roles/installer_checkpoint/callback_plugins/installer_checkpoint.py
index cc080d4b9..3f66ee6f5 100644
--- a/roles/installer_checkpoint/callback_plugins/installer_checkpoint.py
+++ b/roles/installer_checkpoint/callback_plugins/installer_checkpoint.py
@@ -58,7 +58,7 @@ class CallbackModule(CallbackBase):
},
'installer_phase_loadbalancer': {
'title': 'Load balancer Install',
- 'playbook': 'playbooks/byo/openshift-loadbalancer/config.yml'
+ 'playbook': 'playbooks/openshift-loadbalancer/config.yml'
},
'installer_phase_master': {
'title': 'Master Install',
@@ -82,7 +82,7 @@ class CallbackModule(CallbackBase):
},
'installer_phase_metrics': {
'title': 'Metrics Install',
- 'playbook': 'playbooks/byo/openshift-cluster/openshift-metrics.yml'
+ 'playbook': 'playbooks/openshift-metrics/config.yml'
},
'installer_phase_logging': {
'title': 'Logging Install',
diff --git a/roles/openshift_prometheus/tasks/install_prometheus.yaml b/roles/openshift_prometheus/tasks/install_prometheus.yaml
index 21da4bc9d..50736a9ee 100644
--- a/roles/openshift_prometheus/tasks/install_prometheus.yaml
+++ b/roles/openshift_prometheus/tasks/install_prometheus.yaml
@@ -3,7 +3,7 @@
# namespace
- name: Add prometheus project
oc_project:
- state: "{{ state }}"
+ state: present
name: "{{ openshift_prometheus_namespace }}"
node_selector: "{{ openshift_prometheus_node_selector | oo_selector_to_string_list() }}"
description: Prometheus
@@ -11,7 +11,7 @@
# secrets
- name: Set alert and prometheus secrets
oc_secret:
- state: "{{ state }}"
+ state: present
name: "{{ item }}-proxy"
namespace: "{{ openshift_prometheus_namespace }}"
contents:
@@ -24,7 +24,7 @@
# serviceaccount
- name: create prometheus serviceaccount
oc_serviceaccount:
- state: "{{ state }}"
+ state: present
name: prometheus
namespace: "{{ openshift_prometheus_namespace }}"
# TODO add annotations when supproted
@@ -48,7 +48,7 @@
# create clusterrolebinding for prometheus serviceaccount
- name: Set cluster-reader permissions for prometheus
oc_adm_policy_user:
- state: "{{ state }}"
+ state: present
namespace: "{{ openshift_prometheus_namespace }}"
resource_kind: cluster-role
resource_name: cluster-reader
@@ -58,7 +58,7 @@
# TODO join into 1 task with loop
- name: Create prometheus service
oc_service:
- state: "{{ state }}"
+ state: present
name: "{{ item.name }}"
namespace: "{{ openshift_prometheus_namespace }}"
selector:
@@ -76,7 +76,7 @@
- name: Create alerts service
oc_service:
- state: "{{ state }}"
+ state: present
name: "{{ item.name }}"
namespace: "{{ openshift_prometheus_namespace }}"
selector:
@@ -111,7 +111,7 @@
# create prometheus and alerts routes
- name: create prometheus and alerts routes
oc_route:
- state: "{{ state }}"
+ state: present
name: "{{ item.name }}"
namespace: "{{ openshift_prometheus_namespace }}"
service_name: "{{ item.name }}"
@@ -185,7 +185,7 @@
# In prometheus configmap create "additional.rules" section if file exists
- name: Set prometheus configmap
oc_configmap:
- state: "{{ state }}"
+ state: present
name: "prometheus"
namespace: "{{ openshift_prometheus_namespace }}"
from_file:
@@ -196,7 +196,7 @@
- name: Set prometheus configmap
oc_configmap:
- state: "{{ state }}"
+ state: present
name: "prometheus"
namespace: "{{ openshift_prometheus_namespace }}"
from_file:
@@ -212,7 +212,7 @@
- name: Set alertmanager configmap
oc_configmap:
- state: "{{ state }}"
+ state: present
name: "prometheus-alerts"
namespace: "{{ openshift_prometheus_namespace }}"
from_file:
@@ -229,7 +229,7 @@
- name: Set prometheus stateful set
oc_obj:
- state: "{{ state }}"
+ state: present
name: "prometheus"
namespace: "{{ openshift_prometheus_namespace }}"
kind: statefulset
diff --git a/roles/openshift_prometheus/tasks/main.yaml b/roles/openshift_prometheus/tasks/main.yaml
index 5cc9a67eb..a62babaa7 100644
--- a/roles/openshift_prometheus/tasks/main.yaml
+++ b/roles/openshift_prometheus/tasks/main.yaml
@@ -21,8 +21,10 @@
changed_when: False
- include: install_prometheus.yaml
- vars:
- state: "{{ openshift_prometheus_state }}"
+ when: openshift_prometheus_state == 'present'
+
+- include: uninstall_prometheus.yaml
+ when: openshift_prometheus_state == 'absent'
- name: Delete temp directory
file:
diff --git a/roles/openshift_prometheus/tasks/uninstall_prometheus.yaml b/roles/openshift_prometheus/tasks/uninstall_prometheus.yaml
new file mode 100644
index 000000000..d746402db
--- /dev/null
+++ b/roles/openshift_prometheus/tasks/uninstall_prometheus.yaml
@@ -0,0 +1,7 @@
+---
+
+# remove namespace - This will delete all the objects inside the namespace
+- name: Remove prometheus project
+ oc_project:
+ state: absent
+ name: "{{ openshift_prometheus_namespace }}"