--- a/roles/user/tasks/main.yml +++ b/roles/user/tasks/main.yml @@ -20,21 +20,23 @@ tags: user, ssh - name: Clone dotfiles - become: "{{user_name}}" + become: true + become_user: "{{user_name}}" shell: > hg clone -U {{dotfiles_default | quote}} _dotfiles_ && mv _dotfiles_/.hg . && rmdir _dotfiles_ && hg -R ~ update -C master args: - chdir: "~" - creates: "~/.hg" + chdir: "{{user.home}}" + creates: "{{user.home}}/.hg" tags: user, dotfiles - name: Assert hg sources - become: "{{user_name}}" + become: true + become_user: "{{user_name}}" ini_file: - dest: "~/.hg/hgrc" + dest: "{{user.home}}/.hg/hgrc" section: paths option: "{{item.name}}" value: "{{item.url}}" @@ -46,20 +48,22 @@ tags: user, dotfiles - name: Update dotfiles - become: "{{user_name}}" + become: true + become_user: "{{user_name}}" command: hg pull -u args: - chdir: "~" + chdir: "{{user.home}}" register: update_dotfiles changed_when: update_dotfiles.stdout | match("added|updated") failed_when: update_dotfiles.rc > 1 tags: user, dotfiles - name: Run bin/homedir-setup - become: "{{user_name}}" + become: true + become_user: "{{user_name}}" shell: bin/homedir-setup args: - chdir: "~" + chdir: "{{user.home}}" register: homedir_setup changed_when: homedir_setup.stdout | match("Updating|Cloning") failed_when: homedir_setup.rc != 0