mirror of
https://git.ecdf.ed.ac.uk/win_automation/windows-ansible.git
synced 2026-11-03 08:30:15 +00:00
create common VMs in 2 batches using async (WIP)
This commit is contained in:
1 parent
a911929a5c
commit
9000343151
2 files changed
+96
-46
No files matched your search
@@ -34,7 +34,9 @@
|
|||||||
async: 900
|
async: 900
|
||||||
poll: 0
|
poll: 0
|
||||||
register: async_wb
|
register: async_wb
|
||||||
when: 'wb_quantity|int <= 5'
|
when:
|
||||||
|
- 'wb_quantity|int <= 5'
|
||||||
|
- 'wb_quantity|int > 1'
|
||||||
|
|
||||||
- name: Create workbench VMs (SEQUENTIAL)
|
- name: Create workbench VMs (SEQUENTIAL)
|
||||||
os_server:
|
os_server:
|
||||||
@@ -106,7 +108,9 @@
|
|||||||
async: 900
|
async: 900
|
||||||
poll: 0
|
poll: 0
|
||||||
register: async_app
|
register: async_app
|
||||||
when: 'app_quantity|int <= 5'
|
when:
|
||||||
|
- 'app_quantity|int <= 5'
|
||||||
|
- 'app_quantity|int > 1'
|
||||||
|
|
||||||
- name: Create application VMs (SEQUENTIAL)
|
- name: Create application VMs (SEQUENTIAL)
|
||||||
os_server:
|
os_server:
|
||||||
@@ -178,7 +182,9 @@
|
|||||||
async: 900
|
async: 900
|
||||||
poll: 0
|
poll: 0
|
||||||
register: async_gpu
|
register: async_gpu
|
||||||
when: 'gpu_quantity|int <= 5'
|
when:
|
||||||
|
- 'gpu_quantity|int <= 5'
|
||||||
|
- 'gpu_quantity|int > 1'
|
||||||
|
|
||||||
- name: Create GPU VMs (SEQUENTIAL)
|
- name: Create GPU VMs (SEQUENTIAL)
|
||||||
os_server:
|
os_server:
|
||||||
@@ -220,47 +226,90 @@
|
|||||||
delay: 60
|
delay: 60
|
||||||
when: 'async_gpu.skipped == false'
|
when: 'async_gpu.skipped == false'
|
||||||
|
|
||||||
- name: Common VMs
|
- name: Common VMs
|
||||||
block:
|
block:
|
||||||
- name: Create Common VMs (DCs, Fileservers, WSUS, Chocolatey)
|
- name: Create Common VMs (DCs, Fileservers, WSUS, Chocolatey)
|
||||||
openstack.cloud.server:
|
os_server:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
state: "{{ state }}"
|
state: "{{ state }}"
|
||||||
image: c5d5abb3-c15a-4870-b9b7-89873ae9a9a6
|
image: c5d5abb3-c15a-4870-b9b7-89873ae9a9a6
|
||||||
flavor: 3661211f-673a-4777-8857-fd243d6c407d
|
flavor: 3661211f-673a-4777-8857-fd243d6c407d
|
||||||
timeout: 900
|
timeout: 3600
|
||||||
boot_from_volume: true
|
boot_from_volume: true
|
||||||
volume_size: 40
|
volume_size: 40
|
||||||
terminate_volume: yes
|
terminate_volume: yes
|
||||||
security_groups:
|
security_groups:
|
||||||
- domain_member
|
- domain_member
|
||||||
- "{{ item.security_group }}"
|
- "{{ item.security_group }}"
|
||||||
network: "{{ os_network }}"
|
network: "{{ os_network }}"
|
||||||
metadata:
|
|
||||||
name: "{{ item.meta_name }}"
|
|
||||||
win_project: "{{ win_project }}"
|
|
||||||
type: server
|
|
||||||
variant: "{{ item.security_group }}" # just happens to match maybe change???
|
|
||||||
os: windows
|
|
||||||
userdata: |
|
|
||||||
#ps1
|
|
||||||
Rename-Computer "{{ win_project }}-{{ item.meta_name }}"
|
|
||||||
$admin = [adsi]("WinNT://./Administrator, user")
|
|
||||||
$admin.PSBase.Invoke("SetPassword", "{{ vm_initial_password }}")
|
|
||||||
Invoke-Expression ((New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/ansible/ansible-documentation/devel/examples/scripts/ConfigureRemotingForAnsible.ps1'))
|
|
||||||
loop: "{{ standard_vms }}"
|
|
||||||
async: 900
|
|
||||||
poll: 0
|
|
||||||
|
|
||||||
- name: Wait for common VMs to build
|
|
||||||
os_server_info:
|
|
||||||
name: "{{ os_project }}-{{ win_project }}-*"
|
|
||||||
filters:
|
|
||||||
metadata:
|
metadata:
|
||||||
|
name: "{{ item.meta_name }}"
|
||||||
|
win_project: "{{ win_project }}"
|
||||||
type: server
|
type: server
|
||||||
vm_state: active
|
variant: "{{ item.security_group }}" # just happens to match maybe change???
|
||||||
register: common_status
|
os: windows
|
||||||
until: 'common_status.servers|length == 6'
|
userdata: |
|
||||||
retries: 100
|
#ps1
|
||||||
delay: 60
|
Rename-Computer "{{ win_project }}-{{ item.meta_name }}"
|
||||||
# Add async to this task for speed. can openstack handle 6 at once or split 3 3???
|
$admin = [adsi]("WinNT://./Administrator, user")
|
||||||
|
$admin.PSBase.Invoke("SetPassword", "{{ vm_initial_password }}")
|
||||||
|
Invoke-Expression ((New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/ansible/ansible-documentation/devel/examples/scripts/ConfigureRemotingForAnsible.ps1'))
|
||||||
|
loop: "{{ standard_vms1 }}"
|
||||||
|
async: 900
|
||||||
|
poll: 0
|
||||||
|
|
||||||
|
- name: Wait for common VMs to build
|
||||||
|
os_server_info:
|
||||||
|
name: "{{ os_project }}-{{ win_project }}-*"
|
||||||
|
filters:
|
||||||
|
metadata:
|
||||||
|
type: server
|
||||||
|
vm_state: active
|
||||||
|
register: common_status
|
||||||
|
until: 'common_status.servers|length == 3'
|
||||||
|
retries: 100
|
||||||
|
delay: 60
|
||||||
|
|
||||||
|
- name: Common VMs
|
||||||
|
block:
|
||||||
|
- name: Create Common VMs (DCs, Fileservers, WSUS, Chocolatey)
|
||||||
|
os_server:
|
||||||
|
name: "{{ item.name }}"
|
||||||
|
state: "{{ state }}"
|
||||||
|
image: c5d5abb3-c15a-4870-b9b7-89873ae9a9a6
|
||||||
|
flavor: 3661211f-673a-4777-8857-fd243d6c407d
|
||||||
|
timeout: 3600
|
||||||
|
boot_from_volume: true
|
||||||
|
volume_size: 40
|
||||||
|
terminate_volume: yes
|
||||||
|
security_groups:
|
||||||
|
- domain_member
|
||||||
|
- "{{ item.security_group }}"
|
||||||
|
network: "{{ os_network }}"
|
||||||
|
metadata:
|
||||||
|
name: "{{ item.meta_name }}"
|
||||||
|
win_project: "{{ win_project }}"
|
||||||
|
type: server
|
||||||
|
variant: "{{ item.security_group }}" # just happens to match maybe change???
|
||||||
|
os: windows
|
||||||
|
userdata: |
|
||||||
|
#ps1
|
||||||
|
Rename-Computer "{{ win_project }}-{{ item.meta_name }}"
|
||||||
|
$admin = [adsi]("WinNT://./Administrator, user")
|
||||||
|
$admin.PSBase.Invoke("SetPassword", "{{ vm_initial_password }}")
|
||||||
|
Invoke-Expression ((New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/ansible/ansible-documentation/devel/examples/scripts/ConfigureRemotingForAnsible.ps1'))
|
||||||
|
loop: "{{ standard_vms2 }}"
|
||||||
|
async: 900
|
||||||
|
poll: 0
|
||||||
|
|
||||||
|
- name: Wait for common VMs to build
|
||||||
|
os_server_info:
|
||||||
|
name: "{{ os_project }}-{{ win_project }}-*"
|
||||||
|
filters:
|
||||||
|
metadata:
|
||||||
|
type: server
|
||||||
|
vm_state: active
|
||||||
|
register: common_status2
|
||||||
|
until: 'common_status2.servers|length == 6'
|
||||||
|
retries: 100
|
||||||
|
delay: 60
|
||||||
@@ -15,10 +15,11 @@ server_vm_flavor: 3661211f-673a-4777-8857-fd243d6c407d
|
|||||||
user_vm_flavor: 3661211f-673a-4777-8857-fd243d6c407d
|
user_vm_flavor: 3661211f-673a-4777-8857-fd243d6c407d
|
||||||
gpu_flavor: 3661211f-673a-4777-8857-fd243d6c407d # CHANGE THIS
|
gpu_flavor: 3661211f-673a-4777-8857-fd243d6c407d # CHANGE THIS
|
||||||
|
|
||||||
standard_vms:
|
standard_vms1:
|
||||||
- { name: "{{ os_project }}-{{ win_project }}-dc01", security_group: "domain_controller", meta_name: dc01 }
|
- { name: "{{ os_project }}-{{ win_project }}-dc01", security_group: "domain_controller", meta_name: dc01 }
|
||||||
- { name: "{{ os_project }}-{{ win_project }}-dc02", security_group: "domain_controller", meta_name: dc02 }
|
- { name: "{{ os_project }}-{{ win_project }}-dc02", security_group: "domain_controller", meta_name: dc02 }
|
||||||
- { name: "{{ os_project }}-{{ win_project }}-fs01", security_group: "file_server", meta_name: fs01 }
|
- { name: "{{ os_project }}-{{ win_project }}-fs01", security_group: "file_server", meta_name: fs01 }
|
||||||
|
standard_vms2:
|
||||||
- { name: "{{ os_project }}-{{ win_project }}-fs02", security_group: "file_server", meta_name: fs02 }
|
- { name: "{{ os_project }}-{{ win_project }}-fs02", security_group: "file_server", meta_name: fs02 }
|
||||||
- { name: "{{ os_project }}-{{ win_project }}-wsus", security_group: "wsus_server", meta_name: wsus }
|
- { name: "{{ os_project }}-{{ win_project }}-wsus", security_group: "wsus_server", meta_name: wsus }
|
||||||
- { name: "{{ os_project }}-{{ win_project }}-choc", security_group: "chocolatey_server", meta_name: choc }
|
- { name: "{{ os_project }}-{{ win_project }}-choc", security_group: "chocolatey_server", meta_name: choc }
|
||||||
|
|||||||
Reference in new issue
Block a user