-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sample VM Deployment and Cluster Config Playbook.yml
149 lines (131 loc) · 4.74 KB
/
Sample VM Deployment and Cluster Config Playbook.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# Primitive Version Prior to Dave's updates
# Inventory file should have variables defined ideally
---
- name: Gather Info
hosts: all
connection: ansible.builtin.local
gather_facts: false
vars_prompt:
# Establish variables; this can also be stored in an inventory file
- name: username
prompt: Enter authentication username
private: false
- name: password
prompt: Enter authenticaion password
private: yes
tasks:
#Configure Cluster Name
- name: Configure Cluster Name
scale_computing.hypercore.cluster_name:
cluster_instance:
host: "https://{{ inventory_hostname }}"
username: "{{ scale_user }}"
password: "{{ scale_pass }}"
name_new: {{ server }} Scale Cluster
register: cluster
- name: Cluster Name Results
ansible.builtin.debug:
msg: "{{ cluster.record.name }}"
#Configure DNS
- name: DNS
scale_computing.hypercore.dns_config:
cluster_instance:
host: "https://{{ inventory_hostname }}"
username: "{{ scale_user }}"
password: "{{ scale_pass }}"
search_domains:
- company.local
#Example setting with a public DNS server
dns_servers:
- 8.8.8.8
- 4.4.4.4
state: set
register: dns
with_items: [1,2]
- debug:
var: dns
#Time Server Configuration
- name: Configure Time Server
scale_computing.hypercore.time_server:
cluster_instance:
host: "https://{{ inventory_hostname }}"
username: "{{ scale_user }}"
password: "{{ scale_pass }}"
source: pool.ntp.org
register: timeserver
- name: Time Server Result
ansible.builtin.debug:
msg: "{{ timeserver.record }}"
#SMTP Configuration
- name: Configure SMTP
scale_computing.hypercore.smtp:
cluster_instance:
host: "https://{{ inventory_hostname }}"
username: "{{ scale_user }}"
password: "{{ scale_pass }}"
from_address: "{{ server }}_Cluster@company.com"
port: 25
server: smtp.company.com
use_ssl: false
register: SMTP
- name: SMTP Results
ansible.builtin.debug:
msg: "{{ SMTP.record }}"
#Sample VM import from a local SMB share
- name: Windows 2022 Template Import
scale_computing.hypercore.vm_import:
cluster_instance:
host: "https://{{ inventory_hostname }}"
username: "{{ scale_user }}"
password: "{{ scale_pass }}"
vm_name: "Windows 2022 Template"
smb:
server: smb.server.address.local # SMB server address or hostname
path: '/path/to/Windows-2022-Template-Directory' # Path to directory with forward slash /
file_name: Windows-2022-Template.xml # XML file name in the directory
username: "{{ username }}"
password: "{{ password }}"
register: 2022-template
- name: 2022-template Results
ansible.builtin.debug:
msg: "{{ 2022-template.msg }}"
#Configure Snapshot Schedule
- name: Configure 2022 Template Snapshot Schedule
scale_computing.hypercore.snapshot_schedule:
cluster_instance:
host: "https://{{ inventory_hostname }}"
username: "{{ scale_user }}"
password: "{{ scale_pass }}"
name: 2022-Template Backup
state: present
recurrences:
- name: 2022-Template Backup # schedule name
frequency: "FREQ=DAILY;INTERVAL=1" # once per day
start: "2012-01-01 04:00:00" # start time (choose something in the past to start immediately or the future for a future application
local_retention: "{{ 7 * 24*60*60 }}" # retain for 7 days
remote_retention: "0"
register: SC-Snapshot
- name: Snapshot Result
ansible.builtin.debug:
msg: "{{ SC-Snapshot.record }}"
#Apply Created Snapshot Schedule
- name: Set 2022-Template Snapshot Schedule
scale_computing.hypercore.vm_params:
cluster_instance:
host: "https://{{ inventory_hostname }}"
username: "{{ scale_user }}"
password: "{{ scale_pass }}"
vm_name: Windows-2022-Template # VM to apply a schedule to
snapshot_schedule: "2022-Template Backup" # Name of schedule to apply
#Time Zone Configuration
- name: Configure Timezone
scale_computing.hypercore.time_zone:
cluster_instance:
host: "https://{{ inventory_hostname }}"
username: "{{ scale_user }}"
password: "{{ scale_pass }}"
zone: "America/New York" # Time zone to select bounded by quotes
register: timezone
- name: Timezone Result
ansible.builtin.debug:
msg: "{{ timezone.record }}"