2019-03-27 07:05:37 +00:00
|
|
|
---
|
|
|
|
- name: gather OS specific variables
|
2019-08-25 02:07:11 +00:00
|
|
|
include_vars: "{{ item }}"
|
2019-03-27 07:05:37 +00:00
|
|
|
with_first_found:
|
|
|
|
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
|
|
|
|
- "{{ ansible_distribution }}.yaml"
|
|
|
|
- "{{ ansible_os_family }}.yaml"
|
|
|
|
|
2019-08-25 02:07:11 +00:00
|
|
|
- name: systemd-networkd
|
|
|
|
include: systemd-networkd.yml
|
2019-10-05 21:43:05 +00:00
|
|
|
when: network_manage_systemd_networkd
|
2019-03-27 07:05:37 +00:00
|
|
|
|
2019-08-25 02:07:11 +00:00
|
|
|
- name: ifupdown
|
|
|
|
include: ifupdown.yml
|
2019-10-05 21:43:05 +00:00
|
|
|
when: network_manage_ifupdown
|
2019-03-27 07:05:37 +00:00
|
|
|
|
2019-08-25 02:07:11 +00:00
|
|
|
- name: netplan.io
|
|
|
|
include: netplan.yml
|
2019-10-05 21:43:05 +00:00
|
|
|
when: network_manage_netplan
|
2019-03-27 07:05:37 +00:00
|
|
|
|
|
|
|
# resolv.conf
|
|
|
|
|
|
|
|
- name: configure resolv.conf
|
|
|
|
template:
|
|
|
|
src: resolv.conf.j2
|
|
|
|
dest: /etc/resolv.conf
|
|
|
|
notify: restart systemd-resolved
|
2019-08-25 02:07:11 +00:00
|
|
|
when: _network_resolv_conf_enabled | bool
|
2019-03-27 07:05:37 +00:00
|
|
|
|
|
|
|
# systemd-resolved
|
|
|
|
|
|
|
|
- name: manage systemd-resolved service
|
|
|
|
service:
|
|
|
|
name: "{{ _network_systemd_resolved_service_name }}"
|
|
|
|
state: "{{ _network_systemd_resolved_enabled | ternary('started', 'stopped') }}"
|
|
|
|
enabled: "{{ _network_systemd_resolved_enabled }}"
|
|
|
|
|
|
|
|
- name: symlink /etc/resolv.conf
|
|
|
|
file:
|
|
|
|
src: /run/systemd/resolve/stub-resolv.conf
|
|
|
|
dest: /etc/resolv.conf
|
|
|
|
state: link
|
|
|
|
force: yes
|
2019-08-25 02:07:11 +00:00
|
|
|
when: _network_systemd_resolved_enabled | bool
|
2019-03-27 07:05:37 +00:00
|
|
|
|
|
|
|
- name: configure systemd-resolved
|
|
|
|
template:
|
|
|
|
src: resolved.conf.j2
|
|
|
|
dest: /etc/systemd/resolved.conf
|
|
|
|
notify: restart systemd-resolved
|
2019-08-25 02:07:11 +00:00
|
|
|
when: _network_systemd_resolved_enabled | bool
|
2019-03-27 07:05:37 +00:00
|
|
|
|
|
|
|
- name: remove systemd-resolved configuration
|
|
|
|
file:
|
|
|
|
path: /etc/systemd/resolved.conf
|
|
|
|
state: absent
|
2019-08-25 02:07:11 +00:00
|
|
|
when: not _network_systemd_resolved_enabled | bool
|
2019-03-27 07:05:37 +00:00
|
|
|
|
|
|
|
# vim:ft=yaml.ansible:
|