-
Notifications
You must be signed in to change notification settings - Fork 5
/
lb_check.yml
70 lines (57 loc) · 1.69 KB
/
lb_check.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
---
- name: Power off all VMs
hosts: bootstrap_grp, masters_grp, infra_routers_grp
become: no
gather_facts: no
vars_files:
- vault.yml
- vars/rhel_vmware.yml
tasks:
- name: Power off vm
vmware_guest_powerstate:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: "{{ not vcenter_insecure_ssl }}"
folder: "{{ vm_folder }}"
name: "{{ inventory_hostname }}.{{ dns_domain }}"
state: shutdown-guest
state_change_timeout: 200
register: output
failed_when: output.instance.hw_power_status != 'poweredOff'
delegate_to: localhost
- name: LB check
hosts: localhost
become: no
gather_facts: no
vars_files:
- vault.yml
vars:
master_lb_ports:
- 6443
- 22623
apps_lb_ports:
- 80
- 443
tasks:
# Let's do masters first
- set_fact:
test_hosts: "{{ (groups['bootstrap_grp'] + groups['masters_grp'] + groups['infra_routers_grp']) | sort }}"
#test_hosts: "{{ groups['masters'] | sort }}"
#test_hosts: "{{groups['infra_routers'] | sort }}"
- name: List of hosts to test
debug:
var: test_hosts
- name: Test LB
include_role:
role: lb_check
loop: "{{ test_hosts }}"
loop_control:
loop_var: outer_item
label: "{{ outer_item }}"
- template:
src: templates/lb_check.txt.j2
dest: /tmp/lb_check.txt
vars:
masters_lb_ip: "{{hostvars[groups['master_lb'][0]]['ansible_host']}}"
apps_lb_ip: "{{hostvars[groups['apps_lb'][0]]['ansible_host']}}"