Matteo Scandolo | 3896c47 | 2017-08-01 13:31:42 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Zack Williams | a9421e2 | 2016-03-02 13:53:37 -0700 | [diff] [blame] | 17 | --- |
Zack Williams | 5223dd9 | 2017-02-28 23:38:02 -0700 | [diff] [blame] | 18 | # file: common-prep/handlers/main.yml |
Zack Williams | a9421e2 | 2016-03-02 13:53:37 -0700 | [diff] [blame] | 19 | |
| 20 | # from https://support.ansible.com/hc/en-us/articles/201958037-Reboot-a-server-and-wait-for-it-to-come-back |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 21 | - name: restart host |
Zack Williams | 5223dd9 | 2017-02-28 23:38:02 -0700 | [diff] [blame] | 22 | shell: > |
| 23 | sleep 2 && shutdown -r now "Ansible updates triggered" |
Zack Williams | a9421e2 | 2016-03-02 13:53:37 -0700 | [diff] [blame] | 24 | async: 1 |
| 25 | poll: 0 |
| 26 | ignore_errors: true |
| 27 | |
Zack Williams | 709f11b | 2016-03-17 14:29:51 -0700 | [diff] [blame] | 28 | # wait 1m, then try to contact machine for 10m |
| 29 | - name: wait for host |
Zack Williams | a9421e2 | 2016-03-02 13:53:37 -0700 | [diff] [blame] | 30 | become: false |
| 31 | local_action: |
Zack Williams | 5223dd9 | 2017-02-28 23:38:02 -0700 | [diff] [blame] | 32 | wait_for |
| 33 | host={{ inventory_hostname }} |
Zack Williams | a9421e2 | 2016-03-02 13:53:37 -0700 | [diff] [blame] | 34 | port=22 |
Zack Williams | 5223dd9 | 2017-02-28 23:38:02 -0700 | [diff] [blame] | 35 | search_regex=OpenSSH |
| 36 | delay=60 |
| 37 | timeout=600 |
Zack Williams | a9421e2 | 2016-03-02 13:53:37 -0700 | [diff] [blame] | 38 | |