Last active
December 19, 2017 10:34
-
-
Save halberom/1755d24b7bbd5472f2487c2e4aa4ba41 to your computer and use it in GitHub Desktop.
ansible - using assert with regex and quotes
This file contains hidden or 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
| PLAY [localhost] ********************************************************************************************************************** | |
| TASK [assert] ************************************************************************************************************************* | |
| ok: [localhost] => (item=\') => { | |
| "changed": false, | |
| "item": "\\'", | |
| "msg": "All assertions passed" | |
| } | |
| ok: [localhost] => (item=\") => { | |
| "changed": false, | |
| "item": "\\\"", | |
| "msg": "All assertions passed" | |
| } | |
| PLAY RECAP **************************************************************************************************************************** | |
| localhost : ok=1 changed=0 unreachable=0 failed=0 |
This file contains hidden or 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
| --- | |
| - hosts: localhost | |
| connection: local | |
| gather_facts: False | |
| vars: | |
| some_var: hello | |
| tasks: | |
| - assert: | |
| that: | |
| - some_var | regex_replace('(.*)', item ~ '\\1' ~ item) == item ~ some_var ~ item | |
| with_items: | |
| - \' | |
| - \" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ansible syntax is awesome, like it