virt/tasks/main.yml
2019-04-10 20:27:12 +02:00

40 lines
1.1 KiB
YAML

---
# tasks file for vmserver
- name: install composant
pacman:
state: present # not required. choices: absent;latest;present. Desired state of the package.
name:
- libvirt
- bridge-utils
- dmidecode
- dnsmasq
- qemu-headless
# To create virtual machines
become: yes
notify: Enable and start libvirt services
- name: Add user to libvirt group
user:
name: '{{ username }}'
groups: libvirt
append: True
become: yes
- name: Enable libvirt hostname resolution
replace:
path: /etc/nsswitch.conf
regexp: '^hosts:\s+files\s+(?!libvirt)'
replace: 'hosts: files libvirt '
become: yes
- debug:
msg: "{{ ansible_default_ipv4.type }}"
- name: set bridge template
template:
dest: /etc/netctl/bridge # required. Location to render the template to on the remote machine.
src: bridge.j2 # required. Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or absolute path.
when: ansible_default_ipv4.type == "ether"
become: yes
notify: bridge_enable