Last active
December 29, 2015 06:19
-
-
Save stevenhaddox/7628144 to your computer and use it in GitHub Desktop.
Manually force ansible to prepend sourcing a user's bash environment before executing commands
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
# {{root_path}}/group_vars/all.yml | |
--- | |
src_bash: "source {{HOME.stdout}}/.bashrc;" |
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
# {{root_path}}/roles/common/tasks/main.yml | |
--- | |
- name: Set sysadmin user's $HOME variable | |
shell: chdir=~ pwd | |
register: HOME | |
ignore_errors: yes | |
changed_when: "HOME.rc != 0" | |
# include your other tasks / list them manually, I prefer to include as I'll do a lot here... | |
#################### | |
# Install GNU Stow # | |
#################### | |
- include: stow.yml |
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
# {{root_path}}/roles/common/tasks/stow.yml | |
# Stow installation tasks | |
# Only took out a simple task for clarity | |
- shell: "{{src_bash}} stow --version" | |
register: stow_version | |
changed_when: "stow_version.rc != 0" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment