playbooks

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

commit 7e3d8fc4324934890b9459b660969953df51ada7
parent eb04a6f040a47121819504b533135028eab170bf
Author: pyratebeard <root@pyratebeard.net>
Date:   Wed, 22 May 2024 13:25:01 +0100

feat(libvirt): use template file

Diffstat:
Mhomelab/libvirt/playbook.yml | 8++++++++
Mhomelab/libvirt/vars.yml | 5++---
2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/homelab/libvirt/playbook.yml b/homelab/libvirt/playbook.yml @@ -79,6 +79,12 @@ meta \ allow-migrate=true + - name: "creation | rename tfstate file" + ansible.builtin.copy: + src: '{{ tofu_project }}/terraform.tfstate' + dest: '{{ tofu_project }}/{{ vm_name }}.tfstate' + delegate_to: localhost + rescue: - name: "rescue | stop cluster resource" ansible.builtin.shell: | @@ -94,6 +100,7 @@ community.general.terraform: project_path: '{{ tofu_project }}' state: absent + state_file: '{{ tofu_project }}/{{ vm_name }}.tfstate' delegate_to: localhost failed_when: false @@ -119,6 +126,7 @@ community.general.terraform: project_path: '{{ tofu_project }}' state: absent + state_file: '{{ tofu_project }}/{{ vm_name }}.tfstate' delegate_to: localhost - name: "removal | tidy up vm files" diff --git a/homelab/libvirt/vars.yml b/homelab/libvirt/vars.yml @@ -1,10 +1,9 @@ ## modify for vm creation vm_os: "debian12" # shortname as used in opentofu dir -#vm_name: "vm-{{ vm_os }}" -vm_name: "vm-webpage" +vm_name: "vm-{{ vm_os }}" vm_vcpus: "1" vm_mem: "1024" vm_size: "8589934592" # 8G #vm_size: "21474836480" # 20G -tofu_project: "~src/infra_code/libvirt/{{ vm_os }}/" +tofu_project: "~src/infra_code/libvirt/{{ vm_os }}"