Skip to content

Instantly share code, notes, and snippets.

@tadeboro
Created March 25, 2020 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tadeboro/bf7775ce99e92033424e20e351b6b537 to your computer and use it in GitHub Desktop.
Save tadeboro/bf7775ce99e92033424e20e351b6b537 to your computer and use it in GitHub Desktop.
Making sure all lines match certain regex
---
- name: Test
hosts: localhost
gather_facts: false
tasks:
- name: Dummy data
shell: echo -e "1 a\n1 b\n1 c\n"
register: result
- name: Display
debug:
msg: "{{ result.stdout_lines | map('regex_replace', '^1 .*', 'OK') | reject('eq', 'OK') | list | length == 0 }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment