Created
October 31, 2017 11:15
-
-
Save halberom/f5d3551da0f61186b920f1bd38934662 to your computer and use it in GitHub Desktop.
ansible - example of splitting on \
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
PLAY [localhost] *************************************************************************************************************************************************************************************************************************************************************** | |
TASK [Split user name from account var] **************************************************************************************************************************************************************************************************************************************** | |
ok: [localhost] => { | |
"msg": "I want just the username - someone" | |
} | |
PLAY RECAP ********************************************************************************************************************************************************************************************************************************************************************* | |
localhost : ok=1 changed=0 unreachable=0 failed=0 |
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
--- | |
- hosts: localhost | |
gather_facts: false | |
vars: | |
account: 'somedomain\\someone' | |
tasks: | |
- name: Split user name from account var | |
debug: | |
msg: I want just the username - {{ account.split('\\')[1] }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment