/
static.yml
120 lines (108 loc) · 3.29 KB
/
static.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
---
- name: Enable bootstrapping in the master config
yedit:
src: /etc/origin/master/master-config.yaml
edits:
- key: kubernetesMasterConfig.controllerArguments.cluster-signing-cert-file
value:
- /etc/origin/master/ca.crt
- key: kubernetesMasterConfig.controllerArguments.cluster-signing-key-file
value:
- /etc/origin/master/ca.key
when:
- openshift_control_plane_apply_cluster_signing_config | default(True)
- name: Create temp directory for static pods
command: mktemp -d /tmp/openshift-ansible-XXXXXX
register: mktemp
changed_when: false
- name: Prepare master static pods
copy:
src: "{{ item }}"
dest: "{{ mktemp.stdout }}"
mode: 0600
with_items:
- apiserver.yaml
- controller.yaml
- name: Update master static pods
yedit:
src: "{{ mktemp.stdout }}/{{ item }}"
edits:
- key: spec.containers[0].image
value: "{{ osm_image }}"
with_items:
- apiserver.yaml
- controller.yaml
- name: Update master static pod (api)
yedit:
src: "{{ mktemp.stdout }}/apiserver.yaml"
edits:
- key: spec.containers[0].livenessProbe.httpGet.port
value: "{{ openshift_master_api_port }}"
- key: spec.containers[0].readinessProbe.httpGet.port
value: "{{ openshift_master_api_port }}"
- name: ensure kubelet plugins dir exists
file:
path: "/etc/origin/kubelet-plugins"
state: directory
mode: "0755"
when: openshift_is_atomic | bool
- name: Update controller-manager static pod on atomic host
yedit:
src: "{{ mktemp.stdout }}/controller.yaml"
edits:
- key: spec.volumes[3].hostPath.path
value: "/etc/origin/kubelet-plugins"
- key: spec.containers[0].volumeMounts[3].mountPath
value: "/etc/origin/kubelet-plugins"
when: openshift_is_atomic | bool
- name: Add audit volume to master static pod (api)
yedit:
src: "{{ mktemp.stdout }}/apiserver.yaml"
append: true
key: spec.volumes
value:
name: audit-logs
hostPath:
path: "/var/log/origin"
when:
- openshift.master.audit_config is defined
- openshift.master.audit_config.auditFilePath is defined
- '"/var/log/origin" in openshift.master.audit_config.auditFilePath'
- name: Add audit volumeMounts to master static pod (api)
yedit:
src: "{{ mktemp.stdout }}/apiserver.yaml"
append: true
key: spec.containers[0].volumeMounts
value:
mountPath: "/var/log/origin"
name: audit-logs
when:
- openshift.master.audit_config is defined
- openshift.master.audit_config.auditFilePath is defined
- '"/var/log/origin" in openshift.master.audit_config.auditFilePath'
- name: ensure pod location exists
file:
path: "{{ openshift_control_plane_static_pod_location }}"
state: directory
mode: "0755"
- name: Update master static pods
copy:
remote_src: true
src: "{{ mktemp.stdout }}/{{ item }}"
dest: "{{ openshift_control_plane_static_pod_location }}"
mode: 0600
with_items:
- apiserver.yaml
- controller.yaml
- name: Remove old files in /etc/sysconfig
file:
name: "{{ item }}"
state: absent
with_items:
- /etc/sysconfig/{{ openshift_service_type }}-master-api
- /etc/sysconfig/{{ openshift_service_type }}-master-controllers
- name: Remove temporary directory
file:
name: "{{ mktemp.stdout }}"
state: absent
changed_when: False