From ba0b688d2031f1083b50601b310f930b2231b704 Mon Sep 17 00:00:00 2001 From: Dimitris Poulopoulos Date: Mon, 11 Mar 2024 12:47:18 +0200 Subject: [PATCH] ansible/chore: Rename QEMU occurrences to libvirt Rename any QEMU occurrence to reference libvirt instead, as Ansible does not work directly with QEMU or KVM. Signed-off-by: Dimitris Poulopoulos --- ansible/Makefile | 3 --- ansible/hosts.yaml | 2 +- .../roles/{qemu-vm => libvirt}/defaults/main.yaml | 0 .../{qemu-vm => libvirt}/handlers/inventory.yaml | 0 .../roles/{qemu-vm => libvirt}/handlers/main.yaml | 0 ansible/roles/{qemu-vm => libvirt}/tasks/main.yaml | 4 ++-- .../templates/vm-template.xml.j2 | 0 ansible/site.yaml | 12 ++++++------ ansible/state.ini | 3 +++ 9 files changed, 12 insertions(+), 12 deletions(-) rename ansible/roles/{qemu-vm => libvirt}/defaults/main.yaml (100%) rename ansible/roles/{qemu-vm => libvirt}/handlers/inventory.yaml (100%) rename ansible/roles/{qemu-vm => libvirt}/handlers/main.yaml (100%) rename ansible/roles/{qemu-vm => libvirt}/tasks/main.yaml (96%) rename ansible/roles/{qemu-vm => libvirt}/templates/vm-template.xml.j2 (100%) diff --git a/ansible/Makefile b/ansible/Makefile index 821e91c..2a61207 100644 --- a/ansible/Makefile +++ b/ansible/Makefile @@ -7,6 +7,3 @@ all: check: ansible-playbook $(DEFAULT_ARGS) $(ANSIBLE_DIFF) --check site.yaml - -qemu: - ansible-playbook $(DEFAULT_ARGS) $(ANSIBLE_DIFF) --tags qemu-vm site.yaml diff --git a/ansible/hosts.yaml b/ansible/hosts.yaml index 10c80b5..a1bb439 100644 --- a/ansible/hosts.yaml +++ b/ansible/hosts.yaml @@ -27,7 +27,7 @@ all: vm_host: boogie pxe_server: pxe-server children: - qemu: + libvirt: hosts: k8s-dev1-ctrl: vm_vcpus: 4 diff --git a/ansible/roles/qemu-vm/defaults/main.yaml b/ansible/roles/libvirt/defaults/main.yaml similarity index 100% rename from ansible/roles/qemu-vm/defaults/main.yaml rename to ansible/roles/libvirt/defaults/main.yaml diff --git a/ansible/roles/qemu-vm/handlers/inventory.yaml b/ansible/roles/libvirt/handlers/inventory.yaml similarity index 100% rename from ansible/roles/qemu-vm/handlers/inventory.yaml rename to ansible/roles/libvirt/handlers/inventory.yaml diff --git a/ansible/roles/qemu-vm/handlers/main.yaml b/ansible/roles/libvirt/handlers/main.yaml similarity index 100% rename from ansible/roles/qemu-vm/handlers/main.yaml rename to ansible/roles/libvirt/handlers/main.yaml diff --git a/ansible/roles/qemu-vm/tasks/main.yaml b/ansible/roles/libvirt/tasks/main.yaml similarity index 96% rename from ansible/roles/qemu-vm/tasks/main.yaml rename to ansible/roles/libvirt/tasks/main.yaml index cd05f88..40a2e98 100644 --- a/ansible/roles/qemu-vm/tasks/main.yaml +++ b/ansible/roles/libvirt/tasks/main.yaml @@ -30,7 +30,7 @@ throttle: 1 notify: reload-inventory -- name: Create the QEMU VM +- name: Create the libvirt VM become: true delegate_to: "{{ vm_host }}" block: @@ -39,7 +39,7 @@ command: define xml: "{{ lookup('template', 'vm-template.xml.j2') }}" -- name: Start the QEMU VM +- name: Start the libvirt VM community.libvirt.virt: name: "{{ inventory_hostname }}" command: start diff --git a/ansible/roles/qemu-vm/templates/vm-template.xml.j2 b/ansible/roles/libvirt/templates/vm-template.xml.j2 similarity index 100% rename from ansible/roles/qemu-vm/templates/vm-template.xml.j2 rename to ansible/roles/libvirt/templates/vm-template.xml.j2 diff --git a/ansible/site.yaml b/ansible/site.yaml index 53a7c7b..0e7c66a 100644 --- a/ansible/site.yaml +++ b/ansible/site.yaml @@ -1,9 +1,9 @@ --- -- name: Create QEMU VMs - hosts: qemu +- name: Create libvirt VMs + hosts: libvirt gather_facts: false roles: - - role: qemu-vm + - role: libvirt vars: pxe_done: false @@ -18,10 +18,10 @@ roles: - role: pxe-client -- name: Start QEMU VMs - hosts: qemu +- name: Start libvirt VMs + hosts: libvirt gather_facts: false roles: - - role: qemu-vm + - role: libvirt vars: pxe_done: true diff --git a/ansible/state.ini b/ansible/state.ini index 4ee0218..5fd5287 100644 --- a/ansible/state.ini +++ b/ansible/state.ini @@ -2,3 +2,6 @@ k8s-dev1-ctrl mac_address=52:54:00:11:45:d4 k8s-dev1-worker1 mac_address=52:54:00:e2:b1:5b k8s-dev1-worker2 mac_address=52:54:00:16:f4:20 +k8s-dev1-ctrl state=present +k8s-dev1-worker1 state=present +k8s-dev1-worker2 state=present