ansible-infra/roles/common/tasks/openssh.yml

20 lines
508 B
YAML
Raw Normal View History

2020-04-13 14:46:45 +02:00
---
# Configure OpenSSH server
- name: Configure OpenSSH server
template:
src: openssh/sshd_config.j2
dest: /etc/ssh/sshd_config
backup: yes
owner: "0"
group: "0"
mode: "0644"
validate: '/usr/sbin/sshd -T -C user=root -C host=localhost -C addr=localhost -f %s'
2020-04-13 14:46:45 +02:00
notify: restart openssh
2020-11-28 20:47:30 +01:00
- name: Trigger OpenSSH handlers
2020-04-13 14:46:45 +02:00
meta: flush_handlers
- name: Change Ansible SSH port to {{ openssh_port }}
set_fact:
ansible_port: "{{ openssh_port }}"
2020-11-28 20:47:30 +01:00
when: openssh_port != "22"