infrastructure/ansible/roles/ssh/tasks/main.yml
Jake Howard 974e0e8467
Enable services
Not just during reload
2020-04-28 20:48:15 +01:00

38 lines
696 B
YAML

- name: Install OpenSSH for Debian
package:
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'
- name: Define context
set_fact:
user: jake
enable_root: false
- name: SSH config
template:
src: files/sshd_config
dest: /etc/ssh/sshd_config
validate: /usr/sbin/sshd -t -f %s
backup: yes
become: true
register: sshd_config
- name: Enable SSH
service:
name: sshd
enabled: true
become: true
- name: Restart SSH Daemon
service:
name: sshd
state: reloaded
when: sshd_config.changed
become: true