public-health-ch/ansible/roles/dev-sec.ssh-hardening/tests/default.yml

55 lines
1.3 KiB
YAML
Raw Normal View History

2018-12-17 12:50:15 +00:00
---
- name: wrapper playbook for kitchen testing "ansible-ssh-hardening" with default settings
hosts: localhost
pre_tasks:
2020-05-15 20:41:39 +00:00
- name: use python3
set_fact:
ansible_python_interpreter: /usr/bin/python3
when: ansible_facts.distribution == 'Fedora'
2021-02-18 15:40:18 +00:00
- yum:
name:
2020-05-15 20:41:39 +00:00
- openssh-clients
- openssh-server
- libselinux-python
2021-02-18 15:40:18 +00:00
state: present
update_cache: true
2018-12-17 12:50:15 +00:00
ignore_errors: true
2021-02-18 15:40:18 +00:00
- dnf:
name:
- openssh-clients
- openssh-server
- procps-ng
state: present
update_cache: true
ignore_errors: true
- apt:
name:
- openssh-client
- openssh-server
state: present
update_cache: true
2018-12-17 12:50:15 +00:00
ignore_errors: true
2021-02-18 15:40:18 +00:00
- file:
path: "/var/run/sshd"
state: directory
- pacman:
name:
- "openssh"
- "awk"
state: present
update_cache: true
ignore_errors: true
2018-12-17 12:50:15 +00:00
- name: create ssh host keys
command: "ssh-keygen -A"
2021-02-18 15:40:18 +00:00
when: not ((ansible_facts.os_family in ['Oracle Linux', 'RedHat']) and ansible_facts.distribution_major_version < '7') or
2020-05-15 20:41:39 +00:00
ansible_facts.distribution == "Fedora" or
ansible_facts.distribution == "Amazon"
2018-12-17 12:50:15 +00:00
roles:
- ansible-ssh-hardening