playbooks

ansible config management
git clone git://git.pyratebeard.net/playbooks.git
Log | Files | Refs | README

commit 670e9c3bea5504dd460e000f3d9e0da84f65612d
parent 10ef2e89284aada09108e6600e902bbb0e55c4d5
Author: pyratebeard <root@pyratebeard.net>
Date:   Thu,  9 May 2024 15:36:39 +0100

homelab | libvirt | var to set vm_size. add 'vm-' prefix to vm_name. set failed_when to false on rescue tasks

Diffstat:
Mhomelab/libvirt/playbook.yml | 4++++
Mhomelab/libvirt/vars.yml | 4+++-
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/homelab/libvirt/playbook.yml b/homelab/libvirt/playbook.yml @@ -81,6 +81,7 @@ vm_name: "{{ vm_name }}" vm_vcpus: "{{ vm_vcpus }}" vm_mem: "{{ vm_mem }}" + vm_size: "{{ vm_size }}" force_init: true - name: "creation | shutdown vm & dumpxml" @@ -101,15 +102,18 @@ ansible.builtin.shell: | virsh list --all | grep {{ vm_name }} | grep "shut off" >/dev/null || \ virsh destroy {{ vm_name }} + failed_when: false - name: "creation rescue | undefine vm" ansible.builtin.shell: | virsh undefine {{ vm_name }} + failed_when: false - name: "creation rescue | remove vm files" ansible.builtin.file: path: "/labfs/{{ vm_name }}.{{ item }}" state: absent + failed_when: false with_items: - qcow2 - xml diff --git a/homelab/libvirt/vars.yml b/homelab/libvirt/vars.yml @@ -1,8 +1,10 @@ ## modify for vm creation vm_os: "debian12" # shortname as used in terraform dir -vm_name: "{{ vm_os }}" +vm_name: "vm-{{ vm_os }}" vm_vcpus: "2" vm_mem: "2048" +vm_size: "8589934592" # 8G +#vm_size: "21474836480" # 20G terraform_project: "~src/infra_code/libvirt/{{ vm_os }}/" project_files: "/tmp/terraform_project_files"