1 --- |
1 --- |
|
2 # This is a playbook to run as myself, with agent forwarding, to pull down my |
|
3 # private dotfiles and set up. |
|
4 |
2 - hosts: devbox |
5 - hosts: devbox |
3 gather_facts: false |
6 gather_facts: false |
4 tasks: |
7 tasks: |
5 - name: Clone dotfiles |
8 - name: Clone dotfiles |
6 become_user: "{{user.name}}" |
|
7 shell: > |
9 shell: > |
8 hg clone -U {{dotfiles_repository | quote}} _dotfiles_ |
10 hg clone -U {{dotfiles_repository | quote}} _dotfiles_ |
9 && mv _dotfiles_/.hg . |
11 && mv _dotfiles_/.hg . |
10 && rmdir _dotfiles_ |
12 && rmdir _dotfiles_ |
11 && hg -R ~ update -C |
13 && hg -R ~ update -C |
12 args: |
14 args: |
13 chdir: "~" |
15 chdir: "~" |
14 creates: "~/.hg" |
16 creates: "~/.hg" |
15 |
17 |
16 - name: Update dotfiles |
18 - name: Update dotfiles |
17 become_user: "{{user.name}}" |
|
18 command: hg pull -u |
19 command: hg pull -u |
19 args: |
20 args: |
20 chdir: "~" |
21 chdir: "~" |
21 register: update_dotfiles |
22 register: update_dotfiles |
22 changed_when: update_dotfiles.stdout | match("added|updated") |
23 changed_when: update_dotfiles.stdout | match("added|updated") |
23 failed_when: update_dotfiles.rc > 1 |
24 failed_when: update_dotfiles.rc > 1 |
24 |
25 |
25 - name: Run homedir-setup |
26 - name: Run bin/homedir-setup |
26 become_user: "{{user.name}}" |
27 - shell: bin/homedir-setup |
27 shell: bin/homedir-setup |
|
28 args: |
28 args: |
29 chdir: "~" |
29 chdir: "~" |
30 register: homedir_setup |
30 register: homedir_setup |
31 changed_when: homedir_setup.stdout | match("Updating|Cloning") |
31 changed_when: homedir_setup.stdout | match("Updating|Cloning") |
32 failed_when: homedir_setup.rc != 0 |
32 failed_when: homedir_setup.rc != 0 |