Note
This plugin is part of the community.general collection (version 3.8.1).
You might already have this collection installed if you are using the ansible
package. It is not included in ansible-core
. To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.shutdown
.
New in version 1.1.0: of community.general
Note
This module has a corresponding action plugin.
Parameter | Choices/Defaults | Comments |
---|---|---|
delay integer | Default: 0 | Seconds to wait before shutdown. Passed as a parameter to the shutdown command. On Linux, macOS and OpenBSD, this is converted to minutes and rounded down. If less than 60, it will be set to 0. On Solaris and FreeBSD, this will be seconds. |
msg string | Default: "Shut down initiated by Ansible" | Message to display to users before shutdown. |
search_paths list / elements=path | Default: ["/sbin", "/usr/sbin", "/usr/local/sbin"] | Paths to search on the remote machine for the shutdown command.
Only these paths will be searched for the shutdown command. PATH is ignored in the remote node when searching for the shutdown command. |
Note
PATH
is ignored on the remote node when searching for the shutdown
command. Use search_paths to specify locations to search if the default paths do not work.See also
The official documentation on the ansible.builtin.reboot module.
- name: Unconditionally shut down the machine with all defaults community.general.shutdown: - name: Delay shutting down the remote node community.general.shutdown: delay: 60 - name: Shut down a machine with shutdown command in unusual place community.general.shutdown: search_paths: - '/lib/molly-guard'
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
shutdown boolean | always | true if the machine has been shut down.Sample: True |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/shutdown_module.html