read.ymlΒΆ

---
- name: "πŸ”Ž Swarm ingress guard | Read the published ports and the node addresses"
  ansible.builtin.shell: |
    set -euo pipefail
    if [ "$(container info --format '{{ '{{.Swarm.ControlAvailable}}' }}')" = "true" ]; then
      container service ls -q | xargs -r container service inspect --format 'port {{ '{{json .Endpoint.Ports}}' }}'
      container node ls -q | xargs -r container node inspect --format 'node {{ '{{.Status.Addr}}' }}'
    fi
  args:
    executable: /bin/bash
  register: swarm_ingress_read
  changed_when: false