Use path variables for bhyve. Changes #31

This commit is contained in:
Crest 2022-07-04 02:58:24 +02:00
parent 50a3a3d270
commit f8704927fb

View file

@ -1,7 +1,7 @@
--- ---
- name: Define bhyve guest service definitions - name: Define bhyve guest service definitions
file: file:
path: '/etc/s6-rc/service/bhyve-{{ item.0.name }}{{ item.1 }}' path: '{{ s6_etc_dir }}/service/bhyve-{{ item.0.name }}{{ item.1 }}'
state: directory state: directory
owner: root owner: root
group: wheel group: wheel
@ -16,7 +16,7 @@
- name: Instantiating service templates - name: Instantiating service templates
template: template:
dest: '/etc/s6-rc/service/bhyve-{{ item.0.name }}{{ item.1.name }}' dest: '{{ s6_etc_dir }}/service/bhyve-{{ item.0.name }}{{ item.1.name }}'
src: 'bhyve{{ item.1.name }}.j2' src: 'bhyve{{ item.1.name }}.j2'
owner: root owner: root
group: wheel group: wheel
@ -34,7 +34,7 @@
- name: Start enabled bhyve guests - name: Start enabled bhyve guests
command: > command: >
fdmove -c 2 1 s6-rc -v 2 -u change bhyve-{{ item.name }} fdmove -c 2 1 s6-rc -l {{ s6_live_dir }} -v 2 -u change bhyve-{{ item.name }}
register: change register: change
when: item.enabled | default when: item.enabled | default
changed_when: change.stdout | length > 0 changed_when: change.stdout | length > 0
@ -52,13 +52,13 @@
notify: notify:
- Reload s6-rc - Reload s6-rc
with_items: with_items:
- /etc/s6-rc/service/bhyve - '{{ s6_etc_dir }}/service/bhyve'
- /etc/s6-rc/service/bhyve-disabled - '{{ s6_etc_dir }}/service/bhyve-disabled'
- /etc/s6-rc/service/bhyve-enabled - '{{ s6_etc_dir }}/service/bhyve-enabled'
- name: Declare bhyve service as bundle - name: Declare bhyve service as bundle
copy: copy:
dest: '/etc/s6-rc/service/{{ item }}/type' dest: '{{ s6_etc_dir }}/service/{{ item }}/type'
content: bundle content: bundle
owner: root owner: root
group: wheel group: wheel
@ -72,7 +72,7 @@
- name: Define bhyve service bundles - name: Define bhyve service bundles
template: template:
dest: '/etc/s6-rc/service/{{ item }}/contents' dest: '{{ s6_etc_dir }}/service/{{ item }}/contents'
src: '{{ item }}-contents.j2' src: '{{ item }}-contents.j2'
owner: root owner: root
group: wheel group: wheel
@ -89,13 +89,13 @@
- name: Stop disabled bhyve guests - name: Stop disabled bhyve guests
command: > command: >
fdmove -c 2 1 s6-rc -v 2 -d change bhyve-disabled fdmove -c 2 1 s6-rc -l {{ s6_live_dir }} -v 2 -d change bhyve-disabled
register: change register: change
changed_when: change.stdout | length > 0 changed_when: change.stdout | length > 0
- name: Autostart enabled bhyve guests - name: Autostart enabled bhyve guests
lineinfile: lineinfile:
path: /etc/s6-rc/service/enabled/contents path: '{{ s6_etc_dir }}/service/enabled/contents'
regexp: '^bhyve-enabled$' regexp: '^bhyve-enabled$'
line: 'bhyve-enabled' line: 'bhyve-enabled'
notify: notify: