|
1 --- |
|
2 |
|
3 # - repos ? |
|
4 # - backports |
|
5 # - pgdg |
|
6 # x update |
|
7 # x upgrade |
|
8 # x packages: build-essentials, git, hg, vim-gtk, i3, ffx, ag, ctags, zsh, tmux, ruby, fonts? |
|
9 # - vbox exts? |
|
10 # - default x session |
|
11 # - user |
|
12 # - dotfiles |
|
13 # - authorized keys? |
|
14 # - ssh ids from vault? pgp? |
|
15 # - homedir-setup |
|
16 # - sudo group |
|
17 # - plenv - rbenv build? |
|
18 |
|
19 - include: debian.yml |
|
20 when: ansible_distribution == 'Debian' |
|
21 |
|
22 - name: Enable sudo for sudo group |
|
23 lineinfile: |
|
24 dest: /etc/sudoers |
|
25 state: present |
|
26 regexp: '^%sudo' |
|
27 line: '%sudo ALL=(ALL:ALL) ALL' |
|
28 |
|
29 - name: User setup |
|
30 user: |
|
31 name: "{{user.name}}" |
|
32 comment: "{{user.comment}}" |
|
33 shell: /bin/zsh |
|
34 groups: sudo |
|
35 append: true |
|
36 register: user |
|
37 |
|
38 - name: Pubkey for user |
|
39 authorized_key: |
|
40 manage_dir: true |
|
41 user: "{{user.name}}" |
|
42 key: "{{item}}" |
|
43 with_file: |
|
44 - public_keys/{{user.name}} |
|
45 |
|
46 - name: Ensure hostkeys |
|
47 sudo: true |
|
48 sudo_user: "{{user.name}}" |
|
49 lineinfile: |
|
50 dest: "{{user.home}}/.ssh/known_hosts" |
|
51 state: present |
|
52 line: "{{item.value}}" |
|
53 create: true |
|
54 mode: 0600 |
|
55 with_dict: hostkeys |
|
56 |
|
57 - name: Purge hostkeys |
|
58 sudo: true |
|
59 sudo_user: "{{user.name}}" |
|
60 lineinfile: |
|
61 dest: "{{user.home}}/.ssh/known_hosts" |
|
62 state: absent |
|
63 line: "{{item.value}}" |
|
64 with_dict: hostkeys_removed |
|
65 |
|
66 - name: Check for dotfiles checkout in homedir |
|
67 stat: path={{user.home}}/.hg |
|
68 register: dotfiles |
|
69 |
|
70 - name: Clone dotfiles |
|
71 when: dotfiles.stat.exists == false |
|
72 shell: > |
|
73 hg clone -U {{dotfiles_repository}} {{user.home}}/_dotfiles_ |
|
74 && mv {{user.home}}/_dotfiles_/.hg {{user.home}} |
|
75 && rmdir {{user.home}}/_dotfiles_ |
|
76 && chown -R {{user.name}}:{{user.group}} {{user.home}}/.hg |
|
77 && sudo -u {{user.name}} hg -R {{user.home}} update -C |
|
78 |
|
79 - name: Run homedir-setup |
|
80 sudo: true |
|
81 sudo_user: "{{user.name}}" |
|
82 shell: ./.homedir-setup.rb -su chdir={{user.home}} |
|
83 register: homedir_setup |
|
84 changed_when: homedir_setup.stdout | match("Updating|Installing") |
|
85 failed_when: homedir_setup.rc != 0 |
|
86 |
|
87 |