make sprachenatelier working..

This commit is contained in:
2022-02-20 23:36:51 +01:00
parent 42c3774ca6
commit 1c57c66dca
87 changed files with 19196 additions and 1382 deletions

View File

@ -0,0 +1,59 @@
---
- name: (interfaces.yml) Check if file /etc/network/interfaces.ORIG exists
stat:
path: /etc/network/interfaces.ORIG
register: stat_result
tags:
- network-interfaces
- name: (interfaces.yml) Backup existing file '/etc/network/interfaces'
command: cp -a /etc/network/interfaces /etc/network/interfaces.ORIG
when: stat_result.stat.exists == False
tags:
- network-interfaces
- name: (interfaces.yml) Ensure interfaces file is latest
template:
src: "etc/network/interfaces.j2"
dest: /etc/network/interfaces
with_items: network_interfaces
tags:
- network-interfaces
- name: (interfaces.yml) Ensure imported device files at interfaces.d are latest
template:
src: "etc/network/interfaces.d/device.j2"
dest: "{{ network_interface_path }}/device-{{ item.0 }}"
with_items:
- "{{network_interfaces | default([]) | groupby('device') }}"
register: network_configuration_result
tags:
- network-interfaces
# ---
# Remove device files not configured here
# ---
- name: (interfaces.yml) list existing files
find:
path: "{{ network_interface_path }}"
file_type: file
register: files_matched
tags:
- network-interfaces
- name: (interfaces.yml) configured files
set_fact:
network_configured_files: >
[{% for item in network_configuration_result.results | default([]) -%}
u"{{ item.dest | default(item.path) }}"
{{ '' if loop.last else ',' }}
{%- endfor %}]
- name: (interfaces.yml) remove configurations
file:
dest: "{{ item.path }}"
state: absent
when: item.path not in network_configured_files
with_items: "{{ files_matched.files | default([]) }}"

View File

@ -0,0 +1,14 @@
---
- import_tasks: packages.yml
when: network_interfaces is defined and network_manage_devices|bool
tags:
- networking
- network_interfaces
- import_tasks: interfaces.yml
when: network_interfaces is defined and network_manage_devices|bool
tags:
- networking
- network_interfaces

View File

@ -0,0 +1,15 @@
---
- name: (packages.yml) Ensure basic networking tools are installed
apt:
pkg: "{{ network_interface_required_packages }}"
state: present
update_cache: yes
cache_valid_time: 86400
- name: Enable service systemd-resolved
ansible.builtin.systemd:
name: systemd-resolved
enabled: yes
masked: no