Created
March 25, 2020 09:46
-
-
Save tadeboro/bf7775ce99e92033424e20e351b6b537 to your computer and use it in GitHub Desktop.
Making sure all lines match certain regex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- 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