roles/user/tasks/main.yml

Thu, 15 Jun 2017 03:07:17 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Thu, 15 Jun 2017 03:07:17 -0400
changeset 64
48887c0dc48d
parent 63
f49b84e25dcc
child 69
292cb125556d
permissions
-rw-r--r--

tick this off the list

17
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 ---
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 # Create/update my user, don't clobber my extra groups.
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3 - name: User setup
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 user:
57
6172fc31a08f flatten
Meredith Howard <mhoward@roomag.org>
parents: 54
diff changeset
5 name: "{{user_name}}"
6172fc31a08f flatten
Meredith Howard <mhoward@roomag.org>
parents: 54
diff changeset
6 comment: "{{user_comment}}"
17
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 shell: /bin/zsh
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8 groups: sudo
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 append: true
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10 register: user
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11 tags: user
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12
29
9b3befb1c773 Fix YAML
Meredith Howard <mhoward@roomag.org>
parents: 28
diff changeset
13 - name: "ssh : Pubkey for user"
17
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14 authorized_key:
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15 manage_dir: true
57
6172fc31a08f flatten
Meredith Howard <mhoward@roomag.org>
parents: 54
diff changeset
16 user: "{{user_name}}"
17
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17 key: "{{item}}"
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18 with_file:
57
6172fc31a08f flatten
Meredith Howard <mhoward@roomag.org>
parents: 54
diff changeset
19 - public_keys/{{user_name}}
17
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
20 tags: user, ssh
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
21
50
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
22 - name: Clone dotfiles
57
6172fc31a08f flatten
Meredith Howard <mhoward@roomag.org>
parents: 54
diff changeset
23 become: "{{user_name}}"
50
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"
63
Meredith Howard <mhoward@roomag.org>
parents: 57
diff changeset
32 tags: user, dotfiles
50
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
33
54
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
34 - name: Assert hg sources
57
6172fc31a08f flatten
Meredith Howard <mhoward@roomag.org>
parents: 54
diff changeset
35 become: "{{user_name}}"
54
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
36 ini_file:
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
37 dest: "~/.hg/hgrc"
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
38 section: paths
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
39 option: "{{item.name}}"
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
40 value: "{{item.url}}"
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
41 mode: 0640
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
42 create: no
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
43 with_items:
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
44 - {name: 'default', url: "{{dotfiles_default}}"}
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
45 - {name: 'default-push', url: "{{dotfiles_default_push}}"}
63
Meredith Howard <mhoward@roomag.org>
parents: 57
diff changeset
46 tags: user, dotfiles
54
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
47
50
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
48 - name: Update dotfiles
57
6172fc31a08f flatten
Meredith Howard <mhoward@roomag.org>
parents: 54
diff changeset
49 become: "{{user_name}}"
50
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
50 command: hg pull -u
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
51 args:
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
52 chdir: "~"
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
53 register: update_dotfiles
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
54 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
55 failed_when: update_dotfiles.rc > 1
63
Meredith Howard <mhoward@roomag.org>
parents: 57
diff changeset
56 tags: user, dotfiles
50
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
57
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
58 - name: Run bin/homedir-setup
57
6172fc31a08f flatten
Meredith Howard <mhoward@roomag.org>
parents: 54
diff changeset
59 become: "{{user_name}}"
50
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
60 shell: bin/homedir-setup
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
61 args:
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
62 chdir: "~"
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
63 register: homedir_setup
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
64 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
65 failed_when: homedir_setup.rc != 0
63
Meredith Howard <mhoward@roomag.org>
parents: 57
diff changeset
66 tags: user, dotfiles

mercurial