-
Notifications
You must be signed in to change notification settings - Fork 11
/
14-provision-vm-workers.yml
83 lines (72 loc) · 3.1 KB
/
14-provision-vm-workers.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
---
- name: create symlinks from worker.ign
hosts: services
become: yes
tasks:
- name: make sure ignition configs exist for each worker
file:
path: /var/www/html/{{ item | regex_replace('\..*$') }}.ign
src: /var/www/html/worker.ign
state: link
loop: "{{ groups['ocp_workers'] }}"
- import_playbook: includes/rhcos-preflight.yml
vars:
installer_target: worker1
- import_playbook: includes/rhcos-preflight.yml
vars:
installer_target: worker2
- name: provision the worker1 vm
hosts: hypervisors
become: yes
gather_facts: no
vars:
current_vm_name: worker1
tasks:
- name: set some facts that describe worker1
set_fact:
current_vm_hostname: "{{ vms[current_vm_name].hostname }}"
current_vm_mac: "{{ vms[current_vm_name].mac }}"
current_vm_ipaddr: "{{ vms[current_vm_name].ipaddr }}"
current_vm_netmask: "{{ vms[current_vm_name].netmask | default(vms.global.netmask) }}"
current_vm_dns: "{{ vms[current_vm_name].dns | default(vms.global.dns) }}"
current_vm_gw: "{{ vms[current_vm_name].gw | default(vms.global.gw) }}"
current_vm_tz: "{{ vms[current_vm_name].tz | default(vms.global.tz) }}"
current_vm_mem_gb: "{{ vms[current_vm_name].mem_gb | default(vms.global.mem_gb) }}"
current_vm_ncpus: "{{ vms[current_vm_name].ncpus | default(vms.global.ncpus) }}"
- name: destroy and kill any existing worker1
include_tasks: includes/destroy-and-kill-vm.yml
- name: remove and recreate the worker1 disk image
include_tasks: includes/remove-and-recreate-disk.yml
- name: create and boot worker1
include_tasks: includes/create-and-boot-vm.yml
- name: provision the worker2 vm
hosts: hypervisors
become: yes
gather_facts: no
vars:
current_vm_name: worker2
tasks:
- name: set some facts that describe worker2
set_fact:
current_vm_hostname: "{{ vms[current_vm_name].hostname }}"
current_vm_mac: "{{ vms[current_vm_name].mac }}"
current_vm_ipaddr: "{{ vms[current_vm_name].ipaddr }}"
current_vm_netmask: "{{ vms[current_vm_name].netmask | default(vms.global.netmask) }}"
current_vm_dns: "{{ vms[current_vm_name].dns | default(vms.global.dns) }}"
current_vm_gw: "{{ vms[current_vm_name].gw | default(vms.global.gw) }}"
current_vm_tz: "{{ vms[current_vm_name].tz | default(vms.global.tz) }}"
current_vm_mem_gb: "{{ vms[current_vm_name].mem_gb | default(vms.global.mem_gb) }}"
current_vm_ncpus: "{{ vms[current_vm_name].ncpus | default(vms.global.ncpus) }}"
- name: destroy and kill any existing worker2
include_tasks: includes/destroy-and-kill-vm.yml
- name: remove and recreate the worker2 disk image
include_tasks: includes/remove-and-recreate-disk.yml
- name: create and boot worker2
include_tasks: includes/create-and-boot-vm.yml
- name: announce what's going on
debug:
msg: >
The worker VMs are currently being provisioned. This will take quite
some time, so be patient. In the mean time, you can proceed to the
next stage.
...