templier-ansible/roles/network-interfaces/tasks/main.yml
Yohann D'ANELLO f1ac6f269b
Deploy network interfaces from LDAP
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2021-06-04 17:02:54 +02:00

29 lines
708 B
YAML

---
- 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 }}"