-1

I am new to Ansible, I am only using a central machine and a host node on Ubuntu server, for which I have to deploy a firewall; I was able to make the SSH connections and the execution of the playbook. What I need to know is how to verify that the port I described in the playbook was blocked or opened, either on the controller machine and on the host node. Thanks

  • 1
    I and welcome to SO. Please [take the tour](/tour) and read the help section starting with [How to ask](/help/how-to-ask). Note that even with an edit to make your question meet the expected standard, it might still be [off topic](/help/on-topic) and might be better suited for https://superuser.com or https://serverfault.com – Zeitounator Dec 22 '21 at 09:21

1 Answers1

0

According your question

How to verify that the port I described in the playbook was blocked or opened, either on the controller machine and on the host node?

you may are looking for an approach like

- name: "Test connection to NFS_SERVER: {{ NFS_SERVER }}"
  wait_for:
    host: "{{ NFS_SERVER }}"
    port: "{{ item }}"
    state: drained
    delay: 0
    timeout: 3
    active_connection_states: SYN_RECV
  with_items:
    - 111
    - 2049

and have also a look into How to use Ansible module wait_for together with loop?

Documentation

You may also interested in Manage firewall with UFW and have a look into

U880D
  • 8,601
  • 6
  • 24
  • 40