roles/user/tasks/main.yml

Sun, 14 Jul 2019 03:09:40 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 14 Jul 2019 03:09:40 -0500
changeset 90
48ec8001075f
parent 89
86248a83a3dd
child 93
14e0c774b916
permissions
-rw-r--r--

Remove lightdm changes

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.
76
9c024e39a565 clean up task names
Meredith Howard <mhoward@roomag.org>
parents: 73
diff changeset
3 - name: "User setup"
17
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 user:
89
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
5 name: "{{ user_name }}"
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
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
76
9c024e39a565 clean up task names
Meredith Howard <mhoward@roomag.org>
parents: 73
diff changeset
13 - name: "User authorized_keys"
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
89
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
16 user: "{{ user_name }}"
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
17 key: "{{ item }}"
17
d0d9fdf1f9d3 start breaking roles out
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18 with_file:
89
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
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
76
9c024e39a565 clean up task names
Meredith Howard <mhoward@roomag.org>
parents: 73
diff changeset
22 - name: "Clone dotfiles"
69
292cb125556d fix become setup
Meredith Howard <mhoward@roomag.org>
parents: 63
diff changeset
23 become: true
89
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
24 become_user: "{{ user_name }}"
50
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
25 shell: >
89
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
26 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
27 && mv _dotfiles_/.hg .
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
28 && rmdir _dotfiles_
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
29 && hg -R ~ update -C master
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
30 args:
89
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
31 chdir: "{{ user.home }}"
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
32 creates: "{{ user.home }}/.hg"
63
Meredith Howard <mhoward@roomag.org>
parents: 57
diff changeset
33 tags: user, dotfiles
50
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
34
76
9c024e39a565 clean up task names
Meredith Howard <mhoward@roomag.org>
parents: 73
diff changeset
35 - name: "Dotfiles hg sources"
69
292cb125556d fix become setup
Meredith Howard <mhoward@roomag.org>
parents: 63
diff changeset
36 become: true
89
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
37 become_user: "{{ user_name }}"
54
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
38 ini_file:
89
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
39 dest: "{{ user.home }}/.hg/hgrc"
54
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
40 section: paths
89
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
41 option: "{{ item.name }}"
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
42 value: "{{ item.url }}"
54
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
43 mode: 0640
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
44 create: no
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
45 with_items:
89
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
46 - {name: 'default', url: "{{ dotfiles_default }}"}
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
47 - {name: 'default-push', url: "{{ dotfiles_default_push }}"}
63
Meredith Howard <mhoward@roomag.org>
parents: 57
diff changeset
48 tags: user, dotfiles
54
2a04e6d7bfcc rig to pull public dotfiles
Meredith Howard <mhoward@roomag.org>
parents: 50
diff changeset
49
76
9c024e39a565 clean up task names
Meredith Howard <mhoward@roomag.org>
parents: 73
diff changeset
50 - name: "Update dotfiles"
69
292cb125556d fix become setup
Meredith Howard <mhoward@roomag.org>
parents: 63
diff changeset
51 become: true
89
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
52 become_user: "{{ user_name }}"
50
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
53 command: hg pull -u
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
54 args:
89
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
55 chdir: "{{ user.home }}"
50
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
56 register: update_dotfiles
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
57 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
58 failed_when: update_dotfiles.rc > 1
63
Meredith Howard <mhoward@roomag.org>
parents: 57
diff changeset
59 tags: user, dotfiles
50
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
60
76
9c024e39a565 clean up task names
Meredith Howard <mhoward@roomag.org>
parents: 73
diff changeset
61 - name: "Run bin/homedir-setup"
69
292cb125556d fix become setup
Meredith Howard <mhoward@roomag.org>
parents: 63
diff changeset
62 become: true
89
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
63 become_user: "{{ user_name }}"
50
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
64 shell: bin/homedir-setup
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
65 args:
89
86248a83a3dd apply ansible-lint suggestions
Meredith Howard <mhoward@roomag.org>
parents: 76
diff changeset
66 chdir: "{{ user.home }}"
50
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
67 register: homedir_setup
8be666ca059e Move dotfiles setup back into user role
Meredith Howard <mhoward@roomag.org>
parents: 36
diff changeset
68 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
69 failed_when: homedir_setup.rc != 0
63
Meredith Howard <mhoward@roomag.org>
parents: 57
diff changeset
70 tags: user, dotfiles

mercurial