# HG changeset patch # User Meredith Howard # Date 1497489828 14400 # Node ID 8be666ca059e309b4a9c5d87e66106b7f4422e9b # Parent 6dbfcfdf807cfb48384ea5aaaed3a6e774b56ca6 Move dotfiles setup back into user role Dotfiles are on a public repo now, no need to play games with ssh agents diff --git a/dotfiles.yml b/dotfiles.yml deleted file mode 100644 --- a/dotfiles.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -# This is a playbook to run as myself, with agent forwarding, to pull down my -# private dotfiles and set up. - -- hosts: devbox - gather_facts: false - tasks: - - name: Clone dotfiles - shell: > - hg clone -U {{dotfiles_repository | quote}} _dotfiles_ - && mv _dotfiles_/.hg . - && rmdir _dotfiles_ - && hg -R ~ update -C - args: - chdir: "~" - creates: "~/.hg" - - - name: Update dotfiles - command: hg pull -u - args: - chdir: "~" - register: update_dotfiles - changed_when: update_dotfiles.stdout | match("added|updated") - failed_when: update_dotfiles.rc > 1 - - - name: Run bin/homedir-setup - shell: bin/homedir-setup - args: - chdir: "~" - register: homedir_setup - changed_when: homedir_setup.stdout | match("Updating|Cloning") - failed_when: homedir_setup.rc != 0 diff --git a/roles/user/tasks/main.yml b/roles/user/tasks/main.yml --- a/roles/user/tasks/main.yml +++ b/roles/user/tasks/main.yml @@ -19,3 +19,31 @@ - public_keys/{{user.name}} tags: user, ssh +- name: Clone dotfiles + become: "{{user.name}}" + shell: > + hg clone -U {{dotfiles_repository | quote}} _dotfiles_ + && mv _dotfiles_/.hg . + && rmdir _dotfiles_ + && hg -R ~ update -C master + args: + chdir: "~" + creates: "~/.hg" + +- name: Update dotfiles + become: "{{user.name}}" + command: hg pull -u + args: + chdir: "~" + register: update_dotfiles + changed_when: update_dotfiles.stdout | match("added|updated") + failed_when: update_dotfiles.rc > 1 + +- name: Run bin/homedir-setup + become: "{{user.name}}" + shell: bin/homedir-setup + args: + chdir: "~" + register: homedir_setup + changed_when: homedir_setup.stdout | match("Updating|Cloning") + failed_when: homedir_setup.rc != 0