-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart_oslab_worker_nodes.yaml
36 lines (36 loc) · 1.05 KB
/
start_oslab_worker_nodes.yaml
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
---
#
# var:folder
#
- name: Start oslab master VMs
hosts: localhost
vars:
folder_name: "{{ folder if folder is defined else 'oslab' }}"
master_node_names: []
tasks:
- name: Get VM Names
vmware_vm_info:
hostname: "{{ vsphere_address }}"
username: "{{ vsphere_username }}"
password: "{{ vsphere_password }}"
validate_certs: no
folder: "{{ vsphere_datacenter }}/vm/{{ folder }}"
delegate_to: localhost
register: vm_info
- name: Build VM list
set_fact:
master_node_names: "{{ master_node_names }} + [ '{{ item.guest_name }}' ]"
with_items: "{{ vm_info.virtual_machines }}"
when: item.guest_name is match(".*-worker-.*")
- name: Start master node VMs
vmware_guest_powerstate:
hostname: "{{ vsphere_address }}"
username: "{{ vsphere_username }}"
password: "{{ vsphere_password }}"
validate_certs: no
folder: "{{ folder }}"
name: "{{ item }}"
state: powered-on
delegate_to: localhost
register: deploy
with_items: "{{ master_node_names | list }}"