commit | author | age
|
2fcfc6
|
1 |
--- |
93757c
|
2 |
- name: Check if Elasticsearch Operator is already installed |
2fcfc6
|
3 |
k8s_facts: |
93757c
|
4 |
api_version: v1 |
WK |
5 |
kind: Deployment |
|
6 |
namespace: "openshift-operators-redhat" |
|
7 |
name: "elasticsearch-operator" |
|
8 |
register: r_eo_deployment_exists |
2fcfc6
|
9 |
|
93757c
|
10 |
- name: Install Elasticsearch Operator if not installed |
WK |
11 |
when: r_eo_deployment_exists.resources | length | int == 0 |
7e2e95
|
12 |
block: |
93757c
|
13 |
- name: Get current stable version of Elasticsearch |
WK |
14 |
shell: "oc get packagemanifest elasticsearch-operator -n openshift-marketplace -o jsonpath='{.status.defaultChannel}'" |
|
15 |
register: r_eo_version |
|
16 |
|
|
17 |
- name: Print Elasticsearch version to be installed |
|
18 |
debug: |
|
19 |
msg: "Elasticsearch version to be installed: {{ r_eo_version.stdout }}" |
|
20 |
|
|
21 |
- name: Install Elasticsearch operator prerequisites |
7e2e95
|
22 |
k8s: |
WK |
23 |
state: present |
93757c
|
24 |
definition: "{{ lookup('file', item ) | from_yaml }}" |
7e2e95
|
25 |
loop: |
93757c
|
26 |
- ./files/eo_namespace.yaml |
WK |
27 |
- ./files/eo_operatorgroup.yaml |
|
28 |
- ./files/eo_role.yaml |
|
29 |
- ./files/eo_rolebinding.yaml |
7e2e95
|
30 |
|
93757c
|
31 |
- name: Install Elasticsearch operator |
WK |
32 |
k8s: |
|
33 |
state: present |
|
34 |
definition: "{{ lookup('template', item ) | from_yaml }}" |
|
35 |
loop: |
|
36 |
- ./templates/eo_subscription.j2 |
|
37 |
|
|
38 |
- name: Wait for Elasticsearch operator to be ready |
d37c16
|
39 |
k8s_facts: |
93757c
|
40 |
api_version: v1 |
WK |
41 |
kind: Deployment |
|
42 |
namespace: "openshift-operators-redhat" |
|
43 |
name: "elasticsearch-operator" |
|
44 |
register: r_eo_deployment |
d37c16
|
45 |
retries: 30 |
7e2e95
|
46 |
delay: 10 |
93757c
|
47 |
until: |
WK |
48 |
- r_eo_deployment.resources | length | int > 0 |
|
49 |
- r_eo_deployment.resources[0].status.availableReplicas is defined |
|
50 |
- r_eo_deployment.resources[0].status.availableReplicas | int == r_eo_deployment.resources[0].spec.replicas | int |
2fcfc6
|
51 |
|
93757c
|
52 |
- name: Get current stable version of Cluster Logging |
WK |
53 |
shell: "oc get packagemanifest cluster-logging -n openshift-marketplace -o jsonpath='{.status.defaultChannel}'" |
|
54 |
register: r_logging_version |
|
55 |
|
|
56 |
- name: Print Cluster Logging version to be installed |
|
57 |
debug: |
|
58 |
msg: "Cluster Logging version to be installed: {{ r_logging_version.stdout }}" |
|
59 |
|
|
60 |
- name: Install OpenShift Logging Operator Prerequisites |
|
61 |
k8s: |
|
62 |
state: present |
|
63 |
definition: "{{ lookup('file', item ) | from_yaml }}" |
|
64 |
loop: |
|
65 |
- ./files/logging_namespace.yaml |
|
66 |
- ./files/logging_operatorgroup.yaml |
|
67 |
- ./files/logging_curator_configmap.yaml |
|
68 |
|
|
69 |
- name: Install OpenShift Logging Operator |
|
70 |
k8s: |
|
71 |
state: present |
|
72 |
definition: "{{ lookup('template', item ) | from_yaml }}" |
|
73 |
loop: |
|
74 |
- ./templates/logging_subscription.j2 |
|
75 |
|
|
76 |
- name: Wait for Cluster Logging Operator to be ready |
|
77 |
k8s_facts: |
|
78 |
api_version: v1 |
|
79 |
kind: Deployment |
|
80 |
namespace: "openshift-logging" |
|
81 |
name: "cluster-logging-operator" |
|
82 |
register: r_logging_deployment |
|
83 |
retries: 30 |
|
84 |
delay: 10 |
|
85 |
until: |
|
86 |
- r_logging_deployment.resources | length | int > 0 |
|
87 |
- r_logging_deployment.resources[0].status.availableReplicas is defined |
|
88 |
- r_logging_deployment.resources[0].status.availableReplicas | int == r_logging_deployment.resources[0].spec.replicas | int |
|
89 |
|
|
90 |
- name: Create OpenShift ClusterLogging |
|
91 |
k8s: |
|
92 |
state: present |
|
93 |
definition: "{{ lookup('template', item ) | from_yaml }}" |
|
94 |
loop: |
|
95 |
- ./templates/cluster_logging.j2 |
|
96 |
|
|
97 |
- name: Wait until Elasticsearch cluster status is green |
|
98 |
k8s_facts: |
|
99 |
api_version: logging.openshift.io/v1 |
|
100 |
kind: ClusterLogging |
|
101 |
name: instance |
|
102 |
namespace: openshift-logging |
|
103 |
register: r_logging |
|
104 |
retries: 30 |
|
105 |
delay: 10 |
|
106 |
ignore_errors: yes |
|
107 |
until: |
|
108 |
- r_logging.resources[0].status.logStore.elasticsearchStatus[0].cluster.status is defined |
|
109 |
- r_logging.resources[0].status.logStore.elasticsearchStatus[0].cluster.status == "green" |
336781
|
110 |
|
2fcfc6
|
111 |
# Leave this as the last task in the playbook. |
EMJ |
112 |
- name: workload tasks complete |
|
113 |
debug: |
|
114 |
msg: "Workload Tasks completed successfully." |
95986a
|
115 |
when: not silent|bool |