ansible-sshd/tests/tasks/setup.yml

36 lines
1.1 KiB
YAML
Raw Normal View History

---
2022-08-17 19:29:16 +02:00
- name: Register we are running tests
ansible.builtin.set_fact:
__sshd_testing: true
- name: Make sure openssh is installed before creating backup
2022-06-03 12:22:17 +02:00
ansible.builtin.package:
name: openssh-server
state: present
- name: Make sure openssh has runtime directory on debian
2022-06-03 12:22:17 +02:00
ansible.builtin.file:
path: /run/sshd
state: directory
owner: root
group: root
mode: "0755"
when:
- ansible_facts['os_family'] == 'Debian'
- name: Define common variables
2022-06-03 12:22:17 +02:00
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
2022-06-03 12:22:17 +02:00
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)