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:
---
- hosts: shutdown_30
  gather_facts: no

  tasks:
    - name: Shutdown order 30 
      raw: shutdown -h now
      ignore_unreachable: true
      ignore_errors: true

command to run the playbook:
ansible-playbook -i inventory shutdown.yml

Is there better way to prevent hang because the host is down?

Xinhuan

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c97387ff-7d68-4257-bb3c-e6130d5b1460n%40googlegroups.com.

Reply via email to