Real inital commit
parent
3e13c56880
commit
6a946541d5
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
|
||||
- name: networkd | Reload configuration
|
||||
systemd:
|
||||
name: systemd-networkd
|
||||
state: restarted
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
|
||||
- name: networkd | Deploy .link configs
|
||||
template:
|
||||
src: networkd.j2
|
||||
dest: "/etc/systemd/network/{{ item.priority }}-{{ item.name }}.link"
|
||||
mode: 644
|
||||
owner: root
|
||||
group: root
|
||||
with_items: "{{ networkd.link | default([]) }}"
|
||||
register: networkd_deployed_link
|
||||
notify: networkd | Reload configuration
|
||||
|
||||
- name: networkd | Deploy .netdev configs
|
||||
template:
|
||||
src: networkd.j2
|
||||
dest: "/etc/systemd/network/{{ item.priority }}-{{ item.name }}.netdev"
|
||||
mode: 644
|
||||
owner: root
|
||||
group: root
|
||||
with_items: "{{ networkd.netdev | default([]) }}"
|
||||
register: networkd_deployed_netdev
|
||||
notify: networkd | Reload configuration
|
||||
|
||||
- name: networkd | Deploy .network configs
|
||||
template:
|
||||
src: networkd.j2
|
||||
dest: "/etc/systemd/network/{{ item.priority }}-{{ item.name }}.network"
|
||||
mode: 644
|
||||
owner: root
|
||||
group: root
|
||||
with_items: "{{ networkd.network | default([]) }}"
|
||||
register: networkd_deployed_network
|
||||
notify: networkd | Reload configuration
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
|
||||
- import_tasks: deploy_configs.yml
|
||||
|
||||
- import_tasks: remove_unmanaged.yml
|
||||
|
||||
- name: networkd | Deploy resolv.conf
|
||||
template:
|
||||
src: resolv.conf.j2
|
||||
dest: /etc/resolv.conf
|
||||
mode: 644
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: networkd | Enable and start service
|
||||
systemd:
|
||||
name: systemd-networkd
|
||||
state: started
|
||||
enabled: yes
|
||||
|
||||
- name: networkd | Run handlers now
|
||||
meta: flush_handlers
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- name: networkd | Collect file list in network dir
|
||||
find:
|
||||
path: /etc/systemd/network
|
||||
hidden: yes
|
||||
register: networkd_found_files
|
||||
check_mode: no
|
||||
changed_when: false
|
||||
|
||||
- name: networkd | Remove unmanaged files
|
||||
file:
|
||||
path: "/etc/systemd/network/{{ item.path | basename }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- "{{ networkd_found_files.files }}"
|
||||
when:
|
||||
- (item.path) not in ( networkd_deployed_link | json_query('results[].invocation.module_args.dest') | default([]) )
|
||||
- (item.path) not in ( networkd_deployed_netdev | json_query('results[].invocation.module_args.dest') | default([]) )
|
||||
- (item.path) not in ( networkd_deployed_network | json_query('results[].invocation.module_args.dest') | default([]) )
|
||||
notify: networkd | Reload configuration
|
|
@ -0,0 +1,12 @@
|
|||
# {{ ansible_managed }}
|
||||
{% for section in item.content %}
|
||||
{% for section_name, section_params in section.items() %}
|
||||
|
||||
[{{ section_name }}]
|
||||
{% for item in section_params %}
|
||||
{% for key, value in item.items() %}
|
||||
{{ key }}={{ value }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
|
@ -0,0 +1,4 @@
|
|||
# {{ ansible_managed }}
|
||||
{% for item in networkd_resolver %}
|
||||
{{ item }}
|
||||
{% endfor %}
|
Loading…
Reference in New Issue