From d42105badbefde9fa2ee8ec23485ec54604cfa0b Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Wed, 20 Jan 2021 11:38:36 +0100 Subject: [PATCH] Add handlers Signed-off-by: Pierre-Yves Chibon --- ansible/handlers/restart_services.yml | 180 ++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 ansible/handlers/restart_services.yml diff --git a/ansible/handlers/restart_services.yml b/ansible/handlers/restart_services.yml new file mode 100644 index 0000000..ab7b24d --- /dev/null +++ b/ansible/handlers/restart_services.yml @@ -0,0 +1,180 @@ +######################################## +# Handlers for restarting services +# + +- name: reload systemd + command: systemctl daemon-reload + +- name: restart apache + command: /usr/local/bin/conditional-restart.sh httpd httpd + +- name: reload apache + action: service name=httpd state=reloaded + +- name: restart collectd + action: service name=collectd state=restarted + +- name: restart crond + action: service name=crond state=restarted + +- name: restart fedmsg-gateway + command: /usr/local/bin/conditional-restart.sh fedmsg-gateway + +- name: restart fedmsg-hub + command: /usr/local/bin/conditional-restart.sh {{ item }} + with_items: + - fedmsg-hub + - fedmsg-hub-3 + +- name: restart fedmsg-hub-3 + command: /usr/local/bin/conditional-restart.sh {{ item }} + with_items: + - fedmsg-hub + - fedmsg-hub-3 + +- name: restart fedmsg-irc + command: /usr/local/bin/conditional-restart.sh fedmsg-irc + +- name: restart fedmsg-relay + command: /usr/local/bin/conditional-restart.sh fedmsg-relay + +- name: restart fm-consumer@koji_sync_listener + action: service name=fm-consumer@koji_sync_listener state=restarted enabled=yes + +- name: reload httpd + command: /usr/local/bin/conditional-reload.sh httpd httpd + +- name: restart iptables + action: service name=iptables state=restarted + +- name: restart ip6tables + action: service name=ip6tables state=restarted + +- name: restart libvirtd + action: service name=libvirtd state=restarted + +- name: restart mailman + action: service name=mailman state=restarted + +- name: restart named + action: service name=named state=restarted + +- name: restart ntpd + action: service name=ntpd state=restarted + +- name: restart sshd + action: service name=sshd state=restarted + +- name: restart openvpn (Fedora) + when: ansible_distribution == "Fedora" + action: service name=openvpn-client@openvpn state=restarted + #notify: + #- fix openvpn routing + +- name: restart openvpn (RHEL6) + when: ansible_distribution == "RedHat" and ansible_distribution_major_version|int == 6 + action: service name=openvpn state=restarted + #notify: + #- fix openvpn routing + +- name: restart openvpn (RHEL7+) + when: ansible_distribution == "RedHat" and ansible_distribution_major_version|int >= 7 + action: service name=openvpn-client@openvpn state=restarted + #notify: + #- fix openvpn routing + +- name: fix openvpn routing + action: shell /etc/openvpn/fix-routes.sh + +- name: restart xinetd + action: service name=xinetd state=restarted + +- name: restart netapproute + action: command /etc/sysconfig/network-scripts/ifup-routes eth1 + +- name: restart network + action: service name=network state=restarted + +- name: rebuild postfix transport + command: /usr/sbin/postmap /etc/postfix/transport + +- name: rebuild postfix tls_policy + command: /usr/sbin/postmap /etc/postfix/tls_policy + +- name: restart postfix + service: name=postfix state=restarted + +- name: reload proxyhttpd + command: /usr/local/bin/proxy-conditional-reload.sh httpd httpd + +- name: restart glusterd + service: name=glusterd state=restarted + +- name: run rkhunter + command: rkhunter --propupd + +- name: restart moksha-hub + service: name=moksha-hub state=restarted + +- name: restart dhcpd + service: name=dhcpd state=restarted + +- name: restart memcached + service: name=memcached state=restarted + +- name: restart nagios + shell: nagios -v /etc/nagios/nagios.cfg && systemctl restart nagios + +- name: restart bridge + shell: /usr/lib/systemd/systemd-sysctl --prefix=/proc/sys/net/bridge + +- name: reload libvirtd + service: name=libvirtd state=reloaded + ignore_errors: true + when: ansible_virtualization_role == 'host' + +- name: restart pagure_ev + service: name=pagure_ev state=restarted + +- name: "update ca-trust" + command: /usr/bin/update-ca-trust + +- name: restart stunnel + service: name=stunnel state=restarted + +- name: restart mirrorlist-server + service: name=mirrorlist-server state=restarted + +- name: restart NetworkManager + service: name=NetworkManager state=restarted + +- name: reload NetworkManager-connections + command: nmcli c reload + +- name: restart basset-worker + service: name=basset-worker state=restarted + +- name: apply interface-changes + command: nmcli con up {{ item.split()[1] }} + async: 1 + poll: 0 + loop: "{{ if_uuid.stdout_lines|flatten(levels=1) }}" + when: item.split()[1] not in ansible_ifcfg_disabled + +- name: flush journald tmpfiles to persistent store + command: pkill -f -USR1 systemd-journald + +- name: restart idmapd + service: name=nfs-idmapd state=restarted + +- name: restart buildmaster + service: name=buildmaster state=restarted + +- name: restart rabbitmq + systemd: + name: rabbitmq-server + state: restarted + daemon_reload: yes + +- name: restart chronyd + service: name=chronyd state=restarted