-
Notifications
You must be signed in to change notification settings - Fork 4
/
restart-all-vms.yml
45 lines (38 loc) · 1.99 KB
/
restart-all-vms.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
---
- name: stop and start all running vms
hosts: edge # use ansible-playbook -l group to limit application to specific groups - has tab completion for -l !
connection: ansible.builtin.local
gather_facts: false
#strategy: host_pinned #allows each cluster to start next task before all clusters have finished current task
environment: # if set here - hypercore modules will automatically use this for each remote cluster - avoiding need to specify cluster_instance for each test
SC_HOST: "https://{{ inventory_hostname }}"
SC_USERNAME: "{{ scale_user }}"
SC_PASSWORD: "{{ scale_pass }}"
SC_TIMEOUT: 10
tasks:
- name: Get all available running VMs
scale_computing.hypercore.vm_info:
register: version_update_single_node_vm_info
# Could manipulate VM list here to update var sent to shutdown_vms.yml
- name: shutdown all running VMs (uses code from single node update role)
ansible.builtin.import_role:
name: scale_computing.hypercore.version_update_single_node
tasks_from: shutdown_vms.yml
vars:
version_update_single_node_shutdown_vms: "{{ version_update_single_node_vm_info }}"
# - name: Shutdown all running VMs
# ansible.builtin.include_tasks: shutdown_vms.yml
# vars:
# version_update_single_node_shutdown_vms: "{{ version_update_single_node_vm_info }}"
# when: version_update_single_node_shutdown_vms.records != []
- name: restart previously stopped VMs (uses code from single node update role)
ansible.builtin.import_role:
name: scale_computing.hypercore.version_update_single_node
tasks_from: restart_vms.yml
vars:
version_update_single_node_restart_vms: "{{ version_update_single_node_vm_info }}"
# - name: Restart previously running VMs
# ansible.builtin.include_tasks: restart_vms.yml
# vars:
# version_update_single_node_restart_vms: "{{ version_update_single_node_vm_info }}"
# when: version_update_single_node_restart_vms.records != []