-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_new_hosts.yml
132 lines (112 loc) · 3.66 KB
/
build_new_hosts.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
131
132
---
- hosts: utility
gather_facts: true
tasks:
- name: Create files directory if needed
file:
path: "{{files_dir}}"
state: directory
- name: Set up ignition fragment list
set_fact:
additional_ignition_fragments: []
- name: Create TLS CA initrd
include_tasks: "include/tls_ignition_patch.yaml"
when: tls_additional_cas
- name: Create disk wiping initrd
include_tasks: "include/wipe_disks_patch.yaml"
when: wipe_disks == true
- name: Create installer customization ignition
include_tasks: "include/installer_customization_patch.yaml"
when: enable_kargs_in_dest == true and source_urls.rhcos_image is defined
- name: Compile combined ignition
include_tasks: "include/create_live_ignition.yaml"
when: additional_ignition_fragments
- name: Create per-cluster webroot
file:
path: "/var/www/html/{{cluster_name}}"
state: directory
owner: apache
group: apache
become: true
- name: Fetch RHCOS ISO
get_url:
url: "{{source_urls['rhcos_live_iso']}}"
dest: "{{files_dir}}/rhcos-base.iso"
environment:
http_proxy: "{{proxy_url|default(omit)}}"
https_proxy: "{{proxy_url|default(omit)}}"
- name: Extract RHCOS ISO if needed(Podman)
shell:
#!/bin/bash
podman run \
--security-opt label=disable \
--rm \
-v {{files_dir}}:/data \
-w /data {{coreos_installer_image}} \
iso extract minimal-iso \
--output-rootfs rhcos-rootfs.img \
rhcos-base.iso \
rhcos-minimal.iso
chmod 666 {{files_dir}}/rhcos-minimal.iso
become: true
when: source_urls.rhcos_image is not defined
- name: Fetch RHCOS Root FS if needed
get_url:
url: "{{source_urls['rhcos_image']}}"
dest: "{{files_dir}}/rhcos-rootfs.img"
environment:
http_proxy: "{{proxy_url|default(omit)}}"
https_proxy: "{{proxy_url|default(omit)}}"
when: source_urls.rhcos_image is defined
- name: Symlink rhcos-minimal.iso for pre-4.10
file:
state: link
src: "{{files_dir}}/rhcos-base.iso"
path: "{{files_dir}}/rhcos-minimal.iso"
when: source_urls.rhcos_image is defined
- name: Copy RHCOS Root FS
copy:
src: "{{files_dir}}/rhcos-rootfs.img"
dest: /var/www/html/{{cluster_name}}/rhcos-rootfs.img
owner: apache
group: apache
become: true
- hosts: openshift_nodes
gather_facts: false
tasks:
- name: Gather node information
include_tasks: "include/gather_{{pm_type}}_facts.yaml"
when: provision == true
- name: Build ISO
include_tasks: include/coreos_build_iso.yaml
when: provision == true
- hosts: utility
gather_facts: true
tasks:
- name: Copy ignition files
shell: "cp {{installer_dir}}/*.ign /var/www/html/{{cluster_name}} && chown apache:apache /var/www/html/{{cluster_name}}/*.ign"
become: true
- name: Upload ISOs
copy:
src: "{{iso_tmp_dir}}/ocp-iso-build/isos"
dest: /var/www/html/{{cluster_name}}/boot-isos
owner: apache
group: apache
become: true
- hosts: openshift_nodes
gather_facts: false
tasks:
- name: Boot nodes
include_tasks: "include/boot_{{pm_type}}.yaml"
when: provision == true
- hosts: openshift_nodes
gather_facts: false
tasks:
- name: Do post-install node cleanup
include_tasks: "include/cleanup_{{pm_type}}.yaml"
when: provision == true
- hosts: utility
gather_facts: true
tasks:
- name: Clean up utilty host
include_tasks: "include/cleanup_utility.yaml"