mirror of
https://git.ecdf.ed.ac.uk/win_automation/windows-ansible.git
synced 2026-10-31 14:40:15 +00:00
New VM improvements
This commit is contained in:
1 parent
ebc1b4901e
commit
3686d7f627
7 files changed
+180
-29
No files matched your search
@@ -1,7 +1,9 @@
|
||||
---
|
||||
- name: Create workbench VMs (SEQUENTIAL)
|
||||
vars:
|
||||
vm_name: "{{ os_project }}-{{ win_project }}-wb{{ '%02d' | format(item+1+wb_quantity|int) }}"
|
||||
os_server:
|
||||
name: "{{ os_project }}-{{ win_project }}-wb{{ '%02d' | format(item+1+wb_quantity|int) }}"
|
||||
name: "{{ vm_name }}"
|
||||
state: "{{ state }}"
|
||||
image: "{{ vm_image }}"
|
||||
flavor: "{{ user_vm_flavor }}"
|
||||
@@ -26,10 +28,27 @@
|
||||
$admin = [adsi]("WinNT://./Administrator, user")
|
||||
$admin.PSBase.Invoke("SetPassword", "{{ vm_initial_password }}")
|
||||
Invoke-Expression ((New-Object System.Net.Webclient).DownloadString('{{ winrm_script_url }}'))
|
||||
when:
|
||||
- "vm_name not in groups['meta-type_client']|default([])"
|
||||
- cleanup == 'false'
|
||||
loop: "{{ range(new_wb_quantity|int)|list }}"
|
||||
|
||||
- name: Increase workbench quantity variable
|
||||
ansible.builtin.lineinfile:
|
||||
path: /deployments/{{ os_project }}-{{ win_project }}/ansible/vars/common.yml
|
||||
regexp: '^wb_quantity:\s*\d+'
|
||||
line: "wb_quantity: {{ wb_quantity + new_wb_quantity | int }}"
|
||||
- name: cleanup
|
||||
block:
|
||||
- name: delete metadata from instance
|
||||
vars:
|
||||
vm_name: "{{ os_project }}-{{ win_project }}-wb{{ '%02d' | format(item+1+wb_quantity|int) }}"
|
||||
openstack.cloud.server_metadata:
|
||||
state: absent
|
||||
cloud: "{{ os_project }}"
|
||||
name: "{{ vm_name }}"
|
||||
meta:
|
||||
new_vm:
|
||||
loop: "{{ range(new_wb_quantity|int)|list }}"
|
||||
|
||||
- name: Increase workbench quantity variable
|
||||
ansible.builtin.lineinfile:
|
||||
path: /deployments/{{ os_project }}-{{ win_project }}/ansible/vars/common.yml
|
||||
regexp: '^wb_quantity:\s*\d+'
|
||||
line: "wb_quantity: {{ wb_quantity + new_wb_quantity | int }}"
|
||||
when: cleanup == 'true'
|
||||
Reference in new issue
Block a user