Roles service-bird[|-ffrl|-icvpn]: rework handlers

This commit is contained in:
Tobias Hachmer 2017-10-04 19:46:16 +02:00
parent 94da0613a4
commit c4ed75ed36
6 changed files with 95 additions and 63 deletions

View file

@ -1,10 +1,10 @@
---
- name: reload bird4
- name: reload systemd unit bird
systemd:
name: bird
state: reloaded
- name: reload bird6
- name: reload systemd unit bird6
systemd:
name: bird6
state: reloaded

View file

@ -1,24 +1,36 @@
---
- name: write ffrl bird configuration
- name: write ffrl_ipv4.conf.j2
template:
src: ffrl_ipv{{ item }}.conf.j2
dest: /etc/bird/ffrl_ipv{{ item }}.conf
src: ffrl_ipv4.conf.j2
dest: /etc/bird/ffrl_ipv4.conf
mode: 0640
owner: bird
group: bird
notify: reload bird{{ item }}
with_items:
- 4
- 6
notify: reload systemd unit bird
- name: write ffrl peer configuration
- name: write ffrl_ipv6.conf.j2
template:
src: ffrl_ipv{{ item }}_peers.conf.j2
dest: /etc/bird/ffrl_ipv{{ item }}_peers.conf
src: ffrl_ipv6.conf.j2
dest: /etc/bird/ffrl_ipv6.conf
mode: 0640
owner: bird
group: bird
notify: reload bird{{ item }}
with_items:
- 4
- 6
notify: reload systemd unit bird6
- name: write ffrl_ipv4_peers.conf
template:
src: ffrl_ipv4_peers.conf.j2
dest: /etc/bird/ffrl_ipv4_peers.conf
mode: 0640
owner: bird
group: bird
notify: reload systemd unit bird
- name: write ffrl_ipv6_peers.conf
template:
src: ffrl_ipv6_peers.conf.j2
dest: /etc/bird/ffrl_ipv6_peers.conf
mode: 0640
owner: bird
group: bird
notify: reload systemd unit bird6

View file

@ -1,10 +1,10 @@
---
- name: reload bird4
- name: reload systemd unit bird
systemd:
name: bird
state: reloaded
- name: reload bird6
- name: reload systemd unit bird6
systemd:
name: bird6
state: reloaded

View file

@ -1,39 +1,49 @@
---
- name: write initial icvpn peers
shell: /usr/bin/python3 /home/admin/clones/icvpn-scripts/mkbgp -{{ item }} -f bird -x mwu -d ebgp_icvpn -s /home/admin/clones/icvpn-meta > /etc/bird/icvpn_ipv{{ item }}_peers.conf
- name: generate initial icvpn_ipv4_peers.conf
shell: /usr/bin/python3 /home/admin/clones/icvpn-scripts/mkbgp -4 -f bird -x mwu -d ebgp_icvpn -s /home/admin/clones/icvpn-meta > /etc/bird/icvpn_ipv4_peers.conf
args:
chdir: /home/admin/clones/icvpn-scripts
creates: /etc/bird/icvpn_ipv{{ item }}_peers.conf
notify:
- reload bird{{ item }}
with_items:
- 4
- 6
creates: /etc/bird/icvpn_ipv4_peers.conf
notify: reload systemd unit bird
- name: write initial icvpn roa config
shell: /usr/bin/python3 /home/admin/clones/icvpn-scripts/mkroa -{{ item.key }} -f bird -x mwu -m {{ item.value.max_prefix }} -s /home/admin/clones/icvpn-meta > /etc/bird/icvpn_ipv{{ item.key }}_roa.conf
- name: generate initial icvpn_ipv6_peers.conf
shell: /usr/bin/python3 /home/admin/clones/icvpn-scripts/mkbgp -6 -f bird -x mwu -d ebgp_icvpn -s /home/admin/clones/icvpn-meta > /etc/bird/icvpn_ipv6_peers.conf
args:
chdir: /home/admin/clones/icvpn-scripts
creates: /etc/bird/icvpn_ipv{{ item.key }}_roa.conf
notify:
- reload bird{{ item.key }}
with_dict:
4:
max_prefix: 20
6:
max_prefix: 64
creates: /etc/bird/icvpn_ipv6_peers.conf
notify: reload systemd unit bird6
- name: write icvpn bird configuration
- name: generate initial icvpn_ipv4_roa.conf
shell: /usr/bin/python3 /home/admin/clones/icvpn-scripts/mkroa -4 -f bird -x mwu -m 20 -s /home/admin/clones/icvpn-meta > /etc/bird/icvpn_ipv4_roa.conf
args:
chdir: /home/admin/clones/icvpn-scripts
creates: /etc/bird/icvpn_ipv4_roa.conf
notify: reload systemd unit bird
- name: generate initial icvpn_ipv6_roa.conf
shell: /usr/bin/python3 /home/admin/clones/icvpn-scripts/mkroa -6 -f bird -x mwu -m 64 -s /home/admin/clones/icvpn-meta > /etc/bird/icvpn_ipv6_roa.conf
args:
chdir: /home/admin/clones/icvpn-scripts
creates: /etc/bird/icvpn_ipv6_roa.conf
notify: reload systemd unit bird6
- name: write icvpn_ipv4.conf
template:
src: icvpn_ipv{{ item }}.conf.j2
dest: /etc/bird/icvpn_ipv{{ item }}.conf
src: icvpn_ipv4.conf.j2
dest: /etc/bird/icvpn_ipv4.conf
mode: 0640
owner: bird
group: bird
notify: reload bird{{ item }}
with_items:
- 4
- 6
notify: reload systemd unit bird
- name: write icvpn_ipv6.conf
template:
src: icvpn_ipv6.conf.j2
dest: /etc/bird/icvpn_ipv6.conf
mode: 0640
owner: bird
group: bird
notify: reload systemd unit bird6
- name: set file attributes for ipv4 roa and peer config
file:
@ -41,8 +51,7 @@
mode: 0640
owner: admin
group: bird
notify:
- reload bird4
notify: reload systemd unit bird
with_items:
- /etc/bird/icvpn_ipv4_peers.conf
- /etc/bird/icvpn_ipv4_roa.conf
@ -53,8 +62,7 @@
mode: 0640
owner: admin
group: bird
notify:
- reload bird6
notify: reload systemd unit bird6
with_items:
- /etc/bird/icvpn_ipv6_peers.conf
- /etc/bird/icvpn_ipv6_roa.conf

View file

@ -3,12 +3,12 @@
systemd:
daemon_reload: yes
- name: reload bird
- name: reload systemd unit bird
systemd:
name: bird
state: reloaded
- name: reload bird6
- name: reload systemd unit bird6
systemd:
name: bird6
state: reloaded

View file

@ -14,29 +14,41 @@
state: directory
mode: 0755
- name: write bird configuration
- name: write bird.conf
template:
src: bird{{ item }}.conf.j2
dest: /etc/bird/bird{{ item }}.conf
src: bird.conf.j2
dest: /etc/bird/bird.conf
mode: 0640
owner: bird
group: bird
notify: reload bird{{ item }}
with_items:
- ""
- 6
notify: reload systemd unit bird
- name: configure mwu peers
- name: write bird6.conf
template:
src: mwu_ipv{{ item }}_peers.conf.j2
dest: /etc/bird/mwu_ipv{{ item }}_peers.conf
src: bird6.conf.j2
dest: /etc/bird/bird6.conf
mode: 0640
owner: bird
group: bird
notify: reload bird{{ item }}
with_items:
- 4
- 6
notify: reload systemd unit bird6
- name: write mwu_ipv4_peers.conf
template:
src: mwu_ipv4_peers.conf.j2
dest: /etc/bird/mwu_ipv4_peers.conf
mode: 0640
owner: bird
group: bird
notify: reload systemd unit bird
- name: write mwu_ipv6_peers.conf
template:
src: mwu_ipv6_peers.conf.j2
dest: /etc/bird/mwu_ipv6_peers.conf
mode: 0640
owner: bird
group: bird
notify: reload systemd unit bird6
- name: enable + start systemd units bird + bird6
systemd: