Update roles
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: convert to template
|
||||
ovirt_template:
|
||||
ovirt.ovirt.ovirt_template:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
name: "{{ template.name }}"
|
||||
vm: "{{ template.name }}"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
- block:
|
||||
- name: remove iso file from data_domain
|
||||
ovirt_disk:
|
||||
ovirt.ovirt.ovirt_disk:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
name: "{{ iso_file }}"
|
||||
storage_domain: "{{ providers.ovirt.data_domain | default('data_domain') }}"
|
||||
@@ -15,7 +15,7 @@
|
||||
when: ansible_version.full is version('2.9', '>=')
|
||||
|
||||
- name: remove iso file from data_domain
|
||||
ovirt_disk:
|
||||
ovirt.ovirt.ovirt_disk:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
name: "{{ iso_file }}"
|
||||
storage_domain: "{{ providers.ovirt.data_domain | default('data_domain') }}"
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
---
|
||||
|
||||
- name: validate file
|
||||
stat:
|
||||
path: "{{ playbook_dir }}/{{ temp_directory }}/windows_{{ windows_distro_name }}_autounattend_autogen.iso"
|
||||
get_checksum: no
|
||||
register: iso_file_check
|
||||
|
||||
- name: upload iso file to data_domain
|
||||
ovirt_disk:
|
||||
ovirt.ovirt.ovirt_disk:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
name: "{{ iso_file }}"
|
||||
upload_image_path: "{{ playbook_dir }}/{{ temp_directory }}/windows_{{ windows_distro_name }}_autounattend_autogen.iso"
|
||||
upload_image_path: "{{ iso_file_check.stat.path }}"
|
||||
storage_domain: "{{ providers.ovirt.data_domain | default('data_domain') }}"
|
||||
size: 20MiB
|
||||
size: "{{ (iso_file_check.stat.size/1024/1024)|round(0, 'ceil')|int|string }}MiB"
|
||||
wait: true
|
||||
bootable: true
|
||||
format: raw
|
||||
content_type: iso
|
||||
force: yes
|
||||
register: disk_iso_file
|
||||
when: iso_file_check.stat.exists
|
||||
|
||||
- name: set iso file disk id
|
||||
set_fact:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
- name: export template to export domain
|
||||
ovirt_template:
|
||||
ovirt.ovirt.ovirt_template:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
state: exported
|
||||
name: "{{ template.name }}"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
- name: obtain SSO token with using username/password credentials
|
||||
ovirt_auth:
|
||||
ovirt.ovirt.ovirt_auth:
|
||||
url: "{{ lookup('env', 'OVIRT_URL')|default(ovirt.url) }}"
|
||||
username: "{{ lookup('env', 'OVIRT_USERNAME')|default(ovirt.username) }}"
|
||||
password: "{{ lookup('env', 'OVIRT_PASSWORD')|default(ovirt.password) }}"
|
||||
@@ -62,7 +62,7 @@
|
||||
delegate_to: template_host
|
||||
|
||||
- name: refresh SSO credentials
|
||||
ovirt_auth:
|
||||
ovirt.ovirt.ovirt_auth:
|
||||
url: "{{ lookup('env', 'OVIRT_URL')|default(ovirt.url) }}"
|
||||
username: "{{ lookup('env', 'OVIRT_USERNAME')|default(ovirt.username) }}"
|
||||
password: "{{ lookup('env', 'OVIRT_PASSWORD')|default(ovirt.password) }}"
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
rescue:
|
||||
- name: refresh SSO credentials
|
||||
ovirt_auth:
|
||||
ovirt.ovirt.ovirt_auth:
|
||||
url: "{{ lookup('env', 'OVIRT_URL')|default(ovirt.url) }}"
|
||||
username: "{{ lookup('env', 'OVIRT_USERNAME')|default(ovirt.username) }}"
|
||||
password: "{{ lookup('env', 'OVIRT_PASSWORD')|default(ovirt.password) }}"
|
||||
@@ -92,7 +92,7 @@
|
||||
|
||||
always:
|
||||
- name: refresh SSO credentials
|
||||
ovirt_auth:
|
||||
ovirt.ovirt.ovirt_auth:
|
||||
url: "{{ lookup('env', 'OVIRT_URL')|default(ovirt.url) }}"
|
||||
username: "{{ lookup('env', 'OVIRT_USERNAME')|default(ovirt.username) }}"
|
||||
password: "{{ lookup('env', 'OVIRT_PASSWORD')|default(ovirt.password) }}"
|
||||
@@ -109,7 +109,7 @@
|
||||
state: absent
|
||||
|
||||
- name: logout from oVirt
|
||||
ovirt_auth:
|
||||
ovirt.ovirt.ovirt_auth:
|
||||
state: absent
|
||||
ovirt_auth: "{{ ovirt_auth }}"
|
||||
|
||||
|
||||
@@ -10,6 +10,15 @@
|
||||
src: "{{ windows_sysprep_template_folder }}/Autounattend.xml.j2"
|
||||
dest: "{{ temp_directory }}/ks_iso/Autounattend.xml"
|
||||
|
||||
- name: download ConfigureRemotingForAnsible.ps1 script
|
||||
get_url:
|
||||
url: "{{ winrm_enable_script_url }}"
|
||||
dest: "{{ temp_directory }}/ks_iso/ConfigureRemotingForAnsible.ps1"
|
||||
register: download_script
|
||||
until: download_script is success
|
||||
delay: 3
|
||||
retries: 5
|
||||
|
||||
- name: include virtio drivers
|
||||
include_tasks: virtio_drivers.yml
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
---
|
||||
|
||||
- name: get the datacenter name
|
||||
ovirt_datacenter_info:
|
||||
ovirt.ovirt.ovirt_datacenter_info:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
pattern: "Clusters.name = {{ providers.ovirt.cluster }}"
|
||||
register: datacenter_info
|
||||
|
||||
- name: get storage information
|
||||
ovirt_storage_domain_info:
|
||||
ovirt.ovirt.ovirt_storage_domain_info:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
pattern: "datacenter={{ datacenter_info.ovirt_datacenters[0].name }}"
|
||||
register: storage_info
|
||||
@@ -29,7 +29,7 @@
|
||||
the_query: "[?type=='iso']"
|
||||
|
||||
- name: check if template already exists
|
||||
ovirt_template_info:
|
||||
ovirt.ovirt.ovirt_template_info:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
pattern: "name={{ template.name }} and datacenter={{ datacenter_info.ovirt_datacenters[0].name }}"
|
||||
register: template_info
|
||||
@@ -48,7 +48,7 @@
|
||||
- template_info.ovirt_templates | length > 0
|
||||
|
||||
- name: check iso file on data domain
|
||||
ovirt_disk_info:
|
||||
ovirt.ovirt.ovirt_disk_info:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
pattern: "name={{ iso_file_name }}"
|
||||
register: ovirt_disk_main_iso
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
---
|
||||
|
||||
- name: get the datacenter name (<2.9)
|
||||
ovirt_datacenter_facts:
|
||||
ovirt.ovirt.ovirt_datacenter_facts:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
pattern: "Clusters.name = {{ providers.ovirt.cluster }}"
|
||||
|
||||
- name: get storage information (<2.9)
|
||||
ovirt_storage_domain_facts:
|
||||
ovirt.ovirt.ovirt_storage_domain_facts:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
pattern: "datacenter={{ ovirt_datacenters[0].name }}"
|
||||
when:
|
||||
@@ -27,7 +27,7 @@
|
||||
the_query: "[?type=='iso']"
|
||||
|
||||
- name: check if template already exists (<2.9)
|
||||
ovirt_template_facts:
|
||||
ovirt.ovirt.ovirt_template_facts:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
pattern: "name={{ template.name }} and datacenter={{ ovirt_datacenters[0].name }}"
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
- ovirt_templates | length > 0
|
||||
|
||||
- name: check iso file on data domain
|
||||
ovirt_disk_facts:
|
||||
ovirt.ovirt.ovirt_disk_facts:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
pattern: "name={{ iso_file_name }}"
|
||||
when: iso_file_name is defined
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
- name: provision a new vm
|
||||
ovirt_vm:
|
||||
ovirt.ovirt.ovirt_vm:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
name: "{{ template.name }}"
|
||||
cluster: "{{ providers.ovirt.cluster|default('Default') }}"
|
||||
@@ -9,6 +9,7 @@
|
||||
wait: yes
|
||||
memory: "{{ template.memory }}MiB"
|
||||
cpu_sockets: "{{ template.cpu }}"
|
||||
bios_type: "{{ template.bios_type | default(omit) }}"
|
||||
boot_devices:
|
||||
- hd
|
||||
- cdrom
|
||||
@@ -34,7 +35,7 @@
|
||||
delay: 10
|
||||
|
||||
- name: create a disk
|
||||
ovirt_disk:
|
||||
ovirt.ovirt.ovirt_disk:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
name: "{% if item.name_prefix | default(false) %}{{ template.name }}_{% endif %}{{ item.name }}"
|
||||
vm_name: "{{ template.name }}"
|
||||
@@ -82,7 +83,7 @@
|
||||
- disks_creation.results is defined
|
||||
|
||||
- name: assign tags to provisioned vms
|
||||
ovirt_tag:
|
||||
ovirt.ovirt.ovirt_tag:
|
||||
name: "{{ item }}_{{ instance.item.item[item] }}"
|
||||
vms: ["{{ instance.item.item.name }}"]
|
||||
state: attached
|
||||
@@ -96,7 +97,7 @@
|
||||
- instance.item.item[item] is defined
|
||||
|
||||
- name: start vm
|
||||
ovirt_vm:
|
||||
ovirt.ovirt.ovirt_vm:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
name: "{{ template.name }}"
|
||||
cluster: "{{ providers.ovirt.cluster|default('Default') }}"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
- name: remove template
|
||||
ovirt_template:
|
||||
ovirt.ovirt.ovirt_template:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
cluster: "{{ providers.ovirt.cluster }}"
|
||||
name: "{{ template.name }}"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
- name: remove vm
|
||||
ovirt_vm:
|
||||
ovirt.ovirt.ovirt_vm:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
cluster: "{{ providers.ovirt.cluster }}"
|
||||
name: "{{ template.name }}"
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
msg: "ignoring error..."
|
||||
|
||||
- name: reconfigure vm
|
||||
ovirt_vm:
|
||||
ovirt.ovirt.ovirt_vm:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
cluster: "{{ providers.ovirt.cluster }}"
|
||||
name: "{{ template.name }}"
|
||||
boot_devices:
|
||||
- hd
|
||||
cd_iso: ""
|
||||
custom_properties: "{{ custom_properties_efi if template_vm_efi|bool else '' }}"
|
||||
custom_properties: "{{ custom_properties_efi if (template_vm_efi|bool and custom_efi_enabled|bool) else ([{}]) }}"
|
||||
force: yes
|
||||
state: present
|
||||
when: template is defined
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
- name: wait until the image is unlocked by the oVirt engine
|
||||
ovirt_disk_info:
|
||||
ovirt.ovirt.ovirt_disk_info:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
pattern: "name={% if item.name_prefix | default(false) %}{{ template.name }}_{% endif %}{{ item.name }}"
|
||||
register: ovirt_disk_info
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
- name: wait until the disk is unlocked by the oVirt engine
|
||||
ovirt_disk_info:
|
||||
ovirt.ovirt.ovirt_disk_info:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
pattern: "name={{ iso_file }}"
|
||||
register: ovirt_disk_info
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
- name: wait for vm status to be poweredoff
|
||||
ovirt_vm_info:
|
||||
ovirt.ovirt.ovirt_vm_info:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
pattern: name={{ template.name }} and cluster={{ providers.ovirt.cluster }}
|
||||
register: ovirt_vm_info_result
|
||||
|
||||
Reference in New Issue
Block a user