# Automate shutdown command via Ansible playbook

**URL:** <https://forum.ansible.com/t/automate-shutdown-command-via-ansible-playbook/36451>\
**Category:** Ansible Project\
**Created:** [March 16, 2022, 7:51pm UTC](https://forum.ansible.com/t/automate-shutdown-command-via-ansible-playbook/36451 "2022-03-16T19:51:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xinhuan\_Zheng](https://avatars.discourse-cdn.com/v4/letter/x/a88e57/32.png) [@Xinhuan\_Zheng](https://forum.ansible.com/u/Xinhuan_Zheng)\
**Post date:** [March 16, 2022, 7:51pm UTC](https://forum.ansible.com/t/automate-shutdown-command-via-ansible-playbook/36451/1 "2022-03-16T19:51:30Z")

</div>

I’m using ansible 2.9. There is no _shutdown_ module available.

I need to automate shutdown command via Ansible playbook. The target hosts are different distributions of CentOS servers - 7 or 6. When I ran the playbook to shutdown them, the execution will hang forever for one of CentOS 7 servers. I had to hit Ctrl-C. The execution stopped when _example8_ is down. It is CentOS 7. The _example7_ is CentOS 6 and does not hang forever.

inventory file:  
[shutdown\_300]  
example1

[shutdown\_301]  
example2

[shutdown\_302]  
example3

[shutdown\_303]  
example4

[shutdown\_304]  
example5

[shutdown\_305]  
example6

[shutdown\_306]  
example7  
example8

[shutdown\_30:children]  
shutdown\_306  
shutdown\_305  
shutdown\_304  
shutdown\_303  
shutdown\_302  
shutdown\_301  
shutdown\_300

Here is the playbook:

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [March 16, 2022, 7:59pm UTC](https://forum.ansible.com/t/automate-shutdown-command-via-ansible-playbook/36451/2 "2022-03-16T19:59:55Z")

</div>

Don’t waste time on working around problems in unsupported software.

Instead use the energy to upgrade to something supported.

---

<div class="post-metadata">

**Author:** ![Nico\_Kadel-Garcia](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/nico_kadel-garcia/32/9998_2.png) [@Nico\_Kadel-Garcia](https://forum.ansible.com/u/Nico_Kadel-Garcia)\
**Post date:** [March 16, 2022, 10:02pm UTC](https://forum.ansible.com/t/automate-shutdown-command-via-ansible-playbook/36451/3 "2022-03-16T22:02:37Z")

</div>

A more recent version is not published as an RPM for RHEL systems. If  
you want one, I publish tools to build RPMs for it at  
[https://github.com/nkadel/ansiblerepo/](https://github.com/nkadel/ansiblerepo/)

You probably have no use for the current ansible package. It is a very  
bulky agglomeration of roughly 100 ansible collection modules, and  
\*all\* the necessary scripts and python modules for basic ansible  
operation are in the ansible-core package. I suspect that if you rip  
out ansible, install ansible-core, and install the ansible collection  
modules on if and when needed, you will have a much more stable  
ansible setup.
