forked from waynedovey/ocp4-vsphere-upi-automation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-ocp-vsphere.yml
129 lines (111 loc) · 4.35 KB
/
setup-ocp-vsphere.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
- hosts: localhost
vars:
masterContent: "{{ lookup('file', '{{ playbook_dir }}/install-dir/master.64' )}}"
workerContent: "{{ lookup('file', '{{ playbook_dir }}/install-dir/worker.64' )}}"
appendBootstrapContent: "{{ lookup('file', '{{ playbook_dir }}/install-dir/append-bootstrap.64' )}}"
govc_file: "/usr/local/bin/govc"
tasks:
- name: VMWARE_PREP 1.0 | Create bin, install-dir and downloads folders
file:
path: "{{ playbook_dir }}/{{ item }}"
state: directory
mode: '0755'
with_items: ["bin", "downloads", "install-dir"]
tags:
- "1"
- name: VMWARE_PREP 2.0 | Download the latest RHCOS OVA file
get_url:
url: "{{ download.ova_image }}"
dest: "{{ playbook_dir }}/downloads/{{ templateName }}.ova"
tags:
- "2"
- name: VMWARE_PREP 2.1 | Upload the latest RHCOS OVA file to VMWare
command: "{{ govc_file }} import.ova -name={{ templateName }} {{ playbook_dir }}/downloads/{{ templateName }}.ova "
environment:
GOVC_URL: "{{ vcenter.ip }}"
GOVC_USERNAME: "{{ vcenter.username }}"
GOVC_PASSWORD: "{{ vcenter.password }}"
GOVC_INSECURE: 1
GOVC_DATASTORE: "{{ vcenter.datastore }}"
GOVC_DATACENTER: "{{ vcenter.datacenter }}"
GOVC_CLUSTER: "{{ vcenter.cluster }}"
GOVC_NETWORK: "{{ vcenter.vm_network_1 }}"
ignore_errors: yes
tags:
- "2"
- name: VMWARE_PREP 3.0 | Unarchive oc client
unarchive:
src: "{{ download.oc_client }}"
dest: "{{ playbook_dir }}/bin"
remote_src: yes
tags:
- "3"
- name: VMWARE_PREP 4.0 | Unarchive openshift-install
unarchive:
src: "{{ download.openshift_install }}"
dest: "{{ playbook_dir }}/bin"
remote_src: yes
tags:
- "4"
- name: VMWARE_PREP 5.0 | Copy install-config.yaml file into install-dir
template:
src: "{{ playbook_dir }}/templates/install-config.yaml.j2"
dest: "{{ playbook_dir }}/install-dir/install-config.yaml"
tags:
- "5"
- name: VMWARE_PREP 6.0 | Backup the install-config.yaml file
copy:
src: "{{ playbook_dir }}/install-dir/install-config.yaml"
dest: "{{ playbook_dir }}/install-dir/install-config.yaml.orig"
tags:
- "6"
- name: VMWARE_PREP 7.0 | Generate the ignition manifests
command: "{{ playbook_dir }}/bin/openshift-install create manifests --dir={{ playbook_dir }}/install-dir"
tags:
- "7"
- name: VMWARE_PREP 8.0 | Apply the patch to set mastersSchedulable to false
patch:
src: "{{ playbook_dir }}/patches/cluster-scheduler-02-config.yml.patch"
dest: "{{ playbook_dir }}/install-dir/manifests/cluster-scheduler-02-config.yml"
tags:
- "8"
- name: VMWARE_PREP 9.0 | Generate the ignition configs
command: "{{ playbook_dir }}/bin/openshift-install create ignition-configs --dir={{ playbook_dir }}/install-dir"
tags:
- "9"
- name: VMWARE_PREP 10.0 | Copy append-bootstrap.ign file into install-dir
template:
src: "{{ playbook_dir }}/templates/append-bootstrap.ign.j2"
dest: "{{ playbook_dir }}/install-dir/append-bootstrap.ign"
tags:
- "10"
- name: VMWARE_PREP 11.0 | Get base64 version of append-bootstrap.ign
shell: "base64 -w0 {{ playbook_dir }}/install-dir/append-bootstrap.ign > {{ playbook_dir }}/install-dir/append-bootstrap.64"
tags:
- "11"
- name: VMWARE_PREP 11.1 | Get base64 version of master.ign
shell: "base64 -w0 {{ playbook_dir }}/install-dir/master.ign > {{ playbook_dir }}/install-dir/master.64"
tags:
- "11"
- name: VMWARE_PREP 11.2 | Get base64 version of worker.ign
shell: "base64 -w0 {{ playbook_dir }}/install-dir/worker.ign > {{ playbook_dir }}/install-dir/worker.64"
tags:
- "11"
- name: VMWARE_PREP 12.0 | Get master VM parameters
template:
src: "{{ playbook_dir }}/templates/master-vm-param.j2"
dest: "{{ playbook_dir }}/install-dir/master-vm-param.txt"
tags:
- "12"
- name: VMWARE_PREP 12.1 | Get worker VM parameters
template:
src: "{{ playbook_dir }}/templates/worker-vm-param.j2"
dest: "{{ playbook_dir }}/install-dir/worker-vm-param.txt"
tags:
- "12"
- name: VMWARE_PREP 13.0 | Get the append parameters
template:
src: "{{ playbook_dir }}/templates/append-bootstrap-vm-param.j2"
dest: "{{ playbook_dir }}/install-dir/append-bootstrap-vm-param.txt"
tags:
- "13"