diff --git a/ansible/playbooks/openstack-vms.yml b/ansible/playbooks/openstack-vms.yml index c9f2faf..f98d396 100644 --- a/ansible/playbooks/openstack-vms.yml +++ b/ansible/playbooks/openstack-vms.yml @@ -220,32 +220,47 @@ delay: 60 when: 'async_gpu.skipped == false' + - name: Common VMs + block: + - name: Create Common VMs (DCs, Fileservers, WSUS, Chocolatey) + openstack.cloud.server: + name: "{{ item.name }}" + state: "{{ state }}" + image: c5d5abb3-c15a-4870-b9b7-89873ae9a9a6 + flavor: 3661211f-673a-4777-8857-fd243d6c407d + timeout: 900 + 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_vms }}" + async: 900 + poll: 0 - - name: Create Common VMs (DCs, Fileservers, WSUS, Chocolatey) - openstack.cloud.server: - name: "{{ item.name }}" - state: "{{ state }}" - image: c5d5abb3-c15a-4870-b9b7-89873ae9a9a6 - flavor: 3661211f-673a-4777-8857-fd243d6c407d - timeout: 900 - 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_vms }}" - # Add async to this task for speed. can openstack handle 6 at once or split 3 3??? \ No newline at end of file + - 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 == 6' + retries: 100 + delay: 60 + # Add async to this task for speed. can openstack handle 6 at once or split 3 3??? \ No newline at end of file