From f76d22f4fe2189901191440f08c9e8ea118736e8 Mon Sep 17 00:00:00 2001 From: Gilles Cornu Date: Tue, 14 Jun 2016 00:33:01 +0200 Subject: [PATCH] + ansible 2+: change how to set the default user 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`. --- ansible/playbook.yml | 8 ++++++-- dispansible | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ansible/playbook.yml b/ansible/playbook.yml index a7ee2bb..04ea2ec 100644 --- a/ansible/playbook.yml +++ b/ansible/playbook.yml @@ -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! diff --git a/dispansible b/dispansible index d299d86..c2b7c4b 100755 --- a/dispansible +++ b/dispansible @@ -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