Files
ansible/oldstuff/stop.yaml
2023-08-17 23:08:37 +02:00

82 lines
1.8 KiB
YAML

---
- name: Slack
hosts: localhost
gather_facts: false
vars:
playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}"
tasks:
- name: Send notification message via Slack
community.general.slack:
token: "{{ slack_token }}"
msg: Starting {{ playbook_file }}
#- name: Stop N2A
# hosts: SMC
# tasks:
# - name: podman stop n2a
# command: podman stop n2a
# - name: podman stop nagios
# command: podman stop nagios
- name: Stop WEB, API
hosts: WEB, API
gather_facts: false
tasks:
- block:
- include: tasks/stop-iis.yaml
rescue:
- include: tasks/task-failed-slack.yaml
- name: Stop DPS, FAS, MDL, SPS, TCS
hosts: DPS, FAS, MDL, SPS, TCS
gather_facts: false
tasks:
- block:
- include: tasks/stop-ifsbo.yaml
- include: tasks/reboot.yaml
rescue:
- include: tasks/task-failed-slack.yaml
- name: Stop APP
hosts: APP
gather_facts: false
tasks:
- block:
- include: tasks/stop-iis.yaml
rescue:
- include: tasks/task-failed-slack.yaml
- name: Stop BCM_CLUSTER
hosts: BCM_CLUSTER
gather_facts: false
tasks:
- block:
- include: tasks/stop-ifsbo.yaml
- include: tasks/reboot.yaml
rescue:
- include: tasks/task-failed-slack.yaml
- name: Stop AOS
hosts: AOS
gather_facts: false
tasks:
- block:
- include: tasks/stop-aos.yaml
rescue:
- include: tasks/task-failed-slack.yaml
- name: Slack
hosts: localhost
gather_facts: false
tasks:
- name: Send notification message via Slack
community.general.slack:
token: "{{ slack_token }}"
msg: All done