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
Raw Normal View History

2018-12-16 01:25:02 +01:00
---
- hosts: server
gather_facts: no
vars_files:
- secrets.yml
pre_tasks:
- name: Use default SSH port
set_fact:
2018-12-16 12:21:37 +01:00
ansible_port: "{{ default_ssh_port }}"
2018-12-16 01:25:02 +01:00
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