Simplify to a single network interface template
This commit is contained in:
parent
8192f76787
commit
44ec2ae197
@ -8,13 +8,12 @@
|
||||
|
||||
- name: Install network interfaces
|
||||
template:
|
||||
src: "{{ network_type }}-interface.cfg"
|
||||
src: "interface.j2"
|
||||
dest: "/etc/network/interfaces.d/{{ item.name }}"
|
||||
notify: reboot_host
|
||||
loop: "{{ interfaces }}"
|
||||
notify: reboot_host
|
||||
|
||||
- name: Install bridge utilities
|
||||
apt:
|
||||
name: bridge-utils
|
||||
state: present
|
||||
when: network_type == "bridged"
|
||||
|
@ -1,10 +0,0 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
# The primary network interface
|
||||
auto br1
|
||||
iface br1 inet static
|
||||
address {{ ip_addr }}
|
||||
gateway {{ ip_gateway }}
|
||||
bridge_ports {{ ip_inter }}
|
||||
bridge_stp on
|
||||
ethernet-wol g
|
16
roles/base/templates/interface.j2
Normal file
16
roles/base/templates/interface.j2
Normal file
@ -0,0 +1,16 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{% if item.bridge is defined %}
|
||||
auto br1
|
||||
iface br1 inet static
|
||||
{% else %}
|
||||
auto {{ item.name }}
|
||||
iface {{ item.name }} inet static
|
||||
{% endif %}
|
||||
address {{ item.address }}
|
||||
{% if item.gateway is defined %}
|
||||
gateway {{ item.gateway }}
|
||||
{% endif %}
|
||||
{% if item.bridge is defined %}
|
||||
bridge_ports {{ item.name }}
|
||||
{% endif %}
|
@ -1,7 +0,0 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
# The primary network interface
|
||||
auto {{ item.name }}
|
||||
iface {{ item.name }} inet static
|
||||
address {{ item.address }}
|
||||
gateway {{ item.gateway }}
|
Loading…
Reference in New Issue
Block a user