From f0646fb94605f079eb2ca188ceb543572106c050 Mon Sep 17 00:00:00 2001 From: Salt Date: Mon, 18 Apr 2022 11:18:34 -0500 Subject: [PATCH] Rename cleanup.yml to site_post, since it now has all its jobs --- playbooks/cleanup.yml | 42 --------------------------------------- playbooks/site_post.yml | 44 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 47 deletions(-) delete mode 100755 playbooks/cleanup.yml diff --git a/playbooks/cleanup.yml b/playbooks/cleanup.yml deleted file mode 100755 index 38128df..0000000 --- a/playbooks/cleanup.yml +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env ansible-playbook -# vim:ft=ansible: ---- -- hosts: all - gather_facts: no - tasks: - - name: touch ansible timestamp file - file: path=/var/lib/ansible-last-run state=touch mode='0644' - changed_when: no -- hosts: tags_autoreboot - gather_facts: no - module_defaults: - nagios: - author: Ansible - action: downtime - cmdfile: /data/nagios/var/rw/nagios.cmd - comment: "Ansible tags_autoreboot task" - host: "{{ inventory_hostname }}" - minutes: 10 - serial: 1 - tasks: - - name: check for reboot-required - stat: path=/var/run/reboot-required - register: s - - name: reboot - block: - - name: attempt to schedule downtime - block: - - name: register nagios host downtime - nagios: - service: host - delegate_to: web3.dallas.mgmt.desu.ltd - - name: register nagios service downtime - nagios: - service: all - delegate_to: web3.dallas.mgmt.desu.ltd - rescue: - - name: notify of failure to reboot - debug: msg="Miscellaneous failure when scheduling downtime" - - name: reboot - reboot: reboot_timeout=600 - when: s.stat.exists diff --git a/playbooks/site_post.yml b/playbooks/site_post.yml index b46c82b..38128df 100755 --- a/playbooks/site_post.yml +++ b/playbooks/site_post.yml @@ -1,8 +1,42 @@ #!/usr/bin/env ansible-playbook # vim:ft=ansible: --- - # Housekeeping tags for one-off tasks -- import_playbook: tags_docker-prune.yml -- import_playbook: tags_autoreboot.yml - # Last little bit of cleanup -- import_playbook: cleanup.yml +- hosts: all + gather_facts: no + tasks: + - name: touch ansible timestamp file + file: path=/var/lib/ansible-last-run state=touch mode='0644' + changed_when: no +- hosts: tags_autoreboot + gather_facts: no + module_defaults: + nagios: + author: Ansible + action: downtime + cmdfile: /data/nagios/var/rw/nagios.cmd + comment: "Ansible tags_autoreboot task" + host: "{{ inventory_hostname }}" + minutes: 10 + serial: 1 + tasks: + - name: check for reboot-required + stat: path=/var/run/reboot-required + register: s + - name: reboot + block: + - name: attempt to schedule downtime + block: + - name: register nagios host downtime + nagios: + service: host + delegate_to: web3.dallas.mgmt.desu.ltd + - name: register nagios service downtime + nagios: + service: all + delegate_to: web3.dallas.mgmt.desu.ltd + rescue: + - name: notify of failure to reboot + debug: msg="Miscellaneous failure when scheduling downtime" + - name: reboot + reboot: reboot_timeout=600 + when: s.stat.exists