roles/user/tasks/main.yml

changeset 76
9c024e39a565
parent 73
8b0c09efbb5b
child 89
86248a83a3dd
equal deleted inserted replaced
75:082685c4bd2a 76:9c024e39a565
1 --- 1 ---
2 # Create/update my user, don't clobber my extra groups. 2 # Create/update my user, don't clobber my extra groups.
3 - name: User setup 3 - name: "User setup"
4 user: 4 user:
5 name: "{{user_name}}" 5 name: "{{user_name}}"
6 comment: "{{user_comment}}" 6 comment: "{{user_comment}}"
7 shell: /bin/zsh 7 shell: /bin/zsh
8 groups: sudo 8 groups: sudo
9 append: true 9 append: true
10 register: user 10 register: user
11 tags: user 11 tags: user
12 12
13 - name: "ssh : Pubkey for user" 13 - name: "User authorized_keys"
14 authorized_key: 14 authorized_key:
15 manage_dir: true 15 manage_dir: true
16 user: "{{user_name}}" 16 user: "{{user_name}}"
17 key: "{{item}}" 17 key: "{{item}}"
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: true 23 become: true
24 become_user: "{{user_name}}" 24 become_user: "{{user_name}}"
25 shell: > 25 shell: >
26 hg clone -U {{dotfiles_default | quote}} _dotfiles_ 26 hg clone -U {{dotfiles_default | quote}} _dotfiles_
27 && mv _dotfiles_/.hg . 27 && mv _dotfiles_/.hg .
30 args: 30 args:
31 chdir: "{{user.home}}" 31 chdir: "{{user.home}}"
32 creates: "{{user.home}}/.hg" 32 creates: "{{user.home}}/.hg"
33 tags: user, dotfiles 33 tags: user, dotfiles
34 34
35 - name: Assert hg sources 35 - name: "Dotfiles hg sources"
36 become: true 36 become: true
37 become_user: "{{user_name}}" 37 become_user: "{{user_name}}"
38 ini_file: 38 ini_file:
39 dest: "{{user.home}}/.hg/hgrc" 39 dest: "{{user.home}}/.hg/hgrc"
40 section: paths 40 section: paths
45 with_items: 45 with_items:
46 - {name: 'default', url: "{{dotfiles_default}}"} 46 - {name: 'default', url: "{{dotfiles_default}}"}
47 - {name: 'default-push', url: "{{dotfiles_default_push}}"} 47 - {name: 'default-push', url: "{{dotfiles_default_push}}"}
48 tags: user, dotfiles 48 tags: user, dotfiles
49 49
50 - name: Update dotfiles 50 - name: "Update dotfiles"
51 become: true 51 become: true
52 become_user: "{{user_name}}" 52 become_user: "{{user_name}}"
53 command: hg pull -u 53 command: hg pull -u
54 args: 54 args:
55 chdir: "{{user.home}}" 55 chdir: "{{user.home}}"
56 register: update_dotfiles 56 register: update_dotfiles
57 changed_when: update_dotfiles.stdout | match("added|updated") 57 changed_when: update_dotfiles.stdout | match("added|updated")
58 failed_when: update_dotfiles.rc > 1 58 failed_when: update_dotfiles.rc > 1
59 tags: user, dotfiles 59 tags: user, dotfiles
60 60
61 - name: Run bin/homedir-setup 61 - name: "Run bin/homedir-setup"
62 become: true 62 become: true
63 become_user: "{{user_name}}" 63 become_user: "{{user_name}}"
64 shell: bin/homedir-setup 64 shell: bin/homedir-setup
65 args: 65 args:
66 chdir: "{{user.home}}" 66 chdir: "{{user.home}}"

mercurial