Iterate over a variable for network management

This commit is contained in:
Kris Lamoureux 2021-04-15 22:52:43 -04:00
parent 9075aab593
commit 8192f76787
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
2 changed files with 6 additions and 5 deletions

View File

@ -9,8 +9,9 @@
- name: Install network interfaces
template:
src: "{{ network_type }}-interface.cfg"
dest: "/etc/network/interfaces.d/{{ ip_inter }}"
dest: "/etc/network/interfaces.d/{{ item.name }}"
notify: reboot_host
loop: "{{ interfaces }}"
- name: Install bridge utilities
apt:

View File

@ -1,7 +1,7 @@
# {{ ansible_managed }}
# The primary network interface
auto {{ ip_inter }}
iface {{ ip_inter }} inet static
address {{ ip_addr }}
gateway {{ ip_gateway }}
auto {{ item.name }}
iface {{ item.name }} inet static
address {{ item.address }}
gateway {{ item.gateway }}