diff --git a/.ansible-lint b/.ansible-lint index 85a3f6f54..4d399f095 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -6,4 +6,3 @@ skip_list: - name[template] # Allow Jinja templating inside task and play names exclude_paths: - molecule/ - - roles/helper_module/ diff --git a/molecule/identity/converge.yml b/molecule/identity/converge.yml index fff65925c..6b17ff5eb 100644 --- a/molecule/identity/converge.yml +++ b/molecule/identity/converge.yml @@ -1,5 +1,13 @@ --- -- name: Run the playbook - ansible.builtin.import_playbook: ../../playbooks/acs.yml - vars: - autogen_unsecure_secrets: true +- name: Check if current OS version is in the supported matrix + hosts: all + gather_facts: false + tasks: + - name: Listen to port + ansible.builtin.command: "nc -l 8000" + async: 10 + poll: 0 + - name: Wait for port + ansible.builtin.wait_for: + port: 8000 + state: started diff --git a/roles/helper_modules/tasks/check_port.yml b/playbooks/check_port.yml similarity index 100% rename from roles/helper_modules/tasks/check_port.yml rename to playbooks/check_port.yml diff --git a/roles/helper_modules/library/listen_port.py b/playbooks/library/listen_port.py similarity index 100% rename from roles/helper_modules/library/listen_port.py rename to playbooks/library/listen_port.py diff --git a/playbooks/prerun-network-checks.yml b/playbooks/prerun-network-checks.yml index 45ea85523..8d625e493 100644 --- a/playbooks/prerun-network-checks.yml +++ b/playbooks/prerun-network-checks.yml @@ -2,11 +2,9 @@ - name: Run preliminary network checks for repository hosts hosts: repository become: true - roles: - - role: '../roles/helper_modules' tasks: - name: Check db connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.database | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.database[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.postgres.sql }}" @@ -14,7 +12,7 @@ when: repo_db_url == "" - name: Check activemq connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.activemq | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.activemq[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.activemq[activemq_protocol] }}" @@ -22,7 +20,7 @@ when: groups.activemq | default([]) | length > 0 - name: Check search connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.search | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.search[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.search.http }}" @@ -30,7 +28,7 @@ when: groups.search | default([]) | length > 0 - name: Check sync connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.syncservice | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.syncservice[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.sync.http }}" @@ -40,7 +38,7 @@ - acs.edition == "Enterprise" - name: Check sfs connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.transformers | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.transformers[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.sfs.http }}" @@ -48,7 +46,7 @@ when: acs.edition == "Enterprise" - name: Check trouter connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.transformers | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.transformers[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.transformers.trouter }}" @@ -56,7 +54,7 @@ when: acs.edition == "Enterprise" - name: Check tengine connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.transformers | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.transformers[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.transformers.tengine }}" @@ -65,11 +63,9 @@ - name: Run preliminary network checks for search hosts hosts: search become: true - roles: - - role: '../roles/helper_modules' tasks: - name: Check repo connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.repository | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.repository[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.repository.http }}" @@ -78,11 +74,9 @@ - name: Run preliminary network checks for transformers hosts hosts: transformers become: true - roles: - - role: '../roles/helper_modules' tasks: - name: Check activemq connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.activemq | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.activemq[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.activemq[activemq_protocol] }}" @@ -92,11 +86,9 @@ - name: Run preliminary network checks for syncservice hosts hosts: syncservice become: true - roles: - - role: '../roles/helper_modules' tasks: - name: Check db connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.database | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.database[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.postgres.sql }}" @@ -104,14 +96,14 @@ when: repo_db_url == "" - name: Check repo connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.repository | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.repository[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.repository.http }}" delegate_target: "{{ groups.repository | first }}" - name: Check activemq connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.activemq | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.activemq[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.activemq[activemq_protocol] }}" @@ -121,11 +113,9 @@ - name: Run preliminary network checks for acc hosts hosts: acc become: true - roles: - - role: '../roles/helper_modules' tasks: - name: Check repo connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.repository | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.repository[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.repository.http }}" @@ -134,11 +124,9 @@ - name: Run preliminary network checks for adw hosts hosts: adw become: true - roles: - - role: '../roles/helper_modules' tasks: - name: Check repo connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.repository | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.repository[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.repository.http }}" @@ -147,18 +135,16 @@ - name: Run preliminary network checks for nginx hosts hosts: nginx become: true - roles: - - role: '../roles/helper_modules' tasks: - name: Check repo connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.repository | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.repository[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.repository.http }}" delegate_target: "{{ groups.repository | first }}" - name: Check sync connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.syncservice | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.syncservice[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.sync.http }}" @@ -168,7 +154,7 @@ - acs.edition == "Enterprise" - name: Check acc connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.acc | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.acc[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.acc.http }}" @@ -178,7 +164,7 @@ - acs.edition == "Enterprise" - name: Check adw connection - ansible.builtin.include_tasks: "../roles/helper_modules/tasks/check_port.yml" + ansible.builtin.include_tasks: "check_port.yml" vars: checked_host: "{% if groups.adw | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.adw[0]].ansible_host | default('127.0.0.1') }}{% endif %}" checked_port: "{{ ports_cfg.adw.http }}"