-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlogging.yml
130 lines (119 loc) · 3.89 KB
/
logging.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
- hosts: localhost
connection: local
gather_facts: false
vars:
k8s_api_endpoint: https://api.ocp.ltsai.com:6443
k8s_admin_username: kubeadmin
ocp_local_registry: ocp4-registry.ocp.ltsai.com:5000
k8s_validate_certs: false
ocp_local_registry_validate_certs: false
ocp_local_registry_insecure: true
logging_cr:
apiVersion: logging.openshift.io/v1
kind: ClusterLogging
metadata:
name: instance
namespace: openshift-logging
spec:
managementState: Managed
logStore:
type: elasticsearch
elasticsearch:
nodeCount: 3
redundancyPolicy: SingleRedundancy
storage: {}
visualization:
type: kibana
kibana:
replicas: 1
curation:
type: curator
curator:
schedule: 30 3 * * *
collection:
logs:
type: fluentd
fluentd: {}
# Define this in vault.yml
# k8s_admin_password: XXXX
# registry_auth:
# auths:
# my-registry:5000:
# auth: XXX
# registry.redhat.io:
# auth: XXX
vars_files:
- vault.yml
tasks:
- name: Deploy logging
block:
- name: Login to OpenShift
k8s_auth:
username: "{{ k8s_admin_username }}"
password: "{{ k8s_admin_password }}"
host: "{{ k8s_api_endpoint }}"
validate_certs: "{{ k8s_validate_certs | default(false) }} "
register: k8s_auth_results
- name: Disable auto rebooting for MCO
k8s:
definition:
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
metadata:
name: master
spec:
paused: true
api_key: "{{ k8s_auth_results.k8s_auth.api_key }}"
host: "{{ k8s_api_endpoint }}"
validate_certs: "{{ k8s_validate_certs | default(true) }} "
state: present
- name: Mirror operator
include_role:
name: ../roles/mirror-operator
with_items:
- cluster-logging
- elasticsearch-operator
vars:
operator_name: "{{ item }}"
- name: Enable auto rebooting for MCO
k8s:
definition:
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
metadata:
name: master
spec:
paused: false
api_key: "{{ k8s_auth_results.k8s_auth.api_key }}"
host: "{{ k8s_api_endpoint }}"
validate_certs: "{{ k8s_validate_certs | default(true) }} "
state: present
- name: Wait for MCO to be updated
pause:
minutes: 15
- name: Deploy logging CR
include_role:
name: ../roles/deploy-logging
always:
- name: Enable auto rebooting for MCO
k8s:
definition:
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
metadata:
name: master
spec:
paused: false
api_key: "{{ k8s_auth_results.k8s_auth.api_key }}"
host: "{{ k8s_api_endpoint }}"
validate_certs: "{{ k8s_validate_certs | default(true) }} "
state: present
when: k8s_auth_results.failed == false
- name: If login succeeded, try to log out (revoke access token)
k8s_auth:
state: absent
host: "{{ k8s_api_endpoint }}"
api_key: "{{ k8s_auth_results.k8s_auth.api_key }}"
validate_certs: "{{ k8s_validate_certs | default(false) }} "
when: k8s_auth_results.failed == false