-
Notifications
You must be signed in to change notification settings - Fork 39
/
33_patch_nodes.yml
57 lines (48 loc) · 2.18 KB
/
33_patch_nodes.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
---
- name: Patch worker nodes
hosts: bastion
vars_files:
- vars/cluster_vars.yml
tasks:
- name: Patch nodes if needed
when: not three_node
block:
- name: Set fact if infra patching is needed
ansible.builtin.set_fact:
infra_present: false
- name: Set fact if infra patching is needed
ansible.builtin.set_fact:
infra_present: true
when: "'infra' in groups"
- name: Create Infra machine config pools if needed
when: infra_present
block:
- name: Create machine config pool
ansible.builtin.copy:
src: files/machineconfigpool.yml
dest: "{{ workspace_directory.base_path }}/{{ cluster.name }}/machineconfigpool.yml"
mode: "0755"
- name: Creating machine config pool for infra nodes # noqa command-instead-of-shell no-changed-when
ansible.builtin.shell: /usr/bin/oc create -f {{ workspace_directory.base_path }}/{{ cluster.name }}/machineconfigpool.yml --kubeconfig={{ workspace_directory.base_path }}/{{ cluster.name }}/config/auth/kubeconfig # noqa yaml[line-length]
- name: Copy script for node labeling
ansible.builtin.template:
src: templates/label_nodes.j2
dest: /tmp/label_nodes.sh
mode: +x
- name: Applying patch # noqa command-instead-of-shell no-changed-when
ansible.builtin.shell: /tmp/label_nodes.sh
- name: Deleting label node script
ansible.builtin.file:
path: /tmp/label_nodes.sh
state: absent
- name: Set default nodeSelector
ansible.builtin.template:
src: templates/patch_default_selector.j2
dest: /tmp/patch_default_selector.sh
mode: +x
- name: Execute script # noqa command-instead-of-shell no-changed-when
ansible.builtin.shell: /tmp/patch_default_selector.sh
- name: Delete node selector patch
ansible.builtin.file:
path: /tmp/patch_default_selector.sh
state: absent