Skip to content

Commit

Permalink
use common hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn committed Oct 1, 2024
1 parent b26d244 commit b4cdd12
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions playbooks/prerun-network-checks.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
# This playbook is used to run preliminary network checks for the hosts in the ACS deployment.
# the default('localhost') is only useful while testing on molecule
- name: Run preliminary network checks for repository hosts
hosts: repository
become: true
Expand All @@ -11,31 +10,31 @@
- name: Check db connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.database[0]].ansible_host | default('localhost') }}"
checked_host: "{{ db_host }}"
checked_port: "{{ ports_cfg.postgres.sql }}"
delegate_target: "{{ groups.database | first }}"
when: repo_db_url == "" and groups.database | default([]) | length > 0

- name: Check activemq connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.activemq[0]].ansible_host | default('localhost') }}"
checked_host: "{{ activemq_host }}"
checked_port: "{{ ports_cfg.activemq[activemq_protocol] }}"
delegate_target: "{{ groups.activemq | first }}"
when: groups.activemq | default([]) | length > 0

- name: Check search connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.search[0]].ansible_host | default('localhost') }}"
checked_host: "{{ solr_host }}"
checked_port: "{{ ports_cfg.search.http }}"
delegate_target: "{{ groups.search | first }}"
when: groups.search | default([]) | length > 0

- name: Check sync connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.syncservice[0]].ansible_host | default('localhost') }}"
checked_host: "{{ sync_host }}"
checked_port: "{{ ports_cfg.sync.http }}"
delegate_target: "{{ groups.syncservice | first }}"
when:
Expand All @@ -44,23 +43,23 @@
- name: Check sfs connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.transformers[0]].ansible_host | default('localhost') }}"
checked_host: "{{ sfs_host }}"
checked_port: "{{ ports_cfg.sfs.http }}"
delegate_target: "{{ groups.transformers | first }}"
when: acs.edition == "Enterprise" and groups.transformers | default([]) | length > 0

- name: Check trouter connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.transformers[0]].ansible_host | default('localhost') }}"
checked_host: "{{ trouter_host }}"
checked_port: "{{ ports_cfg.transformers.trouter }}"
delegate_target: "{{ groups.transformers | first }}"
when: acs.edition == "Enterprise" and groups.transformers | default([]) | length > 0

- name: Check tengine connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.transformers[0]].ansible_host | default('localhost') }}"
checked_host: "{{ ats_tengine_aio_host }}"
checked_port: "{{ ports_cfg.transformers.tengine }}"
delegate_target: "{{ groups.transformers | first }}"
when: groups.transformers | default([]) | length > 0
Expand All @@ -75,7 +74,7 @@
- name: Check repo connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.repository[0]].ansible_host | default('localhost') }}"
checked_host: "{{ repo_host }}"
checked_port: "{{ ports_cfg.repository.http }}"
delegate_target: "{{ groups.repository | first }}"
when: groups.repository | default([]) | length > 0
Expand All @@ -90,7 +89,7 @@
- name: Check activemq connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.activemq[0]].ansible_host | default('localhost') }}"
checked_host: "{{ activemq_host }}"
checked_port: "{{ ports_cfg.activemq[activemq_protocol] }}"
delegate_target: "{{ groups.activemq | first }}"
when: groups.activemq | default([]) | length > 0
Expand All @@ -105,23 +104,23 @@
- name: Check db connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.database[0]].ansible_host | default('localhost') }}"
checked_host: "{{ db_host }}"
checked_port: "{{ ports_cfg.postgres.sql }}"
delegate_target: "{{ groups.database | first }}"
when: repo_db_url == "" and groups.database | default([]) | length > 0

- name: Check repo connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.repository[0]].ansible_host | default('localhost') }}"
checked_host: "{{ repo_host }}"
checked_port: "{{ ports_cfg.repository.http }}"
delegate_target: "{{ groups.repository | first }}"
when: groups.repository | default([]) | length > 0

- name: Check activemq connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.activemq[0]].ansible_host | default('localhost') }}"
checked_host: "{{ activemq_host }}"
checked_port: "{{ ports_cfg.activemq[activemq_protocol] }}"
delegate_target: "{{ groups.activemq | first }}"
when: groups.activemq | default([]) | length > 0
Expand All @@ -136,7 +135,7 @@
- name: Check repo connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.repository[0]].ansible_host | default('localhost') }}"
checked_host: "{{ repo_host }}"
checked_port: "{{ ports_cfg.repository.http }}"
delegate_target: "{{ groups.repository | first }}"
when: groups.repository | default([]) | length > 0
Expand All @@ -151,7 +150,7 @@
- name: Check repo connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.repository[0]].ansible_host | default('localhost') }}"
checked_host: "{{ repo_host }}"
checked_port: "{{ ports_cfg.repository.http }}"
delegate_target: "{{ groups.repository | first }}"
when: groups.repository | default([]) | length > 0
Expand All @@ -166,15 +165,15 @@
- name: Check repo connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.repository[0]].ansible_host | default('localhost') }}"
checked_host: "{{ repo_host }}"
checked_port: "{{ ports_cfg.repository.http }}"
delegate_target: "{{ groups.repository | first }}"
when: groups.repository | default([]) | length > 0

- name: Check sync connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.syncservice[0]].ansible_host | default('localhost') }}"
checked_host: "{{ sync_host }}"
checked_port: "{{ ports_cfg.sync.http }}"
delegate_target: "{{ groups.syncservice | first }}"
when:
Expand All @@ -183,7 +182,7 @@
- name: Check acc connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.acc[0]].ansible_host | default('localhost') }}"
checked_host: "{{ acc_host }}"
checked_port: "{{ ports_cfg.acc.http }}"
delegate_target: "{{ groups.acc | first }}"
when:
Expand All @@ -192,7 +191,7 @@
- name: Check adw connection
ansible.builtin.include_tasks: "tasks/check_port.yml"
vars:
checked_host: "{{ hostvars[groups.adw[0]].ansible_host | default('localhost') }}"
checked_host: "{{ adw_host }}"
checked_port: "{{ ports_cfg.adw.http }}"
delegate_target: "{{ groups.adw | first }}"
when:
Expand Down

0 comments on commit b4cdd12

Please sign in to comment.