--- - hosts: localhost vars: - artifacts: "{{ lookup('env', 'TEST_ARTIFACTS')|default('./artifacts', true) }}" tags: - classic tasks: - name: reboot block: - name: restart managed host shell: sleep 2 && shutdown -r now "Ansible updates triggered" async: 1 poll: 0 ignore_errors: true - name: wait for managed host to come back wait_for_connection: delay: 10 timeout: 300 - name: Test block shell: | ausearch -m avc -m selinux_err -m user_avc -ts boot > /tmp/avc.log 2> /tmp/avc.err.log || exit 1 grep -q '' /tmp/avc.err.log && result=pass || result=fail echo -e "results:\n- {result: $result, test: proc}" > /tmp/results.yml always: - name: Pull out the artifacts fetch: dest: "{{ artifacts }}/" src: "{{ item }}" flat: yes with_items: - /tmp/avc.log - /tmp/avc.err.log - /tmp/results.yml