-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrhcsa_lab_setup.yml
More file actions
63 lines (55 loc) · 1.98 KB
/
rhcsa_lab_setup.yml
File metadata and controls
63 lines (55 loc) · 1.98 KB
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
---
# ==============================================================================
# PHASE 1: PROVISIONING & DISCOVERY
# ==============================================================================
- name: "Phase 1: Provision Infrastructure"
hosts: vm_host
become: true
vars_files:
- vars/lab_vms.yml
roles:
- role: vm_host_setup_only
- role: vm_builder
tasks:
- name: Wait for VMs to acquire IPs (DHCP)
ansible.builtin.pause:
seconds: 30
- name: Get VM IP addresses (Filter for 192.168.55.x)
ansible.builtin.shell: >
virsh domifaddr {{ item.name }} --source agent
| grep -o "192\.168\.55\.[0-9]\+"
register: vm_ips
loop: "{{ lab_vms }}"
until: vm_ips.stdout | length > 0
retries: 20
delay: 10
changed_when: false
- name: Add VMs to In-Memory Inventory
ansible.builtin.add_host:
name: "{{ item.item.name }}"
groups:
- "lab_created_{{ 'repo' if 'repo' in item.item.name else 'nodes' }}"
ansible_host: "{{ item.stdout }}"
ansible_user: "{{ item.item.user }}"
ansible_password: "{{ item.item.password }}"
ansible_become_password: "{{ item.item.password }}"
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
loop: "{{ vm_ips.results }}"
# ==============================================================================
# PHASE 2: REPO SERVER CONFIGURATION
# ==============================================================================
- name: "Phase 2: Configure Repository Server"
hosts: lab_created_repo
become: true
gather_facts: true
roles:
- role: repository_server_setup
# ==============================================================================
# PHASE 3: LAB SCENARIO CONFIGURATION
# ==============================================================================
- name: "Phase 3: Configure Lab Nodes"
hosts: lab_created_nodes
become: true
gather_facts: true
roles:
- role: vm_configuration