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