DT
- name: check first port
shell: if [[ $(netstat -tul | grep {{ first_port }}) ]]; then echo ''; else echo '{{ first_port }}'; fi
register: open_port
- name: check second port
shell: "if [[ $(netstat -tul | grep {{ second_port }}) ]]; then echo ''; else echo '{{ second_port }}'; fi"
when: open_port.stdout == ""
- block:
- name: no free ports found
debug:
msg: "no free ports found to deploy"
- meta: end_play
when: open_port.stdout == ""

