2022-12-29 21:13:31 +00:00
|
|
|
# vim: ft=yaml.ansible
|
2024-03-01 20:30:18 +00:00
|
|
|
# code: language=ansible
|
2022-11-25 13:07:09 +00:00
|
|
|
---
|
|
|
|
- name: Change SSH port on host
|
|
|
|
lineinfile:
|
|
|
|
dest: "/etc/ssh/sshd_config"
|
|
|
|
regexp: "^#?Port "
|
|
|
|
line: "Port 19022"
|
|
|
|
register: ssh_changed
|
|
|
|
|
|
|
|
- name: Restart sshd
|
|
|
|
service:
|
|
|
|
name: sshd
|
|
|
|
state: restarted
|
|
|
|
when: ssh_changed is defined and
|
|
|
|
ssh_changed.changed
|
|
|
|
|
|
|
|
- name: Change Ansible port to 19022
|
|
|
|
set_fact:
|
|
|
|
ansible_port: 19022
|
|
|
|
when: ssh_changed is defined and
|
|
|
|
ssh_changed.changed
|