ansible-collection-hardening/molecule/ssh_hardening/verify.yml

29 lines
965 B
YAML
Raw Normal View History

2020-11-07 20:19:43 +00:00
---
- name: Verify
hosts: localhost
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) }}"
2020-11-07 20:19:43 +00:00
tasks:
- name: Execute cinc-auditor tests
ansible.builtin.command: >
docker run
--volume /run/docker.sock:/run/docker.sock
docker.io/cincproject/auditor exec
-t docker://instance
--no-show-progress --no-color
--no-distinct-exit https://github.com/dev-sec/ssh-baseline/archive/refs/heads/master.zip
2020-11-07 20:19:43 +00:00
register: test_results
changed_when: false
ignore_errors: true
- name: Display details about the cinc-auditor results
ansible.builtin.debug:
2020-11-07 20:19:43 +00:00
msg: "{{ test_results.stdout_lines }}"
- name: Fail when tests fail
ansible.builtin.fail:
msg: Inspec failed to validate
2020-11-07 20:19:43 +00:00
when: test_results.rc != 0