Reboot - add parameter for paths to search for shutdown command (#51194)

* Look in /lib/molly-guard for shutdown command

Signed-off-by: Sam Doran <sdoran@redhat.com>

* Add parameter for extra_search_paths

Signed-off-by: Sam Doran <sdoran@redhat.com>

* Change option to search_paths

- Update docs
- Make the parameter replace the default values
- Add some sanity checking on the data type

Signed-off-by: Sam Doran <sdoran@redhat.com>

* Correct parameter in tests, change conditional for molly-guard tasks

Signed-off-by: Sam Doran <sdoran@redhat.com>

* Address feedback

* Simplify field validation

Needed the try except in case a non-iterable type is put in the search_paths field
This commit is contained in:
Sam Doran
2019-02-28 16:36:33 -05:00
committed by Matt Davis
parent 4e6c113bf0
commit 1c87ea6fa6
4 changed files with 61 additions and 4 deletions

View File

@@ -37,11 +37,13 @@
- name: Reboot with all options
reboot:
connect_timeout: 30
search_paths: /usr/local/bin
msg: Rebooting
post_reboot_delay: 1
pre_reboot_delay: 61
test_command: uptime
reboot_timeout: 500
register: reboot_result
- import_tasks: check_reboot.yml
@@ -51,6 +53,7 @@
reboot:
post_reboot_delay: -0.5
pre_reboot_delay: -61
register: reboot_result
- import_tasks: check_reboot.yml
@@ -75,6 +78,27 @@
vars:
timeout: "{{ timeout_value[ansible_facts['distribution'] | lower] | default(60) }}"
- name: Test molly-guard
block:
- import_tasks: get_boot_time.yml
- name: Install molly-guard
apt:
update_cache: yes
name: molly-guard
state: present
- name: Reboot when molly-guard is installed
reboot:
search_paths: /lib/molly-guard
register: reboot_result
- import_tasks: check_reboot.yml
when: ansible_facts.distribution in ['Debian', 'Ubuntu']
tags:
- molly-guard
always:
- name: Cleanup temp file
file: