Created
April 24, 2015 05:20
-
-
Save polster/d0e00c02843e3ce7a840 to your computer and use it in GitHub Desktop.
How to set Ansible fact over condition
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: "Retrieve user's home path if not set" | |
sudo: yes | |
sudo_user: "{{ user }}" | |
shell: "echo $HOME" | |
register: _user_homedir | |
when: user_home == "" | |
- name: Set home path to be used for configuration | |
set_fact: | |
user_homedir: "{{ _user_homedir.stdout if user_home == '' else user_home }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment