77 lines
2.0 KiB
YAML
77 lines
2.0 KiB
YAML
---
|
|
- name: gather OS specific variables
|
|
ansible.builtin.include_vars: "{{ lookup('ansible.builtin.first_found', params) }}"
|
|
vars:
|
|
params:
|
|
files:
|
|
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
|
|
- "{{ ansible_distribution }}.yaml"
|
|
- "{{ ansible_os_family }}.yaml"
|
|
- "default.yaml"
|
|
paths:
|
|
- vars
|
|
|
|
- name: run os specific tasks
|
|
ansible.builtin.include_tasks: "{{ lookup('ansible.builtin.first_found', params) }}"
|
|
vars:
|
|
params:
|
|
files:
|
|
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
|
|
- "{{ ansible_distribution }}.yaml"
|
|
- "{{ ansible_os_family }}.yaml"
|
|
- "default.yaml"
|
|
paths:
|
|
- tasks
|
|
|
|
- name: systemd-networkd
|
|
include: systemd-networkd.yml
|
|
when: network_manage_systemd_networkd
|
|
|
|
- name: ifupdown
|
|
include: ifupdown.yml
|
|
when: network_manage_ifupdown
|
|
|
|
- name: netplan.io
|
|
include: netplan.yml
|
|
when: network_manage_netplan
|
|
|
|
# resolv.conf
|
|
|
|
- name: configure resolv.conf
|
|
template:
|
|
src: resolv.conf.j2
|
|
dest: /etc/resolv.conf
|
|
notify: restart systemd-resolved
|
|
when: _network_resolv_conf_enabled | bool
|
|
|
|
# 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
|
|
when: _network_systemd_resolved_enabled | bool
|
|
|
|
- name: configure systemd-resolved
|
|
template:
|
|
src: resolved.conf.j2
|
|
dest: /etc/systemd/resolved.conf
|
|
notify: restart systemd-resolved
|
|
when: _network_systemd_resolved_enabled | bool
|
|
|
|
- name: remove systemd-resolved configuration
|
|
file:
|
|
path: /etc/systemd/resolved.conf
|
|
state: absent
|
|
when: not _network_systemd_resolved_enabled | bool
|
|
|
|
# vim:ft=yaml.ansible:
|