From 33d86b9ebbb820e736036c1765fdd0c396b07ed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Jonas=20S=C3=A4mann?= Date: Sat, 20 Jun 2020 21:44:09 +0200 Subject: [PATCH] Add role common-handlers fixes linter E303 Commonly used handlers can be loaded by dependency. This also replaces systemctl daemon-reload invocation by its ansible module equivalent. --- roles/common-handlers/handlers/main.yml | 4 ++++ roles/fastd-exporter/handlers/main.yml | 3 --- roles/fastd-exporter/meta/main.yml | 4 ++++ roles/fastd/handlers/main.yml | 3 --- roles/fastd/meta/main.yml | 4 ++++ roles/mesh-interfaces/handlers/main.yml | 3 --- roles/mesh-interfaces/meta/main.yml | 4 ++++ roles/node_exporter/handlers/main.yml | 3 --- roles/node_exporter/meta/main.yml | 4 ++++ roles/prometheus/handlers/main.yml | 3 --- roles/prometheus/meta/main.yml | 4 ++++ roles/respondd/handlers/main.yml | 3 --- roles/respondd/meta/main.yml | 1 + roles/yanic/handlers/main.yml | 3 --- roles/yanic/meta/main.yml | 1 + 15 files changed, 26 insertions(+), 21 deletions(-) create mode 100644 roles/common-handlers/handlers/main.yml create mode 100644 roles/fastd-exporter/meta/main.yml create mode 100644 roles/fastd/meta/main.yml create mode 100644 roles/mesh-interfaces/meta/main.yml create mode 100644 roles/node_exporter/meta/main.yml create mode 100644 roles/prometheus/meta/main.yml diff --git a/roles/common-handlers/handlers/main.yml b/roles/common-handlers/handlers/main.yml new file mode 100644 index 0000000..769cae0 --- /dev/null +++ b/roles/common-handlers/handlers/main.yml @@ -0,0 +1,4 @@ +--- + +- name: 'Reload systemd' + systemd: daemon_reload=yes diff --git a/roles/fastd-exporter/handlers/main.yml b/roles/fastd-exporter/handlers/main.yml index f2f14ea..fa8dcbb 100644 --- a/roles/fastd-exporter/handlers/main.yml +++ b/roles/fastd-exporter/handlers/main.yml @@ -1,7 +1,4 @@ --- -- name: Reload systemd - command: systemctl daemon-reload - - name: Restart fastd-exporter service: name=fastd-exporter state=restarted diff --git a/roles/fastd-exporter/meta/main.yml b/roles/fastd-exporter/meta/main.yml new file mode 100644 index 0000000..9808bfe --- /dev/null +++ b/roles/fastd-exporter/meta/main.yml @@ -0,0 +1,4 @@ +--- + +dependencies: +- { role: common-handlers } diff --git a/roles/fastd/handlers/main.yml b/roles/fastd/handlers/main.yml index 1f9b9ef..135aaf8 100644 --- a/roles/fastd/handlers/main.yml +++ b/roles/fastd/handlers/main.yml @@ -3,6 +3,3 @@ - name: Restart fastd service: name=fastd@{{ site_code }}{{ item }} state=restarted with_sequence: start=0 count={{ fastd_instances }} - -- name: Reload systemd - command: systemctl daemon-reload diff --git a/roles/fastd/meta/main.yml b/roles/fastd/meta/main.yml new file mode 100644 index 0000000..9808bfe --- /dev/null +++ b/roles/fastd/meta/main.yml @@ -0,0 +1,4 @@ +--- + +dependencies: +- { role: common-handlers } diff --git a/roles/mesh-interfaces/handlers/main.yml b/roles/mesh-interfaces/handlers/main.yml index c0ee4dc..bd10989 100644 --- a/roles/mesh-interfaces/handlers/main.yml +++ b/roles/mesh-interfaces/handlers/main.yml @@ -2,6 +2,3 @@ - name: Reload interfaces command: /sbin/ifreload -a - -- name: Reload systemd - command: systemctl daemon-reload diff --git a/roles/mesh-interfaces/meta/main.yml b/roles/mesh-interfaces/meta/main.yml new file mode 100644 index 0000000..9808bfe --- /dev/null +++ b/roles/mesh-interfaces/meta/main.yml @@ -0,0 +1,4 @@ +--- + +dependencies: +- { role: common-handlers } diff --git a/roles/node_exporter/handlers/main.yml b/roles/node_exporter/handlers/main.yml index 4ab254d..159c9a7 100644 --- a/roles/node_exporter/handlers/main.yml +++ b/roles/node_exporter/handlers/main.yml @@ -1,7 +1,4 @@ --- -- name: Reload systemd - command: systemctl daemon-reload - - name: Restart node_exporter service: name=node_exporter state=restarted diff --git a/roles/node_exporter/meta/main.yml b/roles/node_exporter/meta/main.yml new file mode 100644 index 0000000..9808bfe --- /dev/null +++ b/roles/node_exporter/meta/main.yml @@ -0,0 +1,4 @@ +--- + +dependencies: +- { role: common-handlers } diff --git a/roles/prometheus/handlers/main.yml b/roles/prometheus/handlers/main.yml index 51336c6..7d05a8b 100644 --- a/roles/prometheus/handlers/main.yml +++ b/roles/prometheus/handlers/main.yml @@ -1,8 +1,5 @@ --- -- name: Reload systemd - command: systemctl daemon-reload - - name: Restart prometheus service: name=prometheus state=restarted diff --git a/roles/prometheus/meta/main.yml b/roles/prometheus/meta/main.yml new file mode 100644 index 0000000..9808bfe --- /dev/null +++ b/roles/prometheus/meta/main.yml @@ -0,0 +1,4 @@ +--- + +dependencies: +- { role: common-handlers } diff --git a/roles/respondd/handlers/main.yml b/roles/respondd/handlers/main.yml index 1fd0434..e8f29e0 100644 --- a/roles/respondd/handlers/main.yml +++ b/roles/respondd/handlers/main.yml @@ -1,7 +1,4 @@ --- -- name: Reload systemd - command: systemctl daemon-reload - - name: Restart respondd service: name=respondd state=restarted diff --git a/roles/respondd/meta/main.yml b/roles/respondd/meta/main.yml index 050e161..6d1937f 100644 --- a/roles/respondd/meta/main.yml +++ b/roles/respondd/meta/main.yml @@ -1,4 +1,5 @@ --- dependencies: +- { role: common-handlers } - { role: git } diff --git a/roles/yanic/handlers/main.yml b/roles/yanic/handlers/main.yml index adbe0a3..8a9e14a 100644 --- a/roles/yanic/handlers/main.yml +++ b/roles/yanic/handlers/main.yml @@ -1,8 +1,5 @@ --- -- name: Reload systemd - command: systemctl daemon-reload - - name: Restart yanic service: name=yanic state=restarted diff --git a/roles/yanic/meta/main.yml b/roles/yanic/meta/main.yml index 53817af..7b8efde 100644 --- a/roles/yanic/meta/main.yml +++ b/roles/yanic/meta/main.yml @@ -1,4 +1,5 @@ --- dependencies: +- { role: common-handlers } - { role: go }