add nsswhitch config for dns
This commit is contained in:
parent
6c0fb2e5f1
commit
4b284946e1
@ -2,17 +2,17 @@
|
|||||||
# tasks file for vmserver
|
# tasks file for vmserver
|
||||||
- name: install composant
|
- name: install composant
|
||||||
pacman:
|
pacman:
|
||||||
state: present # not required. choices: absent;latest;present. Desired state of the package.
|
state: present # not required. choices: absent;latest;present. Desired state of the package.
|
||||||
name:
|
name:
|
||||||
- libvirt
|
- libvirt
|
||||||
- bridge-utils
|
- bridge-utils
|
||||||
- dmidecode
|
- dmidecode
|
||||||
- dnsmasq
|
- dnsmasq
|
||||||
- ovmf
|
- ovmf
|
||||||
# To create virtual machines
|
# To create virtual machines
|
||||||
become: yes
|
become: yes
|
||||||
notify: Enable and start libvirt services
|
notify: Enable and start libvirt services
|
||||||
|
|
||||||
- name: Add user to libvirt group
|
- name: Add user to libvirt group
|
||||||
user:
|
user:
|
||||||
name: '{{ user.name }}'
|
name: '{{ user.name }}'
|
||||||
@ -33,16 +33,24 @@
|
|||||||
src: qemu.conf.j2 # required. Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or absolute path.
|
src: qemu.conf.j2 # required. Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or absolute path.
|
||||||
become: yes
|
become: yes
|
||||||
- debug:
|
- debug:
|
||||||
msg: "{{ ansible_default_ipv4.type }}"
|
msg: '{{ ansible_default_ipv4.type }}'
|
||||||
|
|
||||||
- name: set bridge template
|
- name: set bridge template
|
||||||
template:
|
template:
|
||||||
dest: /etc/netctl/bridge # required. Location to render the template to on the remote machine.
|
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.
|
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" and "wlp2s0" not in ansible_interfaces
|
when: ansible_default_ipv4.type == "ether" and "wlp2s0" not in ansible_interfaces
|
||||||
become: yes
|
become: yes
|
||||||
notify: bridge_enable
|
notify: bridge_enable
|
||||||
|
|
||||||
|
- name: add libvirt to nsswitch hosts
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
dest: '/etc/nsswitch.conf'
|
||||||
|
regexp: '^hosts:'
|
||||||
|
line: 'hosts: files libvirt libvirt_guest mymachines myhostname resolve [!UNAVAIL=return] dns'
|
||||||
|
state: present
|
||||||
|
create: true
|
||||||
|
become: true
|
||||||
- name: enable bridge
|
- name: enable bridge
|
||||||
systemd:
|
systemd:
|
||||||
name: netctl@bridge.service
|
name: netctl@bridge.service
|
||||||
@ -54,4 +62,3 @@
|
|||||||
name: dhcpcd # required. Name of the service.
|
name: dhcpcd # required. Name of the service.
|
||||||
enabled: false
|
enabled: false
|
||||||
become: yes
|
become: yes
|
||||||
|
|
Loading…
Reference in New Issue
Block a user