Last change
on this file since 14276 was
14187,
checked in by uli, 8 years ago
|
Set port when waiting for server reboot.
When we reboot a host and wait for it to come up again, ansible will
by default wait for the complete timeout time before
continuing. Even if the host is already up for minutes.
But if we tell what port to check (SSH), ansible continues happily a
few seconds after the host is back up again. Just as it should :D
Tonight I tested on h5...h7 and it really worked.
We can now reboot all hosts with one command - while all special
services like Plone instances, odoo instances, kofas, etc. will be
shutdown and restartet correctly and automatically. Yay!
|
File size:
865 bytes
|
Line | |
---|
1 | --- |
---|
2 | # This ansible-playbook reboots productive |
---|
3 | # servers |
---|
4 | # |
---|
5 | # What it does: |
---|
6 | # stop all services in need of manual stop |
---|
7 | # then reboot |
---|
8 | # then start all services in need of manual action. |
---|
9 | # |
---|
10 | # It will normally be run with ``ask-pass`` |
---|
11 | # |
---|
12 | # Sample: |
---|
13 | # |
---|
14 | # $ ansible-playbook -i host -K -l h5.waeup.org playbook-reboot.yml |
---|
15 | # |
---|
16 | |
---|
17 | - include: playbook-prep-reboot.yml |
---|
18 | |
---|
19 | - hosts: all |
---|
20 | become: yes |
---|
21 | become_user: root |
---|
22 | tasks: |
---|
23 | - name: Restart machine |
---|
24 | command: shutdown -r now "Ansible triggered reboot" |
---|
25 | async: 0 |
---|
26 | poll: 0 |
---|
27 | ignore_errors: true |
---|
28 | |
---|
29 | - name: Wait for server to come back |
---|
30 | become: no |
---|
31 | local_action: wait_for |
---|
32 | host={{ inventory_hostname }} |
---|
33 | port=22 |
---|
34 | state=started |
---|
35 | delay=30 |
---|
36 | timeout=300 |
---|
37 | connect_timeout=5 |
---|
38 | |
---|
39 | - include: playbook-post-reboot.yml |
---|
Note: See
TracBrowser for help on using the repository browser.