mirror of
https://github.com/willshersystems/ansible-sshd
synced 2024-12-01 07:00:17 +01:00
36 lines
1.1 KiB
YAML
36 lines
1.1 KiB
YAML
---
|
|
- name: Ensure apt sources are up to date on debian systems
|
|
ansible.builtin.apt:
|
|
update_cache: true
|
|
when:
|
|
- ansible_facts['distribution'] == 'Debian'
|
|
|
|
- name: Make sure openssh is installed before creating backup
|
|
ansible.builtin.package:
|
|
name: openssh-server
|
|
state: present
|
|
|
|
- name: Make sure openssh has runtime directory on debian
|
|
ansible.builtin.file:
|
|
path: /run/sshd
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
when:
|
|
- ansible_facts['os_family'] == 'Debian'
|
|
|
|
- name: Define common variables
|
|
ansible.builtin.set_fact:
|
|
main_sshd_config: /etc/ssh/sshd_config
|
|
main_sshd_config_name: sshd_config
|
|
main_sshd_config_path: /etc/ssh/
|
|
|
|
- name: Define specific variables
|
|
ansible.builtin.set_fact:
|
|
main_sshd_config: /etc/ssh/sshd_config.d/00-ansible_system_role.conf
|
|
main_sshd_config_name: 00-ansible_system_role.conf
|
|
main_sshd_config_path: /etc/ssh/sshd_config.d/
|
|
when:
|
|
- (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version']|int > 8) or
|
|
(ansible_facts['distribution'] == 'Ubuntu' and ansible_facts['distribution_major_version']|int >= 22)
|