2019-08-25 02:07:11 +00:00
|
|
|
---
|
|
|
|
# systemd-networkd
|
|
|
|
|
|
|
|
- name: manage systemd-networkd package
|
|
|
|
package:
|
|
|
|
name: "{{ _network_systemd_networkd_package_name }}"
|
|
|
|
state: "{{ _network_systemd_networkd_enabled | ternary('present', 'absent') }}"
|
|
|
|
when: _systemd_networkd_package_name is defined
|
|
|
|
|
|
|
|
- name: manage systemd-networkd service
|
|
|
|
service:
|
|
|
|
name: "{{ _network_systemd_networkd_service_name }}"
|
|
|
|
state: "{{ _network_systemd_networkd_enabled | ternary('started', 'stopped') }}"
|
|
|
|
enabled: "{{ _network_systemd_networkd_enabled }}"
|
|
|
|
|
|
|
|
- name: configure systemd-networkd
|
|
|
|
template:
|
|
|
|
src: systemd-network.j2
|
|
|
|
dest: "/etc/systemd/network/05-{{ item.name }}.network"
|
|
|
|
notify: restart systemd-networkd
|
|
|
|
with_items: "{{ network_interfaces }}"
|
2019-10-05 21:43:05 +00:00
|
|
|
when:
|
|
|
|
- network_interfaces is defined
|
|
|
|
- _network_systemd_networkd_enabled | bool
|
2019-08-25 02:07:11 +00:00
|
|
|
|
2019-10-05 21:43:05 +00:00
|
|
|
- name: configure systemd-networkd default interface
|
|
|
|
template:
|
|
|
|
src: systemd-network.j2
|
|
|
|
dest: "/etc/systemd/network/05-{{ ansible_default_ipv4.interface }}.network"
|
|
|
|
notify: restart systemd-networkd
|
|
|
|
when:
|
|
|
|
- network_interfaces is not defined
|
|
|
|
- _network_systemd_networkd_enabled | bool
|