aboutsummaryrefslogtreecommitdiffstats
path: root/roles/bhyve
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-04-26 10:37:28 +0200
committerRomain Gonçalves <me@rgoncalves.se>2021-04-26 10:37:28 +0200
commit7862b34711c45430b78c0c10b2b132d78dea911e (patch)
tree2af9e303fbcb8c79614e506f122667fdcda8e383 /roles/bhyve
parent39a9313d2e0a91889f8a45ff100653af1b7c1bc4 (diff)
downloadinfrastructure-7862b34711c45430b78c0c10b2b132d78dea911e.tar.gz
bhyve: Use default and cleaner control
Diffstat (limited to 'roles/bhyve')
-rw-r--r--roles/bhyve/defaults/main.yml (renamed from roles/bhyve/vars/main.yml)4
-rw-r--r--roles/bhyve/tasks/main.yml9
2 files changed, 6 insertions, 7 deletions
diff --git a/roles/bhyve/vars/main.yml b/roles/bhyve/defaults/main.yml
index bb78f0d..c237cac 100644
--- a/roles/bhyve/vars/main.yml
+++ b/roles/bhyve/defaults/main.yml
@@ -1,5 +1,5 @@
-# bhyve ~~ roles/bhyve/vars/main.yml
+# bhyve ~~ roles/bhyve/defaults/main.yml
# main variables for all bhyve tasks
---
@@ -8,8 +8,8 @@ bhyve_dir: "/data/bhyve"
bhyve_user: "bhyve"
bhyve_group: "bhyve"
bhyve_bootdelay: "3"
+bhyve_strict: true
bhyve_iso:
- https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/x86_64/alpine-virt-3.13.0-x86_64.iso
- https://cdn.openbsd.org/pub/OpenBSD/6.8/amd64/cd68.iso
-
diff --git a/roles/bhyve/tasks/main.yml b/roles/bhyve/tasks/main.yml
index 03d2d96..f47be53 100644
--- a/roles/bhyve/tasks/main.yml
+++ b/roles/bhyve/tasks/main.yml
@@ -68,18 +68,17 @@
dest: "{{ bhyve_dir }}/.iso"
loop: "{{ bhyve_iso }}"
-- name: retrieve all deprecated vms
+- name: retrieve all active vms
find:
path: "{{ bhyve_dir }}"
file_type: directory
- register: deprecated_vms
+ register: active_vms
- name: delete all deprecated vms
file:
path: "{{ item[1].path }}"
state: absent
- when: (item[1].path | basename) not in "{{ valid_vms }}"
+ when: bhyve_strict and (item[1].path | basename) not in "{{ valid_vms }}"
with_nested:
- "{{ vms }}"
- - "{{ deprecated_vms.files }}"
-
+ - "{{ active_vms.files }}"
remember that computers suck.