ansible-role-cmdb/tasks/hypervisor.yml

41 lines
1.2 KiB
YAML
Raw Normal View History

2023-06-19 15:12:18 +02:00
---
- 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 }}"
2023-06-20 20:01:16 +02:00
- name: "Hypervisor | Create 'virt_kvm_host' group"
2023-06-20 20:00:51 +02:00
ansible.builtin.group_by:
key: virt_{{ ansible_virtualization_type }}_{{ ansible_virtualization_role }}
2023-06-19 15:12:18 +02:00
- name: "Hypervisor | Write hypervisor startpage"
ansible.builtin.template:
src: hypervisor.txt.j2
dest: "{{ cmdb.wiki_pages_path }}/servers/hypervisor.txt"
2023-08-13 22:05:45 +02:00
owner: "{{ cmdb.wiki_user }}"
2023-07-14 16:10:28 +02:00
group: "{{ cmdb.wiki_group }}"
2023-06-19 15:12:18 +02:00
mode: "0644"
delegate_to: "{{ cmdb.wiki_server }}"