56 lines
1.1 KiB
YAML
56 lines
1.1 KiB
YAML
|
---
|
||
|
- name: Generate VM service files from inventory
|
||
|
delegate_to: localhost
|
||
|
register: systemd_files
|
||
|
run_once: true
|
||
|
command: "python3 ../bin/generate-systemd-vms.py {{ inventory_file }}"
|
||
|
|
||
|
- name: Install virtualization packages
|
||
|
become: yes
|
||
|
package:
|
||
|
name:
|
||
|
- edk2-ovmf
|
||
|
- qemu-headless
|
||
|
- ddrescue
|
||
|
state: present
|
||
|
|
||
|
- name: Copy VM definitions
|
||
|
become: yes
|
||
|
register: vmdefs
|
||
|
copy:
|
||
|
src: vm-definitions/
|
||
|
dest: /usr/lib/systemd/system
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: 0644
|
||
|
|
||
|
- name: Reload systemd daemon
|
||
|
become: yes
|
||
|
when: vmdefs.changed
|
||
|
systemd:
|
||
|
daemon_reload: yes
|
||
|
|
||
|
- name: QEMU Bridge Config
|
||
|
become: yes
|
||
|
copy:
|
||
|
src: bridge.conf
|
||
|
dest: /etc/qemu/bridge.conf
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: 0644
|
||
|
|
||
|
- name: System bridge interface
|
||
|
become: yes
|
||
|
register: br0
|
||
|
copy:
|
||
|
src: br0
|
||
|
dest: /etc/netctl/br0
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: 0644
|
||
|
|
||
|
- name: Enable bridge
|
||
|
become: yes
|
||
|
when: br0.changed
|
||
|
command: "/bin/bash -l -c 'netctl enable br0 && netctl restart br0'"
|