ansible-role-cmdb/tasks/hypervisor.yml

40 lines
1.2 KiB
YAML

---
- name: "Hypervisor | Scrap virtual machines"
ansible.builtin.command: "virsh list --all"
register: command_out
changed_when: false
- name: "Hypervisor | Set VM fact"
ansible.builtin.set_fact:
qemu_vms: "{{ command_out.stdout }}"
- name: "Hypervisor | scrap virtual networks"
ansible.builtin.command: "virsh net-list --all"
register: command_out
changed_when: false
- name: "Hypervisor | Set network fact"
ansible.builtin.set_fact:
qemu_network: "{{ command_out.stdout }}"
- name: "Hypervisor | Scrap virtual storage pools"
ansible.builtin.command: "virsh pool-list --all"
register: command_out
changed_when: false
- name: "Hypervisor | Set storage fact"
ansible.builtin.set_fact:
qemu_pool: "{{ command_out.stdout }}"
- name: "Hypervisor | Create 'virt_kvm_host' group"
ansible.builtin.group_by:
key: virt_{{ ansible_virtualization_type }}_{{ ansible_virtualization_role }}
- name: "Hypervisor | Write hypervisor startpage"
ansible.builtin.template:
src: hypervisor.txt.j2
dest: "{{ cmdb.wiki_pages_path }}/servers/hypervisor.txt"
owner: "{{ cmdb.wiki_user }}"
group: "{{ cmdb.wiki_group }}"
mode: "0644"
delegate_to: "{{ cmdb.wiki_server }}"