blob: 0a89b583277b840bf6473c2e2e43d294ccc29314 [file] [log] [blame]
Matteo Scandolo3896c472017-08-01 13:31:42 -07001
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 Williamsa9421e22016-03-02 13:53:37 -070017---
Zack Williams5223dd92017-02-28 23:38:02 -070018# file: common-prep/handlers/main.yml
Zack Williamsa9421e22016-03-02 13:53:37 -070019
20# from https://support.ansible.com/hc/en-us/articles/201958037-Reboot-a-server-and-wait-for-it-to-come-back
Zack Williams709f11b2016-03-17 14:29:51 -070021- name: restart host
Zack Williams5223dd92017-02-28 23:38:02 -070022 shell: >
23 sleep 2 && shutdown -r now "Ansible updates triggered"
Zack Williamsa9421e22016-03-02 13:53:37 -070024 async: 1
25 poll: 0
26 ignore_errors: true
27
Zack Williams709f11b2016-03-17 14:29:51 -070028# wait 1m, then try to contact machine for 10m
29- name: wait for host
Zack Williamsa9421e22016-03-02 13:53:37 -070030 become: false
31 local_action:
Zack Williams5223dd92017-02-28 23:38:02 -070032 wait_for
33 host={{ inventory_hostname }}
Zack Williamsa9421e22016-03-02 13:53:37 -070034 port=22
Zack Williams5223dd92017-02-28 23:38:02 -070035 search_regex=OpenSSH
36 delay=60
37 timeout=600
Zack Williamsa9421e22016-03-02 13:53:37 -070038