-
Notifications
You must be signed in to change notification settings - Fork 39
/
20_prepare_ocp_install.yml
104 lines (89 loc) · 3.75 KB
/
20_prepare_ocp_install.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
---
- name: Install config
hosts: bastion
vars_files:
- vars/cluster_vars.yml
tasks:
- name: Removing config directory
ansible.builtin.file:
path: "{{ workspace_directory.base_path }}/{{ cluster.name }}/{{ workspace_directory.config_dir }}"
state: absent
become: true
- name: Creating config directory
ansible.builtin.file:
path: "{{ workspace_directory.base_path }}/{{ cluster.name }}/{{ workspace_directory.config_dir }}"
state: directory
mode: "0755"
- name: Getting ssh public key
ansible.builtin.slurp:
src: ~/.ssh/id_rsa.pub
register: key
- name: Save SSH key as fact
ansible.builtin.set_fact:
sshkey: "{{ key['content'] | b64decode }}"
- name: Firing up install-config.yaml
ansible.builtin.template:
src: templates/install-config.j2
dest: "{{ workspace_directory.base_path }}/{{ cluster.name }}/{{ workspace_directory.config_dir }}/install-config.yaml"
mode: "0755"
- name: Create backup dir
ansible.builtin.file:
state: directory
path: /tmp/ocpinstall
mode: "0755"
- name: Backup install directory
ansible.builtin.copy:
src: "{{ workspace_directory.base_path }}/{{ cluster.name }}/{{ workspace_directory.config_dir }}"
dest: /tmp/ocpinstall
remote_src: true
mode: "0755"
- name: Creating ignition manifest # noqa command-instead-of-shell no-changed-when
ansible.builtin.shell: openshift-install create manifests --dir {{ workspace_directory.base_path }}/{{ cluster.name }}/{{ workspace_directory.config_dir }} # noqa yaml[line-length]
- name: Setting master unschedulable
ansible.builtin.lineinfile:
path: "{{ workspace_directory.base_path }}/{{ cluster.name }}/{{ workspace_directory.config_dir }}/manifests/cluster-scheduler-02-config.yml"
regexp: " mastersSchedulable"
line: " mastersSchedulable: False"
when:
- not three_node
- hostvars['bastion'].version.1 | int > 1
- name: Backup install directory
ansible.builtin.copy:
src: "{{ workspace_directory.base_path }}/{{ cluster.name }}/{{ workspace_directory.config_dir }}"
dest: /tmp/ocpinstall
remote_src: true
mode: "0755"
- name: Creating ignition files # noqa command-instead-of-shell yaml[line-length] no-changed-when
ansible.builtin.shell: openshift-install create ignition-configs --dir {{ workspace_directory.base_path }}/{{ cluster.name }}/{{ workspace_directory.config_dir }} # noqa yaml[line-length]
- name: Backup install directory
ansible.builtin.copy:
src: "{{ workspace_directory.base_path }}/{{ cluster.name }}/{{ workspace_directory.config_dir }}"
dest: /tmp/ocpinstall
remote_src: true
mode: "0755"
- name: Copying ignition files to webserver
ansible.builtin.copy:
src: "{{ workspace_directory.base_path }}/{{ cluster.name }}/{{ workspace_directory.config_dir }}/{{ item }}"
dest: "{{ nginx_document_root }}/{{ nginx_workspace_dir }}"
remote_src: true
mode: "0644"
loop:
- bootstrap.ign
- master.ign
- worker.ign
become: true
- name: Restart nginx
ansible.builtin.service:
name: nginx
state: restarted
become: true
- name: Creating csr approver script
ansible.builtin.template:
src: templates/csr.j2
dest: "{{ workspace_directory.base_path }}/{{ cluster.name }}/csr.sh"
mode: "0755"
- name: Installing csr cronjob
ansible.builtin.cron:
name: "Openshift csr approver"
job: "{{ workspace_directory.base_path }}/{{ cluster.name }}/csr.sh >> /tmp/aJob.log 2>&1"
state: present