mirror of
https://git.ecdf.ed.ac.uk/win_automation/windows-ansible.git
synced 2026-10-31 20:00:15 +00:00
New role to build new use vms
This commit is contained in:
1 parent
30aa6c5aad
commit
ebc1b4901e
5 files changed
+129
No files matched your search
@@ -0,0 +1,35 @@
|
||||
---
|
||||
- name: Create gpu VMs (SEQUENTIAL)
|
||||
os_server:
|
||||
name: "{{ os_project }}-{{ win_project }}-gpu{{ '%02d' | format(item+1+gpu_quantity|int) }}"
|
||||
state: "{{ state }}"
|
||||
image: "{{ vm_image }}"
|
||||
flavor: "{{ user_vm_flavor }}"
|
||||
timeout: 900
|
||||
boot_from_volume: true
|
||||
volume_size: 40
|
||||
terminate_volume: yes
|
||||
security_groups:
|
||||
- domain_member
|
||||
- user_vms
|
||||
network: "{{ os_network }}"
|
||||
metadata:
|
||||
name: "gpu{{ '%02d' | format(item+1+gpu_quantity|int) }}"
|
||||
win_project: "{{ win_project }}"
|
||||
type: client
|
||||
variant: gpu
|
||||
os: windows
|
||||
new_vm: "true" # Tag to target only new VMs
|
||||
userdata: |
|
||||
#ps1
|
||||
Rename-Computer "{{ win_project }}-gpu{{ '%02d' | format(item+1+gpu_quantity|int) }}"
|
||||
$admin = [adsi]("WinNT://./Administrator, user")
|
||||
$admin.PSBase.Invoke("SetPassword", "{{ vm_initial_password }}")
|
||||
Invoke-Expression ((New-Object System.Net.Webclient).DownloadString('{{ winrm_script_url }}'))
|
||||
loop: "{{ range(new_gpu_quantity|int)|list }}"
|
||||
|
||||
- name: Increase gpu quantity variable
|
||||
ansible.builtin.lineinfile:
|
||||
path: /deployments/{{ os_project }}-{{ win_project }}/ansible/vars/common.yml
|
||||
regexp: '^gpu_quantity:\s*\d+'
|
||||
line: "gpu_quantity: {{ gpu_quantity + new_gpu_quantity | int }}"
|
||||
Reference in new issue
Block a user