This repository was archived by the owner on Oct 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathwait_for_clients_ping.yml
98 lines (86 loc) · 3.18 KB
/
wait_for_clients_ping.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
# Copyright 2019 IBM Corp.
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: wait_for_clients_ping.yml
hosts: localhost
vars:
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
tasks:
- name: Get list of client IP addresses
command: "{{ python_executable_local }} \
{{ scripts_path_local }}/python/client_ip_list.py"
register: system_list
- name: Wait for successful Ansible 'ping' from each client
command: "ansible all -i '{{ system_list.stdout }},' \
-u root \
--private-key='{{ ssh_key_private }}' \
-m ping"
environment:
ANSIBLE_HOST_KEY_CHECKING: False
register: result_1
until: result_1.rc == 0
retries: 20
delay: 30
failed_when: result_1.rc != 0 and result_1.rc != 4
- name: Print Ansible 'ping' results
debug:
msg: "{{ result_1.stdout.split('\n') }}"
- name: Get Cobbler status
command: "cobbler status"
delegate_to: deployer
become: "yes"
become_method: sudo
register: cobbler_status
- name: Print Cobbler Install Status
debug:
msg: "{{ cobbler_status.stdout.split('\n') }}"
- block:
- name: Display message
vars:
msg: |
Ansible is not yet able to connect to all client nodes. Cluster
POWER-Up will continue to poll connections, but if a client is
seen as 'installing' for an extended period of time it is likely
that the installer has encountered a problem. You may be able to
interact with the installer via IPMI SOL console to resolve the
problem manually.
debug:
msg: "{{ msg.split('\n') }}"
- name: Wait for successful Ansible 'ping' from each client
command: "ansible all -i '{{ system_list.stdout }},' \
-u root \
--private-key='{{ ssh_key_private }}' \
-m ping"
environment:
ANSIBLE_HOST_KEY_CHECKING: False
register: result_2
until: result_2.rc == 0
retries: 40
delay: 30
failed_when: result_2.rc != 0 and result_2.rc != 4
- name: Print Ansible 'ping' results
debug:
msg: "{{ result_2.stdout.split('\n') }}"
- name: Get Cobbler status
command: "cobbler status"
delegate_to: deployer
become: "yes"
become_method: sudo
register: cobbler_status
- name: Print Cobbler Install Status
debug:
msg: "{{ cobbler_status.stdout.split('\n') }}"
when: result_1.rc == 4