From 886cdb2417bd3ff748a857d140ad0c40b7fe5de7 Mon Sep 17 00:00:00 2001 From: Tobias Hachmer Date: Thu, 1 Mar 2018 06:34:55 +0100 Subject: [PATCH] Handlers: move all handlers into their roles, again --- playbooks/gateways.yml | 1 - roles/handlers/handlers/main.yml | 89 ------------------- roles/network-batman/handlers/main.yml | 5 ++ roles/network-fastd/handlers/main.yml | 5 ++ roles/network-ffrl/handlers/main.yml | 5 ++ .../handlers/main.yml | 6 ++ roles/network-meshbridge/handlers/main.yml | 10 +++ roles/network-routing/handlers/main.yml | 14 +++ roles/server-basic/handlers/main.yml | 4 + roles/service-bind-slave/handlers/main.yml | 9 ++ roles/service-bird-ffrl/handlers/main.yml | 10 +++ roles/service-bird-icvpn/handlers/main.yml | 14 +++ roles/service-bird/handlers/main.yml | 10 +++ roles/service-dhcpd/handlers/main.yml | 4 + .../service-fastd-intragate/handlers/main.yml | 8 ++ roles/service-fastd-mesh/handlers/main.yml | 12 +++ roles/service-fastd/handlers/main.yml | 4 + .../service-nginx-firmware/handlers/main.yml | 9 ++ roles/service-nginx/handlers/main.yml | 5 ++ roles/service-radvd/handlers/main.yml | 5 ++ roles/service-respondd/handlers/main.yml | 10 +++ roles/service-tinc/handlers/main.yml | 10 +++ 22 files changed, 159 insertions(+), 90 deletions(-) delete mode 100644 roles/handlers/handlers/main.yml create mode 100644 roles/network-batman/handlers/main.yml create mode 100644 roles/network-fastd/handlers/main.yml create mode 100644 roles/network-ffrl/handlers/main.yml create mode 100644 roles/network-iptables-gateway/handlers/main.yml create mode 100644 roles/network-meshbridge/handlers/main.yml create mode 100644 roles/network-routing/handlers/main.yml create mode 100644 roles/server-basic/handlers/main.yml create mode 100644 roles/service-bind-slave/handlers/main.yml create mode 100644 roles/service-bird-ffrl/handlers/main.yml create mode 100644 roles/service-bird-icvpn/handlers/main.yml create mode 100644 roles/service-bird/handlers/main.yml create mode 100644 roles/service-fastd-intragate/handlers/main.yml create mode 100644 roles/service-fastd-mesh/handlers/main.yml create mode 100644 roles/service-fastd/handlers/main.yml create mode 100644 roles/service-nginx-firmware/handlers/main.yml create mode 100644 roles/service-nginx/handlers/main.yml create mode 100644 roles/service-radvd/handlers/main.yml create mode 100644 roles/service-respondd/handlers/main.yml create mode 100644 roles/service-tinc/handlers/main.yml diff --git a/playbooks/gateways.yml b/playbooks/gateways.yml index 05b55f6..e626e5d 100755 --- a/playbooks/gateways.yml +++ b/playbooks/gateways.yml @@ -3,7 +3,6 @@ - hosts: ffmwu-gateways remote_user: admin roles: - - handlers - prerequisites - server-apt-repos - server-basic diff --git a/roles/handlers/handlers/main.yml b/roles/handlers/handlers/main.yml deleted file mode 100644 index bedfd6c..0000000 --- a/roles/handlers/handlers/main.yml +++ /dev/null @@ -1,89 +0,0 @@ ---- -- name: reload systemd - systemd: - daemon_reload: yes - -- name: reload network interfaces - systemd: - name: networking - state: reloaded - -- name: activate sysfs variables - systemd: - name: sysfsutils - state: restarted - -- name: restart bind9 - systemd: - name: bind9 - state: restarted - -- name: reload systemd unit bird - systemd: - name: bird - state: reloaded - -- name: reload systemd unit bird6 - systemd: - name: bird6 - state: reloaded - -- name: restart fastd intragate instances - systemd: - name: "fastd@{{ item.0.id }}igvpn-{{ item.1.mtu }}" - state: restarted - with_subelements: - - "{{ meshes }}" - - fastd.intragate.instances - -- name: restart fastd mesh instances - systemd: - name: "fastd@{{ item.0.id }}vpn-{{ item.1.mtu }}" - state: restarted - with_subelements: - - "{{ meshes }}" - - fastd.nodes.instances - -- name: restart systemd unit radvd - systemd: - name: radvd - state: restarted - -- name: restart respondd - systemd: - name: "respondd-{{ item.id }}" - state: restarted - with_items: "{{ meshes }}" - -- name: restart systemd unit tinc - systemd: - name: "tinc@{{ icvpn.interface }}" - enabled: yes - state: restarted - -- name: restart systemd unit ffmwu-static-routes - systemd: - name: ffmwu-static-routes - state: restarted - -- name: restart systemd unit ffmwu-ip-rules - systemd: - name: ffmwu-ip-rules - state: restarted - -- name: restart respondd - systemd: - name: "respondd-{{ item.id }}" - state: restarted - with_items: "{{ meshes }}" - -- name: iptables-restore - shell: iptables-restore < /etc/iptables/rules.v4 - -- name: ip6tables-restore - shell: ip6tables-restore < /etc/iptables/rules.v6 - -- name: reload nginx - systemd: - name: nginx - state: reloaded diff --git a/roles/network-batman/handlers/main.yml b/roles/network-batman/handlers/main.yml new file mode 100644 index 0000000..191d07d --- /dev/null +++ b/roles/network-batman/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: reload network interfaces + systemd: + name: networking + state: reloaded diff --git a/roles/network-fastd/handlers/main.yml b/roles/network-fastd/handlers/main.yml new file mode 100644 index 0000000..191d07d --- /dev/null +++ b/roles/network-fastd/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: reload network interfaces + systemd: + name: networking + state: reloaded diff --git a/roles/network-ffrl/handlers/main.yml b/roles/network-ffrl/handlers/main.yml new file mode 100644 index 0000000..191d07d --- /dev/null +++ b/roles/network-ffrl/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: reload network interfaces + systemd: + name: networking + state: reloaded diff --git a/roles/network-iptables-gateway/handlers/main.yml b/roles/network-iptables-gateway/handlers/main.yml new file mode 100644 index 0000000..5dfa033 --- /dev/null +++ b/roles/network-iptables-gateway/handlers/main.yml @@ -0,0 +1,6 @@ +--- +- name: iptables-restore + shell: iptables-restore < /etc/iptables/rules.v4 + +- name: ip6tables-restore + shell: ip6tables-restore < /etc/iptables/rules.v6 diff --git a/roles/network-meshbridge/handlers/main.yml b/roles/network-meshbridge/handlers/main.yml new file mode 100644 index 0000000..78481e4 --- /dev/null +++ b/roles/network-meshbridge/handlers/main.yml @@ -0,0 +1,10 @@ +--- +- name: reload network interfaces + systemd: + name: networking + state: reloaded + +- name: activate sysfs variables + systemd: + name: sysfsutils + state: restarted diff --git a/roles/network-routing/handlers/main.yml b/roles/network-routing/handlers/main.yml new file mode 100644 index 0000000..42897d4 --- /dev/null +++ b/roles/network-routing/handlers/main.yml @@ -0,0 +1,14 @@ +--- +- name: reload systemd + systemd: + daemon_reload: yes + +- name: restart systemd unit ffmwu-static-routes + systemd: + name: ffmwu-static-routes + state: restarted + +- name: restart systemd unit ffmwu-ip-rules + systemd: + name: ffmwu-ip-rules + state: restarted diff --git a/roles/server-basic/handlers/main.yml b/roles/server-basic/handlers/main.yml new file mode 100644 index 0000000..bb7fde2 --- /dev/null +++ b/roles/server-basic/handlers/main.yml @@ -0,0 +1,4 @@ +--- +- name: reload systemd + systemd: + daemon_reload: yes diff --git a/roles/service-bind-slave/handlers/main.yml b/roles/service-bind-slave/handlers/main.yml new file mode 100644 index 0000000..e1b2000 --- /dev/null +++ b/roles/service-bind-slave/handlers/main.yml @@ -0,0 +1,9 @@ +--- +- name: reload systemd + systemd: + daemon_reload: yes + +- name: restart bind9 + systemd: + name: bind9 + state: restarted diff --git a/roles/service-bird-ffrl/handlers/main.yml b/roles/service-bird-ffrl/handlers/main.yml new file mode 100644 index 0000000..a9d5fb3 --- /dev/null +++ b/roles/service-bird-ffrl/handlers/main.yml @@ -0,0 +1,10 @@ +--- +- name: reload systemd unit bird + systemd: + name: bird + state: reloaded + +- name: reload systemd unit bird6 + systemd: + name: bird6 + state: reloaded diff --git a/roles/service-bird-icvpn/handlers/main.yml b/roles/service-bird-icvpn/handlers/main.yml new file mode 100644 index 0000000..3d840fc --- /dev/null +++ b/roles/service-bird-icvpn/handlers/main.yml @@ -0,0 +1,14 @@ +--- +- name: reload systemd + systemd: + daemon_reload: yes + +- name: reload systemd unit bird + systemd: + name: bird + state: reloaded + +- name: reload systemd unit bird6 + systemd: + name: bird6 + state: reloaded diff --git a/roles/service-bird/handlers/main.yml b/roles/service-bird/handlers/main.yml new file mode 100644 index 0000000..a9d5fb3 --- /dev/null +++ b/roles/service-bird/handlers/main.yml @@ -0,0 +1,10 @@ +--- +- name: reload systemd unit bird + systemd: + name: bird + state: reloaded + +- name: reload systemd unit bird6 + systemd: + name: bird6 + state: reloaded diff --git a/roles/service-dhcpd/handlers/main.yml b/roles/service-dhcpd/handlers/main.yml index 50b5e0f..8b258f8 100644 --- a/roles/service-dhcpd/handlers/main.yml +++ b/roles/service-dhcpd/handlers/main.yml @@ -1,4 +1,8 @@ --- +- name: reload systemd + systemd: + daemon_reload: yes + - name: restart kea-dhcp4-server systemd: name: kea-dhcp4-server diff --git a/roles/service-fastd-intragate/handlers/main.yml b/roles/service-fastd-intragate/handlers/main.yml new file mode 100644 index 0000000..fcd9c22 --- /dev/null +++ b/roles/service-fastd-intragate/handlers/main.yml @@ -0,0 +1,8 @@ +--- +- name: restart fastd intragate instances + systemd: + name: "fastd@{{ item.0.id }}igvpn-{{ item.1.mtu }}" + state: restarted + with_subelements: + - "{{ meshes }}" + - fastd.intragate.instances diff --git a/roles/service-fastd-mesh/handlers/main.yml b/roles/service-fastd-mesh/handlers/main.yml new file mode 100644 index 0000000..0d97e25 --- /dev/null +++ b/roles/service-fastd-mesh/handlers/main.yml @@ -0,0 +1,12 @@ +--- +- name: reload systemd + systemd: + daemon_reload: yes + +- name: restart fastd mesh instances + systemd: + name: "fastd@{{ item.0.id }}vpn-{{ item.1.mtu }}" + state: restarted + with_subelements: + - "{{ meshes }}" + - fastd.nodes.instances diff --git a/roles/service-fastd/handlers/main.yml b/roles/service-fastd/handlers/main.yml new file mode 100644 index 0000000..bb7fde2 --- /dev/null +++ b/roles/service-fastd/handlers/main.yml @@ -0,0 +1,4 @@ +--- +- name: reload systemd + systemd: + daemon_reload: yes diff --git a/roles/service-nginx-firmware/handlers/main.yml b/roles/service-nginx-firmware/handlers/main.yml new file mode 100644 index 0000000..8ba62c2 --- /dev/null +++ b/roles/service-nginx-firmware/handlers/main.yml @@ -0,0 +1,9 @@ +--- +- name: reload systemd + systemd: + daemon_reload: yes + +- name: reload nginx + systemd: + name: nginx + state: reloaded diff --git a/roles/service-nginx/handlers/main.yml b/roles/service-nginx/handlers/main.yml new file mode 100644 index 0000000..4e0a6ca --- /dev/null +++ b/roles/service-nginx/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: reload nginx + systemd: + name: nginx + state: reloaded diff --git a/roles/service-radvd/handlers/main.yml b/roles/service-radvd/handlers/main.yml new file mode 100644 index 0000000..a534dd6 --- /dev/null +++ b/roles/service-radvd/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: restart systemd unit radvd + systemd: + name: radvd + state: restarted diff --git a/roles/service-respondd/handlers/main.yml b/roles/service-respondd/handlers/main.yml new file mode 100644 index 0000000..bbe2ce5 --- /dev/null +++ b/roles/service-respondd/handlers/main.yml @@ -0,0 +1,10 @@ +--- +- name: reload systemd + systemd: + daemon_reload: yes + +- name: restart respondd + systemd: + name: "respondd-{{ item.id }}" + state: restarted + with_items: "{{ meshes }}" diff --git a/roles/service-tinc/handlers/main.yml b/roles/service-tinc/handlers/main.yml new file mode 100644 index 0000000..1ad91b0 --- /dev/null +++ b/roles/service-tinc/handlers/main.yml @@ -0,0 +1,10 @@ +--- +- name: reload systemd + systemd: + daemon_reload: yes + +- name: restart systemd unit tinc + systemd: + name: "tinc@{{ icvpn.interface }}" + enabled: yes + state: restarted