Skip to content

Commit

Permalink
+ ansible 2+: change how to set the default user
Browse files Browse the repository at this point in the history
Add a workaround in `dispansible` script for the default `become` user
as Ansible 2.x no longer supports environment variable loading into
variable `ansible_env`.
  • Loading branch information
gildegoma committed Jun 13, 2016
1 parent 5d62faa commit f76d22f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ansible/playbook.yml
Expand Up @@ -3,8 +3,12 @@
- mac_box
- linux_box

sudo: yes
sudo_user: '{{ ansible_ssh_user }}'
gather_facts: yes

become: yes
# become_user: '{{ ansible_ssh_user }}'
# become_user: '{{ansible_env.USER}}'
# become_user: vagrant

pre_tasks:
# FIXME this check only works when no ansible tags are used!
Expand Down
1 change: 1 addition & 0 deletions dispansible
Expand Up @@ -44,6 +44,7 @@ ansible-playbook\
--extra-vars="@${DISPANSIBLE_SETTINGS_DIR}/private.yml"\
--extra-vars="@${DISPANSIBLE_SETTINGS_DIR}/${OS}-software.yml"\
--extra-vars="@${DISPANSIBLE_SETTINGS_DIR}/common-software.yml"\
--extra-vars=ansible_ssh_user=$USER \
--inventory-file=inventories/$OS\
--tags=$TAGS\
playbook.yml

0 comments on commit f76d22f

Please sign in to comment.