This commit is contained in:
2021-11-05 15:17:48 +01:00
parent f662fe0f30
commit 466c99375c
36 changed files with 5444 additions and 215 deletions

View File

@ -6,3 +6,10 @@
state: present
update_cache: yes
cache_valid_time: 86400
- name: Enable service systemd-resolved
ansible.builtin.systemd:
name: systemd-resolved
enabled: yes
masked: no

View File

@ -3,7 +3,7 @@
{# {% for config in network_interfaces %} #}
{% for config in item.1 %}
{% if config.headline is defined %}
{% if config.headline is defined and config.headline %}
#-----------------------------
# {{ config.headline }}
#-----------------------------
@ -18,10 +18,10 @@ allow-{{ stanza }}
{% endfor -%}
iface {{ config.device }} {{ config.family | default('inet', true) }} {{ config.method | default('static', true) }}
{% if config.method == "static" %}
{% if config.description is defined %}
{% if (config.description is defined and config.description) %}
description {{ config.description }}
{% endif %}
{% if config.hwaddress is defined %}
{% if config.hwaddress is defined and config.hwaddress %}
hwaddress {{ config.hwaddress }}
{% endif %}
{% if (config.address is defined) and (0 < config.address | length) %}
@ -33,28 +33,28 @@ iface {{ config.device }} {{ config.family | default('inet', true) }} {{ config.
{% endif -%}
{% set iface_keys = ['gateway', 'metric', 'pointopoint', 'mtu', 'scope'] %}
{% for key in iface_keys %}
{% if key in config %}
{% if key in config and config[key] %}
{{ key }} {{ config[key] }}
{% endif %}
{% endfor -%}
{% elif config.method == "manual" %}
{% set iface_keys = ['hwaddress', 'mtu'] %}
{% for key in iface_keys %}
{% if key in config %}
{% if key in config and config[key] %}
{{ key }} {{ config[key] }}
{% endif %}
{% endfor -%}
{% elif config.method == "dhcp" %}
{% set iface_keys = ['hwaddress', 'hostname', 'metric', 'leasehours', 'vendor', 'client' ] %}
{% for key in iface_keys %}
{% if key in config %}
{% if key in config and config[key] %}
{{ key }} {{ config[key] }}
{% endif %}
{% endfor -%}
{% elif config.method == "bootp" %}
{% set iface_keys = ['hwaddr', 'bootfile', 'server'] %}
{% for key in iface_keys %}
{% if key in config %}
{% if key in config and config[key] %}
{{ key }} {{ config[key] }}
{% endif %}
{% endfor -%}
@ -62,15 +62,20 @@ iface {{ config.device }} {{ config.family | default('inet', true) }} {{ config.
{# #}
{# nameservers #}
{%- if (config.nameservers is defined) and (0 < config.nameservers | length) %}
{%- if (config.nameservers is defined and config.nameservers) or (config.search is defined and config.search) %}
# dns-* options are implemented by the resolvconf package, if installed
# sets entries in /etc/resolv.conf
#
dns-nameservers {{ config.nameservers | join(' ') }}
{% endif -%}
{% if config.search is defined and config.search %}
dns-search {{ config.search }}
{% endif -%}
{%- if (config.nameservers is defined) and config.nameservers %}
{% for _ip in config.nameservers %}
dns-nameserver {{ _ip }}
{% endfor %}
{% endif %}
{% if config.dns_search is defined %}
dns-search {{ config.dns_search }}
{%- if (config.nameservers is defined and config.nameservers) or (config.search is defined and config.search) %}
{% endif -%}
{# #}