Skip to content

Instantly share code, notes, and snippets.

@jlengelbrecht
Created December 5, 2023 04:54
Show Gist options
  • Save jlengelbrecht/69cdbf91237c62ad9d93883e84622b49 to your computer and use it in GitHub Desktop.
Save jlengelbrecht/69cdbf91237c62ad9d93883e84622b49 to your computer and use it in GitHub Desktop.
ansible automation playbook with discord notifications
---
- hosts: all
gather_facts: true
become: true
become_user: root
serial: 1 # Ensures the playbook runs on one server at a time
vars:
update_results_file: "/home/semaphore/automation-updates.txt"
discord_webhook_url: "my-webhook"
ansible_command_timeout: 900
tasks:
- name: Check for the existence of update results file on remote hosts
stat:
path: "{{ update_results_file }}"
register: update_results_file_stat
- name: Delete existing update results file on remote hosts
file:
path: "{{ update_results_file }}"
state: absent
when: update_results_file_stat.stat.exists
- name: Create/update automation-updates.txt file on remote hosts
ansible.builtin.copy:
content: ""
dest: /home/semaphore/automation-updates.txt
- name: Run updates on remote hosts
apt:
update_cache: yes
upgrade: safe
autoremove: yes
autoclean: yes
register: apt_upgrade
- name: Capture update results on remote hosts
lineinfile:
path: "{{ update_results_file }}"
line: "{{ inventory_hostname }} - Update {{ 'succeeded' if apt_upgrade.changed else 'failed' }}"
when: apt_upgrade.changed or apt_upgrade.failed
- name: Send Discord message on update success on remote hosts
uri:
url: "{{ discord_webhook_url }}"
method: POST
body_format: json
headers:
Content-Type: "application/json"
body: "{\"content\":\"Update succeeded on {{ inventory_hostname }}\"}"
when: apt_upgrade.changed
register: discord_result_success
- name: Fail the playbook on Discord message failure (success)
fail:
msg: "Failed to send Discord message on success: {{ discord_result_success.msg }}"
when: discord_result_success.status != 200
- name: Send Discord message on update failure on remote hosts
uri:
url: "{{ discord_webhook_url }}"
method: POST
body_format: json
headers:
Content-Type: "application/json"
body: "{\"content\":\"Update failed on {{ inventory_hostname }}\"}"
when: apt_upgrade.failed
register: discord_result_failure
- name: Fail the playbook on Discord message failure (failure)
fail:
msg: "Failed to send Discord message on failure: {{ discord_result_failure.msg }}"
when: discord_result_failure.status != 200
- hosts: localhost
gather_facts: true
become: true
become_user: root
vars:
update_results_file: "/home/semaphore/automation-updates.txt"
discord_webhook_url: "my-webhhok"
ansible_command_timeout: 900
local_host_reboot_delay: 1800 # 30 minutes
tasks:
- name: Check for the existence of update results file on local host
stat:
path: "{{ update_results_file }}"
register: local_update_results_file_stat
- name: Delete existing update results file on local host
file:
path: "{{ update_results_file }}"
state: absent
when: local_update_results_file_stat.stat.exists
- name: Create/update automation-updates.txt file on local host
ansible.builtin.copy:
content: ""
dest: /home/semaphore/automation-updates.txt
- name: Send Discord message on update success on local host
uri:
url: "{{ discord_webhook_url }}"
method: POST
body_format: json
headers:
Content-Type: "application/json"
body: "{\"content\":\"Update succeeded on local host\"}"
when: apt_upgrade.changed
register: discord_result_success_local
- name: Fail the playbook on Discord message failure on local host (success)
fail:
msg: "Failed to send Discord message on success: {{ discord_result_success_local.msg }}"
when: discord_result_success_local.status != 200
- name: Send Discord message on update failure on local host
uri:
url: "{{ discord_webhook_url }}"
method: POST
body_format: json
headers:
Content-Type: "application/json"
body: "{\"content\":\"Update failed on local host\"}"
when: apt_upgrade.failed
register: discord_result_failure_local
- name: Fail the playbook on Discord message failure on local host (failure)
fail:
msg: "Failed to send Discord message on failure: {{ discord_result_failure_local.msg }}"
when: discord_result_failure_local.status != 200
- name: Check if local host requires reboot
command: "needs-restarting -r || reboot"
async: 0
poll: 0
register: reboot_check_local
when: apt_upgrade.changed
- name: Delay local host reboot if required
async_status:
jid: "{{ reboot_check_local.ansible_job_id }}"
delay: "{{ local_host_reboot_delay }}"
when: apt_upgrade.changed
@jlengelbrecht
Copy link
Author

jlengelbrecht commented Dec 5, 2023

Playbook Log

PLAY [all] *********************************************************************
11:29:39 PM
11:29:39 PM
TASK [Gathering Facts] *********************************************************
11:29:45 PM
ok: [10.20.66.3]
11:29:45 PM
11:29:45 PM
TASK [Check for the existence of update results file on remote hosts] **********
11:29:47 PM
ok: [10.20.66.3]
11:29:47 PM
11:29:47 PM
TASK [Delete existing update results file on remote hosts] *********************
11:29:49 PM
changed: [10.20.66.3]
11:29:49 PM
11:29:49 PM
TASK [Create/update automation-updates.txt file on remote hosts] ***************
11:29:51 PM
changed: [10.20.66.3]
11:29:51 PM
11:29:51 PM
TASK [Run updates on remote hosts] *********************************************
11:29:56 PM
ok: [10.20.66.3]
11:29:56 PM
11:29:56 PM
TASK [Capture update results on remote hosts] **********************************
11:29:57 PM
skipping: [10.20.66.3]
11:29:57 PM
11:29:57 PM
TASK [Send Discord message on update success on remote hosts] ******************
11:29:57 PM
skipping: [10.20.66.3]
11:29:57 PM
11:29:57 PM
TASK [Fail the playbook on Discord message failure (success)] ******************
11:29:57 PM
skipping: [10.20.66.3]
11:29:57 PM
11:29:57 PM
TASK [Send Discord message on update failure on remote hosts] ******************
11:29:57 PM
skipping: [10.20.66.3]
11:29:57 PM
11:29:57 PM
TASK [Fail the playbook on Discord message failure (failure)] ******************
11:29:57 PM
skipping: [10.20.66.3]
11:29:57 PM
11:29:57 PM
PLAY [all] *********************************************************************
11:29:57 PM
11:29:57 PM
TASK [Gathering Facts] *********************************************************
11:30:00 PM
ok: [10.20.66.4]
11:30:00 PM
11:30:00 PM
TASK [Check for the existence of update results file on remote hosts] **********
11:30:01 PM
ok: [10.20.66.4]
11:30:01 PM
11:30:01 PM
TASK [Delete existing update results file on remote hosts] *********************
11:30:01 PM
changed: [10.20.66.4]
11:30:01 PM
11:30:01 PM
TASK [Create/update automation-updates.txt file on remote hosts] ***************
11:30:02 PM
changed: [10.20.66.4]
11:30:02 PM
11:30:02 PM
TASK [Run updates on remote hosts] *********************************************
11:30:05 PM
ok: [10.20.66.4]
11:30:05 PM
11:30:05 PM
TASK [Capture update results on remote hosts] **********************************
11:30:05 PM
skipping: [10.20.66.4]
11:30:05 PM
11:30:05 PM
TASK [Send Discord message on update success on remote hosts] ******************
11:30:05 PM
skipping: [10.20.66.4]
11:30:05 PM
11:30:05 PM
TASK [Fail the playbook on Discord message failure (success)] ******************
11:30:05 PM
skipping: [10.20.66.4]
11:30:05 PM
11:30:05 PM
TASK [Send Discord message on update failure on remote hosts] ******************
11:30:05 PM
skipping: [10.20.66.4]
11:30:05 PM
11:30:05 PM
TASK [Fail the playbook on Discord message failure (failure)] ******************
11:30:06 PM
skipping: [10.20.66.4]
11:30:06 PM
11:30:06 PM
PLAY [all] *********************************************************************
11:30:06 PM
11:30:06 PM
TASK [Gathering Facts] *********************************************************
11:30:10 PM
ok: [10.20.66.5]
11:30:10 PM
11:30:10 PM
TASK [Check for the existence of update results file on remote hosts] **********
11:30:11 PM
ok: [10.20.66.5]
11:30:11 PM
11:30:11 PM
TASK [Delete existing update results file on remote hosts] *********************
11:30:12 PM
changed: [10.20.66.5]
11:30:12 PM
11:30:12 PM
TASK [Create/update automation-updates.txt file on remote hosts] ***************
11:30:13 PM
changed: [10.20.66.5]
11:30:13 PM
11:30:13 PM
TASK [Run updates on remote hosts] *********************************************
11:30:18 PM
ok: [10.20.66.5]
11:30:18 PM
11:30:18 PM
TASK [Capture update results on remote hosts] **********************************
11:30:18 PM
skipping: [10.20.66.5]
11:30:18 PM
11:30:18 PM
TASK [Send Discord message on update success on remote hosts] ******************
11:30:18 PM
skipping: [10.20.66.5]
11:30:18 PM
11:30:18 PM
TASK [Fail the playbook on Discord message failure (success)] ******************
11:30:18 PM
skipping: [10.20.66.5]
11:30:18 PM
11:30:18 PM
TASK [Send Discord message on update failure on remote hosts] ******************
11:30:18 PM
skipping: [10.20.66.5]
11:30:18 PM
11:30:18 PM
TASK [Fail the playbook on Discord message failure (failure)] ******************
11:30:18 PM
skipping: [10.20.66.5]
11:30:19 PM
11:30:19 PM
PLAY [all] *********************************************************************
11:30:19 PM
11:30:19 PM
TASK [Gathering Facts] *********************************************************
11:30:24 PM
ok: [10.20.66.6]
11:30:24 PM
11:30:24 PM
TASK [Check for the existence of update results file on remote hosts] **********
11:30:25 PM
ok: [10.20.66.6]
11:30:25 PM
11:30:25 PM
TASK [Delete existing update results file on remote hosts] *********************
11:30:25 PM
changed: [10.20.66.6]
11:30:26 PM
11:30:26 PM
TASK [Create/update automation-updates.txt file on remote hosts] ***************
11:30:27 PM
changed: [10.20.66.6]
11:30:27 PM
11:30:27 PM
TASK [Run updates on remote hosts] *********************************************
11:30:32 PM
ok: [10.20.66.6]
11:30:32 PM
11:30:32 PM
TASK [Capture update results on remote hosts] **********************************
11:30:32 PM
skipping: [10.20.66.6]
11:30:32 PM
11:30:32 PM
TASK [Send Discord message on update success on remote hosts] ******************
11:30:32 PM
skipping: [10.20.66.6]
11:30:32 PM
11:30:32 PM
TASK [Fail the playbook on Discord message failure (success)] ******************
11:30:33 PM
skipping: [10.20.66.6]
11:30:33 PM
11:30:33 PM
TASK [Send Discord message on update failure on remote hosts] ******************
11:30:33 PM
skipping: [10.20.66.6]
11:30:33 PM
11:30:33 PM
TASK [Fail the playbook on Discord message failure (failure)] ******************
11:30:33 PM
skipping: [10.20.66.6]
11:30:33 PM
11:30:33 PM
PLAY [all] *********************************************************************
11:30:33 PM
11:30:33 PM
TASK [Gathering Facts] *********************************************************
11:30:38 PM
ok: [10.20.66.7]
11:30:38 PM
11:30:38 PM
TASK [Check for the existence of update results file on remote hosts] **********
11:30:39 PM
ok: [10.20.66.7]
11:30:39 PM
11:30:39 PM
TASK [Delete existing update results file on remote hosts] *********************
11:30:40 PM
changed: [10.20.66.7]
11:30:40 PM
11:30:40 PM
TASK [Create/update automation-updates.txt file on remote hosts] ***************
11:30:41 PM
changed: [10.20.66.7]
11:30:41 PM
11:30:41 PM
TASK [Run updates on remote hosts] *********************************************
11:30:46 PM
ok: [10.20.66.7]
11:30:46 PM
11:30:46 PM
TASK [Capture update results on remote hosts] **********************************
11:30:46 PM
skipping: [10.20.66.7]
11:30:47 PM
11:30:47 PM
TASK [Send Discord message on update success on remote hosts] ******************
11:30:47 PM
skipping: [10.20.66.7]
11:30:47 PM
11:30:47 PM
TASK [Fail the playbook on Discord message failure (success)] ******************
11:30:47 PM
skipping: [10.20.66.7]
11:30:47 PM
11:30:47 PM
TASK [Send Discord message on update failure on remote hosts] ******************
11:30:47 PM
skipping: [10.20.66.7]
11:30:47 PM
11:30:47 PM
TASK [Fail the playbook on Discord message failure (failure)] ******************
11:30:47 PM
skipping: [10.20.66.7]
11:30:47 PM
11:30:47 PM
PLAY [all] *********************************************************************
11:30:47 PM
11:30:47 PM
TASK [Gathering Facts] *********************************************************
11:30:51 PM
ok: [10.20.66.8]
11:30:51 PM
11:30:51 PM
TASK [Check for the existence of update results file on remote hosts] **********
11:30:52 PM
ok: [10.20.66.8]
11:30:52 PM
11:30:52 PM
TASK [Delete existing update results file on remote hosts] *********************
11:30:53 PM
changed: [10.20.66.8]
11:30:53 PM
11:30:53 PM
TASK [Create/update automation-updates.txt file on remote hosts] ***************
11:30:55 PM
changed: [10.20.66.8]
11:30:55 PM
11:30:55 PM
TASK [Run updates on remote hosts] *********************************************
11:30:59 PM
ok: [10.20.66.8]
11:31:00 PM
11:31:00 PM
TASK [Capture update results on remote hosts] **********************************
11:31:00 PM
skipping: [10.20.66.8]
11:31:00 PM
11:31:00 PM
TASK [Send Discord message on update success on remote hosts] ******************
11:31:00 PM
skipping: [10.20.66.8]
11:31:00 PM
11:31:00 PM
TASK [Fail the playbook on Discord message failure (success)] ******************
11:31:00 PM
skipping: [10.20.66.8]
11:31:00 PM
11:31:00 PM
TASK [Send Discord message on update failure on remote hosts] ******************
11:31:00 PM
skipping: [10.20.66.8]
11:31:00 PM
11:31:00 PM
TASK [Fail the playbook on Discord message failure (failure)] ******************
11:31:00 PM
skipping: [10.20.66.8]
11:31:00 PM
11:31:00 PM
PLAY [all] *********************************************************************
11:31:00 PM
11:31:00 PM
TASK [Gathering Facts] *********************************************************
11:31:08 PM
ok: [10.20.66.250]
11:31:08 PM
11:31:08 PM
TASK [Check for the existence of update results file on remote hosts] **********
11:31:09 PM
ok: [10.20.66.250]
11:31:09 PM
11:31:09 PM
TASK [Delete existing update results file on remote hosts] *********************
11:31:10 PM
changed: [10.20.66.250]
11:31:10 PM
11:31:10 PM
TASK [Create/update automation-updates.txt file on remote hosts] ***************
11:31:12 PM
changed: [10.20.66.250]
11:31:12 PM
11:31:12 PM
TASK [Run updates on remote hosts] *********************************************
11:31:21 PM
ok: [10.20.66.250]
11:31:21 PM
11:31:21 PM
TASK [Capture update results on remote hosts] **********************************
11:31:21 PM
skipping: [10.20.66.250]
11:31:21 PM
11:31:21 PM
TASK [Send Discord message on update success on remote hosts] ******************
11:31:21 PM
skipping: [10.20.66.250]
11:31:21 PM
11:31:21 PM
TASK [Fail the playbook on Discord message failure (success)] ******************
11:31:21 PM
skipping: [10.20.66.250]
11:31:21 PM
11:31:21 PM
TASK [Send Discord message on update failure on remote hosts] ******************
11:31:21 PM
skipping: [10.20.66.250]
11:31:21 PM
11:31:21 PM
TASK [Fail the playbook on Discord message failure (failure)] ******************
11:31:21 PM
skipping: [10.20.66.250]
11:31:22 PM
11:31:22 PM
PLAY [all] *********************************************************************
11:31:22 PM
11:31:22 PM
TASK [Gathering Facts] *********************************************************
11:31:25 PM
ok: [10.20.66.251]
11:31:25 PM
11:31:25 PM
TASK [Check for the existence of update results file on remote hosts] **********
11:31:26 PM
ok: [10.20.66.251]
11:31:26 PM
11:31:26 PM
TASK [Delete existing update results file on remote hosts] *********************
11:31:26 PM
changed: [10.20.66.251]
11:31:26 PM
11:31:26 PM
TASK [Create/update automation-updates.txt file on remote hosts] ***************
11:31:28 PM
changed: [10.20.66.251]
11:31:28 PM
11:31:28 PM
TASK [Run updates on remote hosts] *********************************************
11:31:33 PM
ok: [10.20.66.251]
11:31:33 PM
11:31:33 PM
TASK [Capture update results on remote hosts] **********************************
11:31:33 PM
skipping: [10.20.66.251]
11:31:33 PM
11:31:33 PM
TASK [Send Discord message on update success on remote hosts] ******************
11:31:33 PM
skipping: [10.20.66.251]
11:31:33 PM
11:31:33 PM
TASK [Fail the playbook on Discord message failure (success)] ******************
11:31:33 PM
skipping: [10.20.66.251]
11:31:33 PM
11:31:33 PM
TASK [Send Discord message on update failure on remote hosts] ******************
11:31:33 PM
skipping: [10.20.66.251]
11:31:33 PM
11:31:33 PM
TASK [Fail the playbook on Discord message failure (failure)] ******************
11:31:33 PM
skipping: [10.20.66.251]
11:31:34 PM
11:31:34 PM
PLAY [all] *********************************************************************
11:31:34 PM
11:31:34 PM
TASK [Gathering Facts] *********************************************************
11:31:36 PM
ok: [10.20.66.252]
11:31:37 PM
11:31:37 PM
TASK [Check for the existence of update results file on remote hosts] **********
11:31:37 PM
ok: [10.20.66.252]
11:31:37 PM
11:31:37 PM
TASK [Delete existing update results file on remote hosts] *********************
11:31:38 PM
changed: [10.20.66.252]
11:31:38 PM
11:31:38 PM
TASK [Create/update automation-updates.txt file on remote hosts] ***************
11:31:40 PM
changed: [10.20.66.252]
11:31:40 PM
11:31:40 PM
TASK [Run updates on remote hosts] *********************************************
11:31:44 PM
ok: [10.20.66.252]
11:31:44 PM
11:31:44 PM
TASK [Capture update results on remote hosts] **********************************
11:31:44 PM
skipping: [10.20.66.252]
11:31:44 PM
11:31:44 PM
TASK [Send Discord message on update success on remote hosts] ******************
11:31:44 PM
skipping: [10.20.66.252]
11:31:44 PM
11:31:44 PM
TASK [Fail the playbook on Discord message failure (success)] ******************
11:31:44 PM
skipping: [10.20.66.252]
11:31:44 PM
11:31:44 PM
TASK [Send Discord message on update failure on remote hosts] ******************
11:31:44 PM
skipping: [10.20.66.252]
11:31:45 PM
11:31:45 PM
TASK [Fail the playbook on Discord message failure (failure)] ******************
11:31:45 PM
skipping: [10.20.66.252]
11:31:45 PM
11:31:45 PM
PLAY [all] *********************************************************************
11:31:45 PM
11:31:45 PM
TASK [Gathering Facts] *********************************************************
11:31:48 PM
ok: [10.20.66.253]
11:31:48 PM
11:31:48 PM
TASK [Check for the existence of update results file on remote hosts] **********
11:31:49 PM
ok: [10.20.66.253]
11:31:49 PM
11:31:49 PM
TASK [Delete existing update results file on remote hosts] *********************
11:31:50 PM
changed: [10.20.66.253]
11:31:50 PM
11:31:50 PM
TASK [Create/update automation-updates.txt file on remote hosts] ***************
11:31:52 PM
changed: [10.20.66.253]
11:31:52 PM
11:31:52 PM
TASK [Run updates on remote hosts] *********************************************
11:31:57 PM
ok: [10.20.66.253]
11:31:57 PM
11:31:57 PM
TASK [Capture update results on remote hosts] **********************************
11:31:57 PM
skipping: [10.20.66.253]
11:31:57 PM
11:31:57 PM
TASK [Send Discord message on update success on remote hosts] ******************
11:31:57 PM
skipping: [10.20.66.253]
11:31:57 PM
11:31:57 PM
TASK [Fail the playbook on Discord message failure (success)] ******************
11:31:57 PM
skipping: [10.20.66.253]
11:31:57 PM
11:31:57 PM
TASK [Send Discord message on update failure on remote hosts] ******************
11:31:57 PM
skipping: [10.20.66.253]
11:31:57 PM
11:31:57 PM
TASK [Fail the playbook on Discord message failure (failure)] ******************
11:31:57 PM
skipping: [10.20.66.253]
11:31:57 PM
11:31:57 PM
PLAY [all] *********************************************************************
11:31:58 PM
11:31:58 PM
TASK [Gathering Facts] *********************************************************
11:32:01 PM
ok: [10.20.66.254]
11:32:01 PM
11:32:01 PM
TASK [Check for the existence of update results file on remote hosts] **********
11:32:02 PM
ok: [10.20.66.254]
11:32:02 PM
11:32:02 PM
TASK [Delete existing update results file on remote hosts] *********************
11:32:03 PM
changed: [10.20.66.254]
11:32:03 PM
11:32:03 PM
TASK [Create/update automation-updates.txt file on remote hosts] ***************
11:32:05 PM
changed: [10.20.66.254]
11:32:05 PM
11:32:05 PM
TASK [Run updates on remote hosts] *********************************************
11:32:10 PM
ok: [10.20.66.254]
11:32:10 PM
11:32:10 PM
TASK [Capture update results on remote hosts] **********************************
11:32:10 PM
skipping: [10.20.66.254]
11:32:10 PM
11:32:10 PM
TASK [Send Discord message on update success on remote hosts] ******************
11:32:10 PM
skipping: [10.20.66.254]
11:32:10 PM
11:32:10 PM
TASK [Fail the playbook on Discord message failure (success)] ******************
11:32:10 PM
skipping: [10.20.66.254]
11:32:10 PM
11:32:10 PM
TASK [Send Discord message on update failure on remote hosts] ******************
11:32:10 PM
skipping: [10.20.66.254]
11:32:10 PM
11:32:10 PM
TASK [Fail the playbook on Discord message failure (failure)] ******************
11:32:10 PM
skipping: [10.20.66.254]
11:32:11 PM
11:32:11 PM
PLAY [all] *********************************************************************
11:32:11 PM
11:32:11 PM
TASK [Gathering Facts] *********************************************************
11:32:18 PM
ok: [10.20.66.230]
11:32:18 PM
11:32:18 PM
TASK [Check for the existence of update results file on remote hosts] **********
11:32:19 PM
ok: [10.20.66.230]
11:32:19 PM
11:32:19 PM
TASK [Delete existing update results file on remote hosts] *********************
11:32:20 PM
changed: [10.20.66.230]
11:32:20 PM
11:32:20 PM
TASK [Create/update automation-updates.txt file on remote hosts] ***************
11:32:22 PM
changed: [10.20.66.230]
11:32:22 PM
11:32:22 PM
TASK [Run updates on remote hosts] *********************************************
11:32:46 PM
ok: [10.20.66.230]
11:32:46 PM
11:32:46 PM
TASK [Capture update results on remote hosts] **********************************
11:32:46 PM
skipping: [10.20.66.230]
11:32:46 PM
11:32:46 PM
TASK [Send Discord message on update success on remote hosts] ******************
11:32:46 PM
skipping: [10.20.66.230]
11:32:46 PM
11:32:46 PM
TASK [Fail the playbook on Discord message failure (success)] ******************
11:32:46 PM
skipping: [10.20.66.230]
11:32:46 PM
11:32:46 PM
TASK [Send Discord message on update failure on remote hosts] ******************
11:32:46 PM
skipping: [10.20.66.230]
11:32:46 PM
11:32:46 PM
TASK [Fail the playbook on Discord message failure (failure)] ******************
11:32:46 PM
skipping: [10.20.66.230]
11:32:46 PM
11:32:46 PM
PLAY [all] *********************************************************************
11:32:46 PM
11:32:46 PM
TASK [Gathering Facts] *********************************************************
11:32:50 PM
ok: [10.20.66.60]
11:32:50 PM
11:32:50 PM
TASK [Check for the existence of update results file on remote hosts] **********
11:32:51 PM
ok: [10.20.66.60]
11:32:51 PM
11:32:51 PM
TASK [Delete existing update results file on remote hosts] *********************
11:32:51 PM
skipping: [10.20.66.60]
11:32:51 PM
11:32:51 PM
TASK [Create/update automation-updates.txt file on remote hosts] ***************
11:32:52 PM
changed: [10.20.66.60]
11:32:52 PM
11:32:52 PM
TASK [Run updates on remote hosts] *********************************************
11:32:58 PM
ok: [10.20.66.60]
11:32:58 PM
11:32:58 PM
TASK [Capture update results on remote hosts] **********************************
11:32:58 PM
skipping: [10.20.66.60]
11:32:58 PM
11:32:58 PM
TASK [Send Discord message on update success on remote hosts] ******************
11:32:59 PM
skipping: [10.20.66.60]
11:32:59 PM
11:32:59 PM
TASK [Fail the playbook on Discord message failure (success)] ******************
11:32:59 PM
skipping: [10.20.66.60]
11:32:59 PM
11:32:59 PM
TASK [Send Discord message on update failure on remote hosts] ******************
11:32:59 PM
skipping: [10.20.66.60]
11:32:59 PM
11:32:59 PM
TASK [Fail the playbook on Discord message failure (failure)] ******************
11:32:59 PM
skipping: [10.20.66.60]
11:32:59 PM
11:32:59 PM
PLAY [all] *********************************************************************
11:32:59 PM
11:32:59 PM
TASK [Gathering Facts] *********************************************************
11:33:02 PM
ok: [10.20.66.225]
11:33:02 PM
11:33:02 PM
TASK [Check for the existence of update results file on remote hosts] **********
11:33:03 PM
ok: [10.20.66.225]
11:33:03 PM
11:33:03 PM
TASK [Delete existing update results file on remote hosts] *********************
11:33:03 PM
skipping: [10.20.66.225]
11:33:03 PM
11:33:03 PM
TASK [Create/update automation-updates.txt file on remote hosts] ***************
11:33:05 PM
changed: [10.20.66.225]
11:33:05 PM
11:33:05 PM
TASK [Run updates on remote hosts] *********************************************
11:33:12 PM
ok: [10.20.66.225]
11:33:12 PM
11:33:12 PM
TASK [Capture update results on remote hosts] **********************************
11:33:12 PM
skipping: [10.20.66.225]
11:33:12 PM
11:33:12 PM
TASK [Send Discord message on update success on remote hosts] ******************
11:33:12 PM
skipping: [10.20.66.225]
11:33:12 PM
11:33:12 PM
TASK [Fail the playbook on Discord message failure (success)] ******************
11:33:12 PM
skipping: [10.20.66.225]
11:33:12 PM
11:33:12 PM
TASK [Send Discord message on update failure on remote hosts] ******************
11:33:12 PM
skipping: [10.20.66.225]
11:33:12 PM
11:33:12 PM
TASK [Fail the playbook on Discord message failure (failure)] ******************
11:33:13 PM
skipping: [10.20.66.225]
11:33:13 PM
11:33:13 PM
PLAY [all] *********************************************************************
11:33:13 PM
11:33:13 PM
TASK [Gathering Facts] *********************************************************
11:33:16 PM
ok: [10.20.66.25]
11:33:16 PM
11:33:16 PM
TASK [Check for the existence of update results file on remote hosts] **********
11:33:17 PM
ok: [10.20.66.25]
11:33:17 PM
11:33:17 PM
TASK [Delete existing update results file on remote hosts] *********************
11:33:17 PM
skipping: [10.20.66.25]
11:33:17 PM
11:33:17 PM
TASK [Create/update automation-updates.txt file on remote hosts] ***************
11:33:18 PM
changed: [10.20.66.25]
11:33:18 PM
11:33:18 PM
TASK [Run updates on remote hosts] *********************************************
11:33:29 PM
changed: [10.20.66.25]
11:33:29 PM
11:33:29 PM
TASK [Capture update results on remote hosts] **********************************
11:33:31 PM
changed: [10.20.66.25]
11:33:31 PM
11:33:31 PM
TASK [Send Discord message on update success on remote hosts] ******************
11:33:33 PM
fatal: [10.20.66.25]: FAILED! => {"alt_svc": "h3=":443"; ma=86400", "cf_cache_status": "DYNAMIC", "cf_ray": "8309925368a881bb-IAD", "changed": false, "connection": "close", "content_security_policy": "frame-ancestors 'none'; default-src 'none'", "content_type": "text/html; charset=utf-8", "cookies": {"__cfruid": "1a3cnm43a424c12517b490d88c177082ed3-1701750812", "__dcfduid": "7272814e932711eeb90d821cef9fdd60", "__sdcfduid": "7272814e932711eeb90d821cef9fdkzgxhd875f02ecc3289e55c19a0c06523ea20bd9cdb4535a39d1532a861d18a0e284", "_cfuvid": "waVV9SzMNG4N1omomo586qcvjhxdBoEzd_xh3O19ZJ9U-1701750812826-0-604800000"}, "cookies_string": "__dcfduid=7272814e932711eeb90d821cef9fdd60; __sdcfduid=7272814e932711eeb90d821cef9fdd608b875f02lmho875f02ecc3289e55c19a0c06523ea20bd9cdb4535a39d1532a861d18a0e284; __cfruid=1a3c552be1e43a424c12517b490d88c177082ed3-1ecc3289e55c19a0c06523ea20bd9cdb4535a39d1532a861d18a0e284; __cfruid=1a3c552be1e43a424c12517b490d88c177082ed3-1701750812; _cfuvid=waVV9SzvuphIF7zoqGBlvaBoEzd_xh3O19ZJ9U-1701750812826-0-604800000", "date": "Tue, 05 Dec 2023 04:33:32 GMT", "elapsed": 0, "msg": "Status code was 204 and not [200]: OK (unknown bytes)", "nel": "{"success_fraction":0,"report_to":"cf-nel","max_age":604800}", "redirected": false, "report_to": "{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=LgKp5G%2FtyzRjPVburPvksQj9RvfhY6b65swgkiQtIEILkL8gzTDRhMpFidu358ewMsRlkzdvMzPELUYbpfLhc1eWgxziw3TiCPZLKRHj0Wd5ZQlxphyuKgmonOtJ"}],"group":"cf-nel","max_age":604800}", "server": "cloudflare", "set_cookie": "__dcfduid=7272814e932711eeb90d821cef9fdd60; Expires=Sun, 03-Dec-2028 04:33:32 GMT; Max-Age=157680000; Secure; HttpOnly; Path=/, __sdcfduid=7272814e932bihouopjc3289e55c19a0c06523ea20bd9cdb4535a39d1532a861d18a0e284; Expires=Sun, 03-Dec-2028 04:33:32 GMT; Max-Age=157680000; Secure; HttpOnly; Path=/, __cfruid=1a3c552be1e43a424c12517b490d88c177082ed3-1701750812; path=/; domain=.discord.com; HttpOnly; Secure; SameSite=None, _cfuvid=waVV9SzigobnStrBlvaBoEzd_xh3O19ZJ9U-1701750812826-0-604800000; path=/; domain=.discord.com; HttpOnly; Secure; SameSite=None", "status": 204, "strict_transport_security": "max-age=31536000; includeSubDomains; preload", "url": "https://discord.com/api/webhooks/mywebhook", "via": "1.1 google", "x_content_type_options": "nosniff", "x_ratelimit_bucket": "3d2712a9e4fe17cc9d3fed4gihgohf", "x_ratelimit_limit": "5", "x_ratelimit_remaining": "4", "x_ratelimit_reset": "1701750814", "x_ratelimit_reset_after": "1"}
11:33:33 PM
11:33:33 PM
PLAY RECAP *********************************************************************
11:33:33 PM
10.20.66.225 : ok=4 changed=1 unreachable=0 failed=0 skipped=6 rescued=0 ignored=0
11:33:33 PM
10.20.66.230 : ok=5 changed=2 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
11:33:33 PM
10.20.66.25 : ok=5 changed=3 unreachable=0 failed=1 skipped=1 rescued=0 ignored=0
11:33:33 PM
10.20.66.250 : ok=5 changed=2 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
11:33:33 PM
10.20.66.251 : ok=5 changed=2 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
11:33:33 PM
10.20.66.252 : ok=5 changed=2 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
11:33:33 PM
10.20.66.253 : ok=5 changed=2 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
11:33:33 PM
10.20.66.254 : ok=5 changed=2 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
11:33:33 PM
10.20.66.3 : ok=5 changed=2 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
11:33:33 PM
10.20.66.4 : ok=5 changed=2 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
11:33:33 PM
10.20.66.5 : ok=5 changed=2 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
11:33:33 PM
10.20.66.6 : ok=5 changed=2 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
11:33:33 PM
10.20.66.60 : ok=4 changed=1 unreachable=0 failed=0 skipped=6 rescued=0 ignored=0
11:33:33 PM
10.20.66.7 : ok=5 changed=2 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
11:33:33 PM
10.20.66.8 : ok=5 changed=2 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
11:33:33 PM
11:33:33 PM
Running playbook failed: exit status 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment