---
- name: Get OLVM token for later use
ovirt.ovirt.ovirt_auth:
url: "{{ olvm_api }}"
username: "{{ username }}"
password: "{{ passwd }}"
register: _auth_token
# Previous task returns ansible fact ovirt_auth
# use it as auth={{ ovirt_auth }}
- name: Debug
ansible.builtin.debug:
msg: "{{ _auth_token }}"
- name: Get VMs
ovirt.ovirt.ovirt_vm_info:
auth: "{{ ovirt_auth }}"
pattern: "name=*"
register: _vm
- name: Print VMs
# list of dicts, print only value for key 'fqdn'
ansible.builtin.debug:
msg:
- "{{ _vm.ovirt_vms | map(attribute='fqdn') }}"
- name: Get hosts
ovirt.ovirt.ovirt_host_info:
auth: "{{ ovirt_auth }}"
pattern: "name=*"
register: _host
- name: Print hosts
ansible.builtin.debug:
msg: "{{ _host.ovirt_hosts | map(attribute='address') }}"
- name: Get domains (storage)
ovirt.ovirt.ovirt_storage_domain_info:
auth: "{{ ovirt_auth }}"
pattern: "name=*"
register: _domain
- name: Print domains, which is storage
ansible.builtin.debug:
msg:
# query more attributes
- "{{ _domain.ovirt_storage_domains | json_query('[].{storage: storage, name: name}') }}"
- name: Get networks
ovirt.ovirt.ovirt_network_info:
auth: "{{ ovirt_auth }}"
pattern: "name=*"
register: _net
- name: Print networks
ansible.builtin.debug:
msg: "{{ _net.ovirt_networks | map(attribute='comment') }}"
- name: Get clusters
ovirt.ovirt.ovirt_cluster_info:
auth: "{{ ovirt_auth }}"
pattern: "name=*"
register: _cluster
- name: Print clusters
ansible.builtin.debug:
msg: "{{ _cluster.ovirt_clusters | map(attribute='name')}}"
- name: Get supported OS
ovirt.ovirt.ovirt_vm_os_info:
auth: "{{ ovirt_auth }}"
filter_keys: architecture,name,description
register: _os
- name: Print supported OS
ansible.builtin.debug:
msg: "{{ _os.ovirt_operating_systems }}"
...
|