Wed, 14 Jun 2017 22:13:48 -0400
oops, aptitude!
17 | 1 | --- |
2 | # Create/update my user, don't clobber my extra groups. | |
3 | - name: User setup | |
4 | user: | |
5 | name: "{{user.name}}" | |
6 | comment: "{{user.comment}}" | |
7 | shell: /bin/zsh | |
8 | groups: sudo | |
9 | append: true | |
10 | register: user | |
11 | tags: user | |
12 | ||
29 | 13 | - name: "ssh : Pubkey for user" |
17 | 14 | authorized_key: |
15 | manage_dir: true | |
16 | user: "{{user.name}}" | |
17 | key: "{{item}}" | |
18 | with_file: | |
19 | - public_keys/{{user.name}} | |
20 | tags: user, ssh | |
21 | ||
50
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
22 | - name: Clone dotfiles |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
23 | become: "{{user.name}}" |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
24 | shell: > |
54
2a04e6d7bfcc
rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
50
diff
changeset
|
25 | hg clone -U {{dotfiles_default | quote}} _dotfiles_ |
50
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
26 | && mv _dotfiles_/.hg . |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
27 | && rmdir _dotfiles_ |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
28 | && hg -R ~ update -C master |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
29 | args: |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
30 | chdir: "~" |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
31 | creates: "~/.hg" |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
32 | |
54
2a04e6d7bfcc
rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
50
diff
changeset
|
33 | - name: Assert hg sources |
2a04e6d7bfcc
rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
50
diff
changeset
|
34 | become: "{{user.name}}" |
2a04e6d7bfcc
rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
50
diff
changeset
|
35 | ini_file: |
2a04e6d7bfcc
rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
50
diff
changeset
|
36 | dest: "~/.hg/hgrc" |
2a04e6d7bfcc
rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
50
diff
changeset
|
37 | section: paths |
2a04e6d7bfcc
rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
50
diff
changeset
|
38 | option: "{{item.name}}" |
2a04e6d7bfcc
rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
50
diff
changeset
|
39 | value: "{{item.url}}" |
2a04e6d7bfcc
rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
50
diff
changeset
|
40 | mode: 0640 |
2a04e6d7bfcc
rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
50
diff
changeset
|
41 | create: no |
2a04e6d7bfcc
rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
50
diff
changeset
|
42 | with_items: |
2a04e6d7bfcc
rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
50
diff
changeset
|
43 | - {name: 'default', url: "{{dotfiles_default}}"} |
2a04e6d7bfcc
rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
50
diff
changeset
|
44 | - {name: 'default-push', url: "{{dotfiles_default_push}}"} |
2a04e6d7bfcc
rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents:
50
diff
changeset
|
45 | |
50
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
46 | - name: Update dotfiles |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
47 | become: "{{user.name}}" |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
48 | command: hg pull -u |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
49 | args: |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
50 | chdir: "~" |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
51 | register: update_dotfiles |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
52 | changed_when: update_dotfiles.stdout | match("added|updated") |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
53 | failed_when: update_dotfiles.rc > 1 |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
54 | |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
55 | - name: Run bin/homedir-setup |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
56 | become: "{{user.name}}" |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
57 | shell: bin/homedir-setup |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
58 | args: |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
59 | chdir: "~" |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
60 | register: homedir_setup |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
61 | changed_when: homedir_setup.stdout | match("Updating|Cloning") |
8be666ca059e
Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents:
36
diff
changeset
|
62 | failed_when: homedir_setup.rc != 0 |