2019-04-09 17:42:12 +00:00
|
|
|
---
|
|
|
|
# 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:
|
2019-04-10 18:27:12 +00:00
|
|
|
msg: "{{ ansible_default_ipv4.type }}"
|
2019-04-09 17:42:12 +00:00
|
|
|
|
|
|
|
- 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.
|
2019-04-10 18:27:12 +00:00
|
|
|
when: ansible_default_ipv4.type == "ether"
|
2019-04-09 17:42:12 +00:00
|
|
|
become: yes
|
|
|
|
notify: bridge_enable
|