From 7c8af3d684623dda4298932e779234bff43d4a9c Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Tue, 11 Dec 2018 15:30:11 -0500 Subject: [PATCH] Reboot - Fix VMware ESXi not working by adding appropriate commands (#49637) * Add commands for VMware ESXi * Add changelog --- changelogs/fragments/reboot-vmware-esxi.yaml | 2 ++ lib/ansible/plugins/action/reboot.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/reboot-vmware-esxi.yaml diff --git a/changelogs/fragments/reboot-vmware-esxi.yaml b/changelogs/fragments/reboot-vmware-esxi.yaml new file mode 100644 index 0000000000..a626fd5dba --- /dev/null +++ b/changelogs/fragments/reboot-vmware-esxi.yaml @@ -0,0 +1,2 @@ +bugfixes: + - reboot - add appropriate commands to make the plugin work with VMware ESXi (https://github.com/ansible/ansible/issues/48425) diff --git a/lib/ansible/plugins/action/reboot.py b/lib/ansible/plugins/action/reboot.py index 9686c207e4..7c933808a0 100644 --- a/lib/ansible/plugins/action/reboot.py +++ b/lib/ansible/plugins/action/reboot.py @@ -45,10 +45,12 @@ class ActionModule(ActionBase): 'macosx': 'who -b', 'solaris': 'who -b', 'sunos': 'who -b', + 'vmkernel': 'grep booted /var/log/vmksummary.log | tail -n 1', } SHUTDOWN_COMMANDS = { 'alpine': 'reboot', + 'vmkernel': 'reboot', } SHUTDOWN_COMMAND_ARGS = { @@ -59,10 +61,12 @@ class ActionModule(ActionBase): 'openbsd': '-r +{delay_min} "{message}"', 'solaris': '-y -g {delay_sec} -i 6 "{message}"', 'sunos': '-y -g {delay_sec} -i 6 "{message}"', + 'vmkernel': '-d {delay_sec}', } TEST_COMMANDS = { - 'solaris': 'who' + 'solaris': 'who', + 'vmkernel': 'who', } def __init__(self, *args, **kwargs):