iproute2: create role + playbook
This commit is contained in:
parent
058fe0b3f5
commit
e0c95b8f10
4 changed files with 47 additions and 0 deletions
17
playbooks/iproute2.yml
Executable file
17
playbooks/iproute2.yml
Executable 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
|
||||||
|
...
|
8
roles/iproute2/defaults/main.yml
Normal file
8
roles/iproute2/defaults/main.yml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
iproute2__default_tables:
|
||||||
|
local: 255
|
||||||
|
main: 254
|
||||||
|
default: 253
|
||||||
|
unspec: 0
|
||||||
|
iproute2__custom_tables: {}
|
||||||
|
...
|
17
roles/iproute2/tasks/main.yml
Normal file
17
roles/iproute2/tasks/main.yml
Normal 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) }}"
|
||||||
|
...
|
5
roles/iproute2/templates/rt_tables.j2
Normal file
5
roles/iproute2/templates/rt_tables.j2
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{{ ansible_managed | comment }}
|
||||||
|
|
||||||
|
{% for name, id in iproute2__tables.items() %}
|
||||||
|
{{ id }} {{ name }}
|
||||||
|
{% endfor %}
|
Loading…
Reference in a new issue