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: systemd:
name: bird name: bird
state: reloaded state: reloaded
- name: reload bird6 - name: reload systemd unit bird6
systemd: systemd:
name: bird6 name: bird6
state: reloaded state: reloaded

View file

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

View file

@ -1,39 +1,49 @@
--- ---
- name: write initial icvpn peers - name: generate initial icvpn_ipv4_peers.conf
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 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: args:
chdir: /home/admin/clones/icvpn-scripts chdir: /home/admin/clones/icvpn-scripts
creates: /etc/bird/icvpn_ipv{{ item }}_peers.conf creates: /etc/bird/icvpn_ipv4_peers.conf
notify: notify: reload systemd unit bird
- reload bird{{ item }}
with_items:
- 4
- 6
- name: write initial icvpn roa config - name: generate initial icvpn_ipv6_peers.conf
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 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: args:
chdir: /home/admin/clones/icvpn-scripts chdir: /home/admin/clones/icvpn-scripts
creates: /etc/bird/icvpn_ipv{{ item.key }}_roa.conf creates: /etc/bird/icvpn_ipv6_peers.conf
notify: notify: reload systemd unit bird6
- reload bird{{ item.key }}
with_dict:
4:
max_prefix: 20
6:
max_prefix: 64
- 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: template:
src: icvpn_ipv{{ item }}.conf.j2 src: icvpn_ipv4.conf.j2
dest: /etc/bird/icvpn_ipv{{ item }}.conf dest: /etc/bird/icvpn_ipv4.conf
mode: 0640 mode: 0640
owner: bird owner: bird
group: bird group: bird
notify: reload bird{{ item }} notify: reload systemd unit bird
with_items:
- 4 - name: write icvpn_ipv6.conf
- 6 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 - name: set file attributes for ipv4 roa and peer config
file: file:
@ -41,8 +51,7 @@
mode: 0640 mode: 0640
owner: admin owner: admin
group: bird group: bird
notify: notify: reload systemd unit bird
- reload bird4
with_items: with_items:
- /etc/bird/icvpn_ipv4_peers.conf - /etc/bird/icvpn_ipv4_peers.conf
- /etc/bird/icvpn_ipv4_roa.conf - /etc/bird/icvpn_ipv4_roa.conf
@ -53,8 +62,7 @@
mode: 0640 mode: 0640
owner: admin owner: admin
group: bird group: bird
notify: notify: reload systemd unit bird6
- reload bird6
with_items: with_items:
- /etc/bird/icvpn_ipv6_peers.conf - /etc/bird/icvpn_ipv6_peers.conf
- /etc/bird/icvpn_ipv6_roa.conf - /etc/bird/icvpn_ipv6_roa.conf

View file

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

View file

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