Skip to content

Instantly share code, notes, and snippets.

@jlaska
Created January 25, 2016 17:46
Show Gist options
  • Save jlaska/56826e4c055a5d40bb11 to your computer and use it in GitHub Desktop.
Save jlaska/56826e4c055a5d40bb11 to your computer and use it in GitHub Desktop.
---
- hosts: all
gather_facts: false
vars:
secret_value: "Something secret"
tasks:
- name: task with stdout
command: 'echo {{ secret_value }}'
no_log: true
changed_when: false
register: result
- name: Assert that stdout was redacted
assert:
that:
- '"{{ secret_value }}" not in result.stdout'
- name: task with stderr
shell: 'cat <<< "{{ secret_value }}" 1>&2'
no_log: true
changed_when: false
register: result
- name: Assert that stderr was redacted
assert:
that:
- '"{{ secret_value }}" not in result.stderr'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment