Commit ba2916ec authored by Thomas Schneider's avatar Thomas Schneider
Browse files

Add ifupdown2 role

parent fc67b271
Pipeline #2220 passed with stage
in 1 minute and 45 seconds
---
- name: Reload interfaces
command: ifreload -a
---
- name: Install ifupdown2
apt:
name:
- ifupdown2
- name: Configure interfaces
template:
src: interfaces.j2
dest: /etc/network/interfaces
notify:
- Reload interfaces
- name: Disable systemd-networkd
systemd:
name: "{{ item }}"
enabled: false
state: stopped
loop:
- systemd-networkd.service
- systemd-networkd.socket
- systemd-networkd-wait-online.service
- name: Enable and start networking
systemd:
name: networking.service
enabled: true
state: started
{% macro delist(key, val) -%}
{% if val is iterable and not val is string %}
{% for v in val %}
{{ key }} {{ v }}
{% endfor %}
{% else %}
{{ key }} {{ val }}
{% endif %}
{%- endmacro %}
{{ ansible_managed | comment }}
source /etc/network/interfaces.d/*
{% for iface in interfaces %}
{% if iface.auto | default(True) %}
auto {{ iface.name }}
{% endif %}
{% if iface.allow | default(False) %}
allow-{{ iface.allow }} {{ iface.name }}
{% endif %}
iface {{ iface.name }} {{ iface.family | default("") }} {{ iface.method | default("") }}
{% if iface.config is defined %}{% for k, v in iface.config.items() %}
{{ delist(k, v) }}
{%- endfor %}{% endif %}
{% if not loop.last %}
{% endif %}
{% endfor %}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment