18 with_file: |
18 with_file: |
19 - public_keys/{{user_name}} |
19 - public_keys/{{user_name}} |
20 tags: user, ssh |
20 tags: user, ssh |
21 |
21 |
22 - name: Clone dotfiles |
22 - name: Clone dotfiles |
23 become: "{{user_name}}" |
23 become: true |
|
24 become_user: "{{user_name}}" |
24 shell: > |
25 shell: > |
25 hg clone -U {{dotfiles_default | quote}} _dotfiles_ |
26 hg clone -U {{dotfiles_default | quote}} _dotfiles_ |
26 && mv _dotfiles_/.hg . |
27 && mv _dotfiles_/.hg . |
27 && rmdir _dotfiles_ |
28 && rmdir _dotfiles_ |
28 && hg -R ~ update -C master |
29 && hg -R ~ update -C master |
29 args: |
30 args: |
30 chdir: "~" |
31 chdir: "{{user.home}}" |
31 creates: "~/.hg" |
32 creates: "{{user.home}}/.hg" |
32 tags: user, dotfiles |
33 tags: user, dotfiles |
33 |
34 |
34 - name: Assert hg sources |
35 - name: Assert hg sources |
35 become: "{{user_name}}" |
36 become: true |
|
37 become_user: "{{user_name}}" |
36 ini_file: |
38 ini_file: |
37 dest: "~/.hg/hgrc" |
39 dest: "{{user.home}}/.hg/hgrc" |
38 section: paths |
40 section: paths |
39 option: "{{item.name}}" |
41 option: "{{item.name}}" |
40 value: "{{item.url}}" |
42 value: "{{item.url}}" |
41 mode: 0640 |
43 mode: 0640 |
42 create: no |
44 create: no |
44 - {name: 'default', url: "{{dotfiles_default}}"} |
46 - {name: 'default', url: "{{dotfiles_default}}"} |
45 - {name: 'default-push', url: "{{dotfiles_default_push}}"} |
47 - {name: 'default-push', url: "{{dotfiles_default_push}}"} |
46 tags: user, dotfiles |
48 tags: user, dotfiles |
47 |
49 |
48 - name: Update dotfiles |
50 - name: Update dotfiles |
49 become: "{{user_name}}" |
51 become: true |
|
52 become_user: "{{user_name}}" |
50 command: hg pull -u |
53 command: hg pull -u |
51 args: |
54 args: |
52 chdir: "~" |
55 chdir: "{{user.home}}" |
53 register: update_dotfiles |
56 register: update_dotfiles |
54 changed_when: update_dotfiles.stdout | match("added|updated") |
57 changed_when: update_dotfiles.stdout | match("added|updated") |
55 failed_when: update_dotfiles.rc > 1 |
58 failed_when: update_dotfiles.rc > 1 |
56 tags: user, dotfiles |
59 tags: user, dotfiles |
57 |
60 |
58 - name: Run bin/homedir-setup |
61 - name: Run bin/homedir-setup |
59 become: "{{user_name}}" |
62 become: true |
|
63 become_user: "{{user_name}}" |
60 shell: bin/homedir-setup |
64 shell: bin/homedir-setup |
61 args: |
65 args: |
62 chdir: "~" |
66 chdir: "{{user.home}}" |
63 register: homedir_setup |
67 register: homedir_setup |
64 changed_when: homedir_setup.stdout | match("Updating|Cloning") |
68 changed_when: homedir_setup.stdout | match("Updating|Cloning") |
65 failed_when: homedir_setup.rc != 0 |
69 failed_when: homedir_setup.rc != 0 |
66 tags: user, dotfiles |
70 tags: user, dotfiles |