infrastructure/ansible/roles/ssh/tasks/main.yml

33 lines
617 B
YAML
Raw Normal View History

- name: Install OpenSSH for Debian
2020-04-26 11:25:01 +01:00
package:
2019-12-08 16:03:13 +00:00
name: openssh-server
become: true
when: ansible_os_family == 'Debian'
- name: Install OpenSSH for Arch
package:
name: openssh
become: true
when: ansible_os_family == 'ArchLinux'
2019-12-08 16:03:13 +00:00
2019-12-08 15:55:19 +00:00
- name: Define context
set_fact:
user: jake
2020-01-26 18:10:07 +00:00
enable_root: false
2019-12-08 15:55:19 +00:00
- name: SSH config
template:
src: files/sshd_config
2019-12-08 15:55:19 +00:00
dest: /etc/ssh/sshd_config
validate: /usr/sbin/sshd -t -f %s
backup: yes
become: true
register: sshd_config
- name: Restart SSH config
service:
name: sshd
state: reloaded
when: sshd_config.changed
become: true