This repository has been archived on 2023-02-05. You can view files and clone it, but cannot push or open issues or pull requests.
loki/ansible/ssh.yml

28 lines
499 B
YAML

---
- hosts: server
gather_facts: no
vars_files:
- secrets.yml
pre_tasks:
- name: Use default SSH port
set_fact:
ansible_port: "{{ default_ssh_port }}"
tasks:
- name: Copy sshd config
template:
src: ./etc/ssh/sshd_config.j2
dest: /etc/ssh/sshd_config
mode: 0644
register: sshd_cfg
- name: Restart SSH daemon
service:
name: sshd
state: restarted
enabled: yes
when: sshd_cfg is changed