Update role dependencies

This commit is contained in:
2024-02-08 15:55:01 -05:00
parent e09a7f7d45
commit bb21e8d5c6
507 changed files with 1270 additions and 28219 deletions

View File

@@ -19,120 +19,8 @@
- include_tasks: remove_template.yml
when:
- template_force|bool
- remove_template
- template_found|bool
- block:
- include_tasks: make_iso.yml
- include_tasks: provision_vm.yml
- name: refresh inventory
meta: refresh_inventory
- name: clear gathered facts
meta: clear_facts
- name: clear any host errors
meta: clear_host_errors
- name: add host
add_host:
hostname: template_vm
ansible_host: '{{ template_vm_ip_address }}'
host_key_checking: false
ansible_user: "{{ local_account_username }}"
ansible_password: "{{ local_account_password }}"
ansible_port: "{{ vm_ansible_port | default('22') }}"
ansible_ssh_common_args: '-o UserKnownHostsFile=/dev/null'
ansible_python_interpreter: auto
- name: run setup module
setup:
delegate_to: template_vm
connection: ssh
- block:
- include_role:
name: oatakan.rhn
apply:
delegate_to: template_vm
connection: ssh
become: yes
- include_role:
name: oatakan.rhel_upgrade
apply:
delegate_to: template_vm
connection: ssh
become: yes
when: install_updates|bool
- include_role:
name: oatakan.rhel_template_build
apply:
delegate_to: template_vm
connection: ssh
become: yes
vars:
target_ovirt: yes
always:
- include_role:
name: oatakan.rhn
apply:
delegate_to: template_vm
connection: ssh
become: yes
vars:
role_action: unregister
- name: force handlers to run before stoppping the vm
meta: flush_handlers
- name: refresh SSO credentials
ovirt.ovirt.ovirt_auth:
url: "{{ lookup('env', 'OVIRT_URL')|default(ovirt.url, true) }}"
username: "{{ lookup('env', 'OVIRT_USERNAME')|default(ovirt.username, true) }}"
password: "{{ lookup('env', 'OVIRT_PASSWORD')|default(ovirt.password, true) }}"
insecure: yes
- include_tasks: stop_vm.yml
- include_tasks: convert_to_template.yml
- include_tasks: export_ovf.yml
when: export_ovf|bool
rescue:
- name: refresh SSO credentials
ovirt.ovirt.ovirt_auth:
url: "{{ lookup('env', 'OVIRT_URL')|default(ovirt.url, true) }}"
username: "{{ lookup('env', 'OVIRT_USERNAME')|default(ovirt.username, true) }}"
password: "{{ lookup('env', 'OVIRT_PASSWORD')|default(ovirt.password, true) }}"
insecure: yes
- include_tasks: remove_template.yml
when: remove_vm_on_error|bool
always:
- name: refresh SSO credentials
ovirt.ovirt.ovirt_auth:
url: "{{ lookup('env', 'OVIRT_URL')|default(ovirt.url, true) }}"
username: "{{ lookup('env', 'OVIRT_USERNAME')|default(ovirt.username, true) }}"
password: "{{ lookup('env', 'OVIRT_PASSWORD')|default(ovirt.password, true) }}"
insecure: yes
- include_tasks: remove_vm.yml
- include_tasks: datastore_iso_remove.yml
- name: remove temporary directory
file:
path: "{{ temp_directory }}"
state: absent
- name: logout from oVirt
ovirt.ovirt.ovirt_auth:
state: absent
ovirt_auth: "{{ ovirt_auth }}"
- include_tasks: provision.yml
when: role_action == 'provision'

View File

@@ -1,5 +1,9 @@
---
- name: set template_found to false
set_fact:
template_found: false
- name: get the datacenter name
ovirt.ovirt.ovirt_datacenter_info:
auth: "{{ ovirt_auth }}"
@@ -35,36 +39,38 @@
register: template_info
- block:
- name: set template_found to yes
- name: set template_found to true
set_fact:
template_found: yes
template_found: true
- name: fail with message
fail:
msg: "Existing template found on ovirt/rhv: {{ template.name }}"
when: not template_force|bool
when: not remove_template
when:
- template_info.ovirt_templates is defined
- template_info.ovirt_templates | length > 0
- name: check iso file on data domain
ovirt.ovirt.ovirt_disk_info:
auth: "{{ ovirt_auth }}"
pattern: "name={{ iso_file_name }}"
register: ovirt_disk_main_iso
when: iso_file_name is defined
- block:
- name: check iso file on data domain
ovirt.ovirt.ovirt_disk_info:
auth: "{{ ovirt_auth }}"
pattern: "name={{ iso_file_name }}"
register: ovirt_disk_main_iso
when: iso_file_name is defined
- name: set file id of the iso file
set_fact:
iso_file_id: "{{ ovirt_disk_main_iso.ovirt_disks[0].id }}"
when:
- ovirt_disk_main_iso.ovirt_disks | length > 0
- ovirt_disk_main_iso.ovirt_disks[0].id is defined
- ovirt_disk_main_iso.ovirt_disks[0].content_type == 'iso'
- name: set file id of the iso file
set_fact:
iso_file_id: "{{ ovirt_disk_main_iso.ovirt_disks[0].id }}"
when:
- ovirt_disk_main_iso.ovirt_disks | length > 0
- ovirt_disk_main_iso.ovirt_disks[0].id is defined
- ovirt_disk_main_iso.ovirt_disks[0].content_type == 'iso'
- name: fail with message
fail:
msg: "iso file ({{ iso_file_name }}) could not be found on the data domain and iso domain does not exists"
when:
- iso_file_id is undefined
- iso_domain is undefined or iso_domain|length == 0
- name: fail with message
fail:
msg: "iso file ({{ iso_file_name }}) could not be found on the data domain and iso domain does not exists"
when:
- iso_file_id is undefined
- iso_domain is undefined or iso_domain|length == 0
when: role_action == 'provision'

View File

@@ -1,5 +1,9 @@
---
- name: set template_found to false
set_fact:
template_found: false
- name: get the datacenter name (<2.9)
ovirt_datacenter_facts:
auth: "{{ ovirt_auth }}"
@@ -33,35 +37,37 @@
- block:
- name: set template_found to yes
- name: set template_found to true
set_fact:
template_found: yes
template_found: true
- name: fail with message
fail:
msg: "Existing template found on ovirt/rhv: {{ template.name }}"
when: not template_force|bool
when: not remove_template
when:
- ovirt_templates is defined
- ovirt_templates | length > 0
- name: check iso file on data domain
ovirt_disk_facts:
auth: "{{ ovirt_auth }}"
pattern: "name={{ iso_file_name }}"
when: iso_file_name is defined
- block:
- name: check iso file on data domain
ovirt_disk_facts:
auth: "{{ ovirt_auth }}"
pattern: "name={{ iso_file_name }}"
when: iso_file_name is defined
- name: set file id of the iso file
set_fact:
iso_file_id: "{{ ovirt_disks[0].id }}"
when:
- ovirt_disks | length > 0
- ovirt_disks[0].id is defined
- ovirt_disks[0].content_type == 'iso'
- name: set file id of the iso file
set_fact:
iso_file_id: "{{ ovirt_disks[0].id }}"
when:
- ovirt_disks | length > 0
- ovirt_disks[0].id is defined
- ovirt_disks[0].content_type == 'iso'
- name: fail with message
fail:
msg: "iso file ({{ template.name }}) could not be found on the data domain and iso domain does not exists"
when:
- iso_file_id is undefined
- iso_domain is undefined or iso_domain|length == 0
- name: fail with message
fail:
msg: "iso file ({{ template.name }}) could not be found on the data domain and iso domain does not exists"
when:
- iso_file_id is undefined
- iso_domain is undefined or iso_domain|length == 0
when: role_action == 'provision'