2022-11-13 18:27:45 +00:00
|
|
|
---
|
2022-11-13 21:03:45 +00:00
|
|
|
- name: Change SSH port on host
|
2022-11-13 18:27:45 +00:00
|
|
|
lineinfile:
|
|
|
|
dest: "/etc/ssh/sshd_config"
|
2022-11-16 19:31:44 +00:00
|
|
|
regexp: "^#?Port "
|
2022-11-13 18:27:45 +00:00
|
|
|
line: "Port 19022"
|
|
|
|
register: ssh_changed
|
|
|
|
|
2022-11-17 21:11:32 +00:00
|
|
|
- name: Restart sshd
|
|
|
|
service:
|
|
|
|
name: sshd
|
|
|
|
state: restarted
|
|
|
|
when: ssh_changed is defined and
|
|
|
|
ssh_changed.changed
|
2022-11-13 18:27:45 +00:00
|
|
|
|
2022-11-13 20:42:52 +00:00
|
|
|
- name: Change Ansible port to 19022
|
2022-11-13 18:27:45 +00:00
|
|
|
set_fact:
|
|
|
|
ansible_port: 19022
|
2022-11-17 21:11:32 +00:00
|
|
|
when: ssh_changed is defined and
|
|
|
|
ssh_changed.changed
|