Skip to content

Commit

Permalink
Added conditionals to prevent running some tasks when port is not cha…
Browse files Browse the repository at this point in the history
…nged
  • Loading branch information
elcomtik committed Nov 8, 2020
1 parent c8128c2 commit d8564f2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@

- name: Populate service facts to check later if some firewall is running
service_facts:
when: ansible_port_temp is defined

- name: Enable new SSH port on firewalld
firewalld:
Expand Down Expand Up @@ -206,5 +207,5 @@
state: "absent"
validate: "sshd -f %s -t"
become: True
when: remove_default_ssh_port
when: (remove_default_ssh_port) and (ansible_port|int != 22)
notify: "restart sshd service"

0 comments on commit d8564f2

Please sign in to comment.