2022-11-25 13:07:09 +00:00
|
|
|
---
|
|
|
|
- name: Change SSH port on host
|
2022-11-26 08:52:41 +00:00
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
dest: /etc/ssh/sshd_config
|
|
|
|
regexp: '^#?Port '
|
|
|
|
line: Port 19022
|
2022-11-25 13:07:09 +00:00
|
|
|
register: ssh_changed
|
|
|
|
|
|
|
|
- name: Restart sshd
|
2022-11-26 08:52:41 +00:00
|
|
|
ansible.builtin.service:
|
2022-11-25 13:07:09 +00:00
|
|
|
name: sshd
|
|
|
|
state: restarted
|
2022-11-26 08:52:41 +00:00
|
|
|
when: ssh_changed is defined and ssh_changed.changed
|
2022-11-25 13:07:09 +00:00
|
|
|
|
|
|
|
- name: Change Ansible port to 19022
|
2022-11-26 08:52:41 +00:00
|
|
|
ansible.builtin.set_fact:
|
2022-11-25 13:07:09 +00:00
|
|
|
ansible_port: 19022
|
2022-11-26 08:52:41 +00:00
|
|
|
when: ssh_changed is defined and ssh_changed.changed
|