From 63f1b87a21a7c33d5131e563df58c72b7bbc1ae8 Mon Sep 17 00:00:00 2001 From: Robert de Bock Date: Oct 19 2018 08:04:51 +0000 Subject: A custom message for rebooting. --- diff --git a/README.md b/README.md index 2f3f3d6..b1f5249 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Role Variables reboot_delay: How long to wait in seconds before sending a reboot. [default: 4] reboot_up_delay: Number of seconds to wait before checking if the machine is up. [default: 8] +reboot_message: Include a personalized message that will be stored in logs. [default: see `defaults/main.yml`] Dependencies ------------ diff --git a/defaults/main.yml b/defaults/main.yml index 81face6..1e814cd 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -6,3 +6,6 @@ reboot_delay: 4 # Number of seconds to wait before checking if the machine is up. reboot_up_delay: 8 + +# You can specify a message for rebooting, easier for auditing. +reboot_message: "Ansible role robertdebock.reboot initiated a reboot." diff --git a/tasks/main.yml b/tasks/main.yml index 2120495..708b16d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,7 @@ --- # tasks file for reboot - name: reboot the machine - shell: (sleep "{{ reboot_delay }}" && shutdown -r now "ansible-role-reboot" &) + shell: (sleep "{{ reboot_delay }}" && shutdown -r now "{{ reboot_message }}" &) async: 1 poll: 0 ignore_errors: yes