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
|
||||
template:
|
||||
src: bridged-interface.cfg
|
||||
src: {{ network_type }}-interface.cfg
|
||||
dest: /etc/network/interfaces
|
||||
notify: reboot_host
|
||||
|
||||
@ -13,3 +14,4 @@
|
||||
apt:
|
||||
name: bridge-utils
|
||||
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