1 parent
6ce8b68650
commit
e00716df62
35 files changed
+161
-167
No files matched your search
@@ -1,14 +1,12 @@
|
||||
---
|
||||
- name: wrapper playbook for kitchen testing "ansible-ssh-hardening" with default settings
|
||||
- name: Wrapper playbook for kitchen testing "ansible-ssh-hardening" with default settings
|
||||
hosts: all
|
||||
environment:
|
||||
http_proxy: "{{ lookup('env', 'http_proxy') | default(omit) }}"
|
||||
https_proxy: "{{ lookup('env', 'https_proxy') | default(omit) }}"
|
||||
no_proxy: "{{ lookup('env', 'no_proxy') | default(omit) }}"
|
||||
collections:
|
||||
- devsec.hardening
|
||||
tasks:
|
||||
- include_role:
|
||||
name: ssh_hardening
|
||||
name: devsec.hardening.ssh_hardening
|
||||
vars:
|
||||
sftp_enabled: false
|
||||
@@ -8,12 +8,12 @@
|
||||
no_proxy: "{{ lookup('env', 'no_proxy') | default(omit) }}"
|
||||
tasks:
|
||||
- name: use python3
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
ansible_python_interpreter: /usr/bin/python3
|
||||
when: ansible_facts.distribution == 'Fedora'
|
||||
|
||||
- name: install packages # noqa ignore-errors
|
||||
yum:
|
||||
ansible.builtin.yum:
|
||||
name:
|
||||
- openssh-clients
|
||||
- openssh-server
|
||||
@@ -23,7 +23,7 @@
|
||||
ignore_errors: true
|
||||
|
||||
- name: install packages # noqa ignore-errors
|
||||
dnf:
|
||||
ansible.builtin.dnf:
|
||||
name:
|
||||
- openssh-clients
|
||||
- openssh-server
|
||||
@@ -33,7 +33,7 @@
|
||||
ignore_errors: true
|
||||
|
||||
- name: install packages # noqa ignore-errors
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- openssh-client
|
||||
- openssh-server
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
- name: install required tools on SuSE
|
||||
# cannot use zypper module, since it depends on python-xml
|
||||
shell: "zypper -n install python-xml"
|
||||
ansible.builtin.shell: "zypper -n install python-xml"
|
||||
when: ansible_facts.os_family == 'Suse'
|
||||
|
||||
- name: install packages
|
||||
@@ -67,7 +67,7 @@
|
||||
state: directory
|
||||
|
||||
- name: create ssh host keys # noqa ignore-errors
|
||||
command: "ssh-keygen -A"
|
||||
ansible.builtin.command: "ssh-keygen -A"
|
||||
when: not ((ansible_facts.os_family in ['Oracle Linux', 'RedHat']) and ansible_facts.distribution_major_version < '7') or
|
||||
ansible_facts.distribution == "Fedora" or
|
||||
ansible_facts.distribution == "Amazon" or
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
no_proxy: "{{ lookup('env', 'no_proxy') | default(omit) }}"
|
||||
tasks:
|
||||
- name: Execute cinc-auditor tests
|
||||
command: >
|
||||
ansible.builtin.command: >
|
||||
docker run
|
||||
--volume /run/docker.sock:/run/docker.sock
|
||||
docker.io/cincproject/auditor exec
|
||||
@@ -19,10 +19,10 @@
|
||||
ignore_errors: true
|
||||
|
||||
- name: Display details about the cinc-auditor results
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ test_results.stdout_lines }}"
|
||||
|
||||
- name: Fail when tests fail
|
||||
fail:
|
||||
ansible.builtin.fail:
|
||||
msg: "Inspec failed to validate"
|
||||
when: test_results.rc != 0
|
||||
Reference in new issue
Block a user