1
0
IaC/ansible/roles/systemd_networkd/tasks/main.yaml

40 lines
892 B
YAML

---
- name: Clear systemd-networkd config directory
ansible.builtin.file:
path: "/etc/systemd/network/"
state: "{{ item }}"
owner: root
group: root
mode: '0755'
with_items:
- absent
- directory
- name: Create systemd-networkd config files
ansible.builtin.template:
src: "{{ item.src }}"
dest: /etc/systemd/network/"{{ item.name }}"
owner: root
group: root
mode: '0644'
loop: "{{ systemd_networkd_configs }}"
notify:
- Restart systemd-resolved
- Restart systemd-networkd
- name: Disable non-systemd networking services
ansible.builtin.service:
name: "{{ item }}"
state: stopped
enabled: false
loop: "{{ default_network_services[ansible_os_family] }}"
- name: Enable systemd networking
ansible.builtin.service:
name: "{{ item }}"
enabled: true
loop:
- systemd-networkd
- systemd-resolved