iproute2: create role + playbook

This commit is contained in:
jeltz 2023-07-04 03:45:29 +02:00
parent 058fe0b3f5
commit e0c95b8f10
Signed by: jeltz
GPG key ID: 800882B66C0C3326
4 changed files with 47 additions and 0 deletions

17
playbooks/iproute2.yml Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env ansible-playbook
---
- hosts:
- edge-1.back.infra.auro.re
- edge-2.back.infra.auro.re
- isp-1.back.infra.auro.re
- isp-2.back.infra.auro.re
- infra-1.back.infra.auro.re
- infra-2.back.infra.auro.re
- vpn-1.back.infra.auro.re
- vpn-2.back.infra.auro.re
vars:
iproute2__custom_tables:
bird: 100
roles:
- iproute2
...

View file

@ -0,0 +1,8 @@
---
iproute2__default_tables:
local: 255
main: 254
default: 253
unspec: 0
iproute2__custom_tables: {}
...

View file

@ -0,0 +1,17 @@
---
- name: Ensure that default and custom tables names don't overlap
assert:
that: "not (iproute2__default_tables.keys()
| intersect(iproute2__custom_tables.keys()))"
- name: Configure rt_tables
template:
src: rt_tables.j2
dest: /etc/iproute2/rt_tables
owner: root
group: root
mode: u=rw,g=r,o=r
vars:
iproute2__tables: "{{ iproute2__default_tables
| combine(iproute2__custom_tables) }}"
...

View file

@ -0,0 +1,5 @@
{{ ansible_managed | comment }}
{% for name, id in iproute2__tables.items() %}
{{ id }} {{ name }}
{% endfor %}