Skip to content

Commit bcc3cdd

Browse files
committed
simplify script
1 parent cb1fe83 commit bcc3cdd

4 files changed

Lines changed: 14 additions & 64 deletions

File tree

config_base_playbook.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

inc_test_loadbalancer_tasklist.yml

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,39 @@
11
---
22
# playbook loops over:
3-
# locations (item.1)
4-
# haproxy_applications (item.0)
3+
# loadbalancers
4+
# haproxy_applications (item)
55
#
6-
# for example:
7-
# item.1 is amsterdam:
8-
# when item.1 in group_names
9-
# haproxy_sni_ip_(restricted)
6+
# and does an url request on lodbalancer ip with vhostname as the host header
107

11-
# Try to reach applications via loadbalancer with restricted ip v4
12-
- name: Try to reach {{ item.0.vhost_name }} via https://{{ haproxy_sni_ip_restricted.ipv4 }}:443 # noqa: name[template] jinja template helps with debugging
13-
when: item.0.restricted is defined and item.0.restricted and item.1 in group_names # item.1 is the location
8+
- name: Try to reach {{ item.vhost_name }} via https://{{ haproxy_sni_ip_restricted.ipv4 }}:443 # noqa: name[template] jinja template helps with debugging
9+
when: item.restricted is defined and item.restricted
1410
ansible.builtin.uri:
15-
url: "https://{{ haproxy_sni_ip_restricted.ipv4 }}:443/{{ item.0.ha_url }}"
11+
url: "https://{{ haproxy_sni_ip_restricted.ipv4 }}:443/{{ item.ha_url }}"
1612
method: GET
1713
status_code: [200, 302]
1814
return_content: false
1915
validate_certs: false
2016
headers:
21-
host: "{{ item.0.vhost_name }}"
17+
host: "{{ item.vhost_name }}"
2218
register: result
2319
until: result.status == 200 or result.status == 302
2420
retries: 3
2521
delay: 2
26-
delegate_to: 127.0.0.1
27-
#ignore_errors: true # remove this when all apps have internal/health endpoint
28-
29-
- name: debugging
30-
debug:
31-
msg: "{{ result }}"
22+
delegate_to: 127.0.0.1 # run check from deploy host
3223

3324
# Try to reach applications via loadbalancer without restricted ip v4
34-
- name: Try to reach {{ item.0.vhost_name }} via https://{{ haproxy_sni_ip.ipv4 }}:443 # noqa: name[template] jinja template helps with debugging
35-
when: item.0.restricted is undefined and item.1 in group_names # item.1 is the location
25+
- name: Try to reach {{ item.vhost_name }} via https://{{ haproxy_sni_ip.ipv4 }}:443 # noqa: name[template] jinja template helps with debugging
26+
when: item.restricted is undefined
3627
ansible.builtin.uri:
37-
url: "https://{{ haproxy_sni_ip.ipv4 }}:443/{{ item.0.ha_url }}"
28+
url: "https://{{ haproxy_sni_ip.ipv4 }}:443/{{ item.ha_url }}"
3829
method: GET
3930
status_code: [200, 302]
4031
return_content: false
4132
validate_certs: false
4233
headers:
43-
host: "{{ item.0.vhost_name }}"
34+
host: "{{ item.vhost_name }}"
4435
register: result
4536
until: result.status == 200 or result.status == 302
4637
retries: 3
4738
delay: 2
48-
delegate_to: 127.0.0.1
49-
#ignore_errors: true # remove this when all apps have internal/health endpoint
50-
51-
- name: debugging
52-
debug:
53-
msg: "{{ result }}"
39+
delegate_to: 127.0.0.1 #run check from deploy host

test_loadbalancers_playbook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
- name: Include task list in play
1515
ansible.builtin.include_tasks:
1616
file: inc_test_loadbalancer_tasklist.yml
17-
loop: "{{ haproxy_applications | product(locations) }}" # add locations to the array
17+
with_items: "{{ haproxy_applications }}"

0 commit comments

Comments
 (0)