Created
June 1, 2017 08:05
-
-
Save gorvin/f3ba28d75726717ab2478d6dbf88840d to your computer and use it in GitHub Desktop.
Ensure absolute path in ansible playbook
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
- set_fact: | |
relpath: "one/two/three" | |
abspath: "/four/five/six" | |
- debug: var={{item}} | |
with_items: | |
- relpath | |
- abspath | |
- set_fact: | |
"{{item.name}}": "/{{item.value}}" | |
when: 'not(item.value | match("^/.*"))' | |
with_items: | |
- { name: relpath, value: "{{relpath}}" } | |
- { name: abspath, value: "{{abspath}}" } | |
- debug: var={{item}} | |
with_items: | |
- relpath | |
- abspath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment