Deploy network interfaces from LDAP
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
28
roles/network-interfaces/tasks/main.yml
Normal file
28
roles/network-interfaces/tasks/main.yml
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
- name: Install vlan support
|
||||
apt:
|
||||
update_cache: true
|
||||
name: vlan
|
||||
state: present
|
||||
register: apt_result
|
||||
retries: 3
|
||||
until: apt_result is succeeded
|
||||
|
||||
- name: Deploy default interfaces config
|
||||
template:
|
||||
src: network/interfaces.j2
|
||||
dest: /etc/network/interfaces
|
||||
mode: 0644
|
||||
|
||||
- name: Remove cloud-init interface configuration
|
||||
file:
|
||||
path: /etc/network/interfaces.d/50-cloud-init
|
||||
state: absent
|
||||
|
||||
- name: Deploy interfaces config
|
||||
template:
|
||||
src: "network/interfaces.d/ifalias.j2"
|
||||
dest: "/etc/network/interfaces.d/{{ '%02d' | format(item.id) }}-{{ item.name | replace('_', '-') }}"
|
||||
mode: 0644
|
||||
when: item.name in interfaces
|
||||
loop: "{{ network_interfaces.vlan }}"
|
Reference in New Issue
Block a user