Add static network interface
This commit is contained in:
parent
1c3355e052
commit
ff709be0db
1
roles/base/defaults/main.yml
Normal file
1
roles/base/defaults/main.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
network_type: static
|
@ -6,6 +6,7 @@
|
|||||||
- name: Install network interfaces
|
- name: Install network interfaces
|
||||||
template:
|
template:
|
||||||
src: bridged-interface.cfg
|
src: bridged-interface.cfg
|
||||||
|
src: {{ network_type }}-interface.cfg
|
||||||
dest: /etc/network/interfaces
|
dest: /etc/network/interfaces
|
||||||
notify: reboot_host
|
notify: reboot_host
|
||||||
|
|
||||||
@ -13,3 +14,4 @@
|
|||||||
apt:
|
apt:
|
||||||
name: bridge-utils
|
name: bridge-utils
|
||||||
state: present
|
state: present
|
||||||
|
when: network_type == "bridged"
|
||||||
|
11
roles/base/templates/static-interface.cfg
Normal file
11
roles/base/templates/static-interface.cfg
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
# The loopback network interface
|
||||||
|
auto lo
|
||||||
|
iface lo inet loopback
|
||||||
|
|
||||||
|
# The primary network interface
|
||||||
|
auto {{ ip_inter }}
|
||||||
|
iface {{ ip_inter }} inet static
|
||||||
|
address {{ ip_addr }}
|
||||||
|
gateway {{ ip_gateway }}
|
Loading…
Reference in New Issue
Block a user