-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmobchine.playbook
184 lines (157 loc) · 5.14 KB
/
mobchine.playbook
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
---
- hosts: mobchines
vars:
users:
- username: zee
shell: /bin/bash
github: zspencer
- username: jtu
shell: /bin/bash
github: jtu0
- username: bhaibel
shell: /bin/bash
github: bhaibel
- username: jacksonlatka
shell: /bin/bash
github: jacksonlatka
become: yes
become_method: sudo
tasks:
- name: "make sure SSH is allowed"
ufw:
rule: allow
port: 22
proto: tcp
- name: "enable the firewall!"
ufw:
state: enabled
policy: deny
- name: "ensure sudoers dont need to put in a password"
lineinfile:
path: /etc/sudoers
regexp: '^%sudo ALL='
line: '%sudo ALL=(ALL:ALL) NOPASSWD:ALL'
- name: "install developer tools"
package: name={{ item }} state=latest
with_items:
- git
- vim
- tmux
- docker
- build-essential
- gcc
- autoconf
- bison
- libssl-dev
- libyaml-dev
- libreadline6-dev
- zlib1g-dev
- libncurses5-dev
- libffi-dev
- libgdbm-dev
- name: "install a lightweight desktop"
package: name={{ item }} state=latest
with_items:
- xubuntu-desktop
- firefox
- name: "install VNC"
package: name={{ item }} state=latest
with_items:
- tigervnc-standalone-server
- tigervnc-xorg-extension
- name: "check if atom exists"
stat: path=/usr/bin/atom
register: atom
- name: "install atom"
apt: deb=https://github.com/atom/atom/releases/download/v1.19.3/atom-amd64.deb
when: atom.stat.exists != True
- name: Create users
with_items: "{{ users }}"
user: name={{ item.username }} shell={{ item.shell }} groups=sudo state=present
- name: "Set authorized key"
with_items: "{{ users }}"
authorized_key: user={{ item.username }} key=https://github.com/{{ item.github }}.keys exclusive=yes state=present
- name: "make .vnc folder"
with_items: "{{ users }}"
become_user: "{{ item.username }}"
file: path=/home/{{item.username}}/.vnc/ state=directory mode=0755
- name: "make xstartup file"
with_items: "{{ users }}"
become_user: "{{ item.username }}"
file: path=/home/{{item.username}}/.vnc/xstartup state=touch mode=0755
- name: "Configure xstartup"
with_items: "{{ users }}"
become_user: "{{ item.username }}"
blockinfile:
path: "/home/{{ item.username }}/.vnc/xstartup"
block: |
#!/bin/bash
xrdb $HOME/.Xresources
xfce4-session
- name: "Install rbenv"
with_items: "{{ users }}"
become_user: "{{ item.username }}"
git: repo=https://github.com/rbenv/rbenv.git dest=/home/{{ item.username }}/.rbenv
- name: "ensure there's a rbenv-plugins directory"
with_items: "{{ users }}"
become_user: "{{ item.username }}"
file: state=directory path=/home/{{ item.username }}/.rbenv/plugins
- name: "Install ruby-build"
with_items: "{{ users }}"
become_user: "{{ item.username }}"
git: repo=https://github.com/rbenv/ruby-build.git dest=/home/{{ item.username }}/.rbenv/plugins/ruby-build
- name: "Ensure rbenv is on the path"
with_items: "{{ users }}"
become_user: "{{ item.username }}"
lineinfile:
state: present
path: /home/{{ item.username }}/.bashrc
line: export PATH="$HOME/.rbenv/bin:$PATH"
- name: "Ensure rbenv shims are on the path"
with_items: "{{ users }}"
become_user: "{{ item.username }}"
lineinfile:
state: present
path: /home/{{ item.username }}/.bashrc
line: eval "$(rbenv init -)"
- name: "ensure there's a homesick repos directory"
with_items: "{{ users }}"
become_user: "{{ item.username }}"
file: state=directory path=/home/{{ item.username }}/.homesick/repos
- name: "install homeshick"
with_items: "{{ users }}"
become_user: "{{ item.username }}"
git: repo=https://github.com/andsens/homeshick.git dest=/home/{{ item.username }}/.homesick/repos/homeshick
- name: "place homeshick bin are on the path"
with_items: "{{ users }}"
become_user: "{{ item.username }}"
lineinfile:
state: present
path: /home/{{ item.username }}/.bashrc
line: source "$HOME/.homesick/repos/homeshick/homeshick.sh"
- name: "install michigan-benefits specific dependencies"
package: name={{ item }} state=latest
with_items:
- libxml2-dev
- libpq-dev
- postgresql
- postgresql-contrib
- libsqlite3-dev
- nodejs
- python-psycopg2
- xvfb
- name: "check if chromedriver exists"
stat: path=/usr/local/bin/chromedriver
register: chromedriver
- name: "install chromedriver"
unarchive: remote_src=yes dest=/usr/local/bin src=https://chromedriver.storage.googleapis.com/2.32/chromedriver_linux64.zip
when: chromedriver.stat.exists != True
- name: "check if chrome exists"
stat: path=/usr/bin/google-chrome
register: chrome
- name: 'install chrome'
apt: deb=https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- name: 'create postgresql users'
with_items: "{{ users }}"
become_user: postgres
postgresql_user: role_attr_flags="SUPERUSER,CREATEDB,CREATEROLE" name="{{ item.username }}"