- name: Check docker info ansible.builtin.shell: docker info register: docker_info - name: Display docker info ansible.builtin.debug: var: docker_info.stdout_lines #- name: Open TCP port 2376 # ansible.builtin.shell: sudo iptables -I INPUT -p tcp --dport 2376 -j ACCEPT # register: docker_port #- name: Display info for TCP port 2376 # ansible.builtin.debug: # var: docker_port.stdout_lines #- name: Open TCP port 7946 # ansible.builtin.shell: sudo iptables -I INPUT -p tcp --dport 7946 -j ACCEPT # register: tcp_node_port #- name: Display info for TCP port 7946 # ansible.builtin.debug: # var: tcp_node_port.stdout_lines #- name: Open UDP port 7946 # ansible.builtin.shell: sudo iptables -I INPUT -p udp --dport 7946 -j ACCEPT # register: udp_node_port #- name: Display info for UDP port 7946 # ansible.builtin.debug: # var: udp_node_port.stdout_lines #- name: Open UDP port 4789 # ansible.builtin.shell: sudo iptables -I INPUT -p udp --dport 4789 -j ACCEPT # register: data_port #- name: Display info for UDP port 4789 # ansible.builtin.debug: # var: data_port.stdout_lines #- name: Leave old swarm # ansible.builtin.shell: docker swarm leave # register: delete_node #- name: Add node to cluster # ansible.builtin.shell: docker swarm join --token SWMTKN-1-1ccvjacvym3mw3ikft5p847icyl75oicbd4xeck65s3is5a46r-4rngzt3pnidf57yyvyjq350u2 172.16.150.200:2377 # register: added_info #- name: Display info about added node # ansible.builtin.debug: # var: added_info.stdout_lines