Skip to content

Commit b4008e0

Browse files
authored
Merge branch 'master' into master
2 parents 41f335a + d7e0a16 commit b4008e0

File tree

2 files changed

+100
-16
lines changed

2 files changed

+100
-16
lines changed

dev-setup.yml

Lines changed: 96 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,30 @@
66
git_user: Utkarsh Upadhyay
77
git_email: musically.ut@gmail.com
88

9+
sshd: ssh
10+
sshd_config: /etc/ssh/sshd_config
11+
12+
handlers:
13+
- name: restart sshd
14+
service: name=sshd state=restarted
15+
916
tasks:
10-
17+
1118
# User management
1219

1320
- name: Install sudo
1421
package:
1522
name: sudo
1623
state: present
24+
tags:
25+
- user
1726

1827
- name: Make sure we have a 'wheel' group
1928
group:
2029
name: wheel
2130
state: present
31+
tags:
32+
- user
2233

2334
- name: Allow 'wheel' group to have passwordless sudo
2435
lineinfile:
@@ -27,58 +38,94 @@
2738
regexp: '^%wheel'
2839
line: '%wheel ALL=(ALL) NOPASSWD: ALL'
2940
validate: 'visudo -cf %s'
41+
tags:
42+
- user
3043

3144
- name: "Create/add {{ user_name }} to wheel group"
32-
user:
45+
user:
3346
name: "{{ user_name }}"
34-
groups: wheel
47+
groups: wheel
3548
shell: /bin/bash
36-
append: yes
37-
state: present
49+
append: yes
50+
state: present
3851
createhome: yes
52+
tags:
53+
- user
3954

4055
- name: "Set up authorized keys for the {{ user_name }} user"
41-
authorized_key:
56+
authorized_key:
4257
user: "{{ user_name }}"
4358
key: "{{ item }}"
4459
with_file:
4560
- keys/id_ed25519.pub
61+
tags:
62+
- user
63+
64+
- name: Disable empty password login
65+
lineinfile: dest={{ sshd_config }} regexp="^#?PermitEmptyPasswords" line="PermitEmptyPasswords no"
66+
notify: restart sshd
67+
tags:
68+
- user
69+
70+
- name: Disable remote root login
71+
lineinfile: dest={{ sshd_config }} regexp="^#?PermitRootLogin" line="PermitRootLogin no"
72+
notify: restart sshd
73+
tags:
74+
- user
75+
76+
- name: Disable password login
77+
lineinfile: dest={{ sshd_config }} regexp="^(#\s*)?PasswordAuthentication " line="PasswordAuthentication no"
78+
notify: restart sshd
79+
tags:
80+
- user
4681

4782
# Install dev tools
4883

4984
- name: Install VIM
5085
package:
5186
name: vim
5287
state: present
88+
tags:
89+
- dev
5390

5491
- name: Install git
5592
package:
5693
name: git
5794
state: present
95+
tags:
96+
- dev
5897

5998
- name: Install tmux
6099
package:
61100
name: tmux
62101
state: present
102+
tags:
103+
- dev
63104

64105
- name: Install htop
65106
package:
66107
name: htop
67108
state: present
109+
tags:
110+
- dev
68111

69112
- name: Ensure local/z dir exists
70113
become: true
71114
become_user: "{{ user_name }}"
72-
file:
115+
file:
73116
path: "/home/{{ user_name }}/.local/z"
74117
state: directory
118+
tags:
119+
- dev
75120

76121
- name: Install z.sh
77122
become: true
78123
become_user: "{{ user_name }}"
79-
get_url:
124+
get_url:
80125
url: https://raw.githubusercontent.com/rupa/z/master/z.sh
81126
dest: "/home/{{ user_name }}/.local/z/z.sh"
127+
tags:
128+
- dev
82129

83130
- name: Install nvm.sh
84131
become: true
@@ -88,6 +135,8 @@
88135
args:
89136
warn: false
90137
creates: "/home/{{ user_name }}/.nvm/nvm.sh"
138+
tags:
139+
- dev
91140

92141
- name: Install Ruby
93142
package:
@@ -101,6 +150,8 @@
101150
args:
102151
creates: "/home/{{ user_name }}/.nvm/versions/node/v12*"
103152
executable: bash
153+
tags:
154+
- dev
104155

105156
# Prepare VIM
106157

@@ -111,97 +162,127 @@
111162
args:
112163
warn: false
113164
creates: "/home/{{ user_name }}/.vim/autoload/plug.vim"
165+
tags:
166+
- dev
114167

115168
# Copy configuration files
116169
- name: Install vim plugins
117170
become: true
118171
become_user: "{{ user_name }}"
119172
shell: "vim +PlugInstall +qall"
173+
tags:
174+
- dev
120175

121176
- name: Copy vimrc
122177
copy:
123178
src: dotfiles/vimrc
124179
dest: "/home/{{ user_name }}/.vimrc"
125180
owner: "{{ user_name }}"
181+
tags:
182+
- dev
126183

127184
- name: Copy bashrc
128185
copy:
129186
src: dotfiles/bashrc
130187
dest: "/home/{{ user_name }}/.bashrc"
131188
owner: "{{ user_name }}"
189+
tags:
190+
- dev
132191

133192
- name: Copy tmux.conf
134193
copy:
135194
src: dotfiles/tmux.conf
136195
dest: "/home/{{ user_name }}/.tmux.conf"
137196
owner: "{{ user_name }}"
197+
tags:
198+
- dev
138199

139200
- name: Copy gitconfig
140201
copy:
141202
src: dotfiles/gitconfig
142203
dest: "/home/{{ user_name }}/.gitconfig"
143204
owner: "{{ user_name }}"
205+
tags:
206+
- dev
144207

145208
- name: Fix user's full name in gitconfig
146209
become_user: "{{ user_name }}"
147210
become: true
148211
shell: "git config --global user.name '{{ git_user }}'"
212+
tags:
213+
- dev
149214

150215
- name: Fix user's email in gitconfig
151216
become_user: "{{ user_name }}"
152217
become: true
153218
shell: "git config --global user.email '{{ git_email }}'"
219+
tags:
220+
- dev
154221

155222
- name: Copy gitignore
156223
copy:
157224
src: dotfiles/gitignore
158225
dest: "/home/{{ user_name }}/.gitignore"
159226
owner: "{{ user_name }}"
227+
tags:
228+
- dev
160229

161230
- name: Ensure ~/bin dir exists
162231
become: true
163232
become_user: "{{ user_name }}"
164-
file:
233+
file:
165234
path: "/home/{{ user_name }}/bin"
166235
state: directory
236+
tags:
237+
- dev
167238

168239
- name: Copy conda.sh
169240
copy:
170241
src: dotfiles/conda.sh
171242
dest: "/home/{{ user_name }}/bin/conda.sh"
172243
owner: "{{ user_name }}"
244+
tags:
245+
- dev
246+
173247

174-
175248
# Install powerline fonts
176249

177250
- name: Fetch Powerline fonts
178251
become: true
179252
become_user: "{{ user_name }}"
180-
git:
253+
git:
181254
repo: https://github.com/powerline/fonts.git
182255
dest: "/home/{{ user_name }}/powerline-fonts"
256+
tags:
257+
- dev
183258

184259
- name: Install fonts
185260
become: true
186261
become_user: "{{ user_name }}"
187262
shell: ./install.sh
188-
args:
263+
args:
189264
chdir: "/home/{{ user_name }}/powerline-fonts"
190265
creates: "/home/{{ user_name }}/.local/share/fonts/Anonymice Powerline.ttf"
266+
tags:
267+
- dev
268+
191269

192-
193270
# Install Miniconda.sh
194-
271+
195272
- name: Download miniconda
196273
become: true
197274
become_user: "{{ user_name }}"
198-
get_url:
275+
get_url:
199276
url: https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
200277
dest: "/home/{{ user_name }}/miniconda.sh"
278+
tags:
279+
- dev
201280

202281
- name: Install miniconda
203282
become: true
204283
become_user: "{{ user_name }}"
205284
shell: "bash /home/{{ user_name }}/miniconda.sh -b -p /home/{{ user_name }}/miniconda3"
206285
args:
207286
creates: "/home/{{ user_name }}/miniconda3"
287+
tags:
288+
- dev

dotfiles/vimrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ let g:PaperColor_Theme_Options = {
2525
\ }
2626
\ }
2727

28+
Plug 'jparise/vim-graphql'
2829
Plug 'bcicen/vim-vice'
2930
Plug 'flazz/vim-colorschemes'
3031
Plug 'rust-lang/rust.vim'
@@ -72,6 +73,7 @@ Plug 'jmcantrell/vim-virtualenv'
7273
Plug 'arcticicestudio/nord-vim'
7374

7475
Plug 'nightsense/snow'
76+
Plug 'lepture/vim-jinja'
7577

7678
" Plug 'eiginn/netrw'
7779
" Plug 'jelera/vim-javascript-syntax'
@@ -171,6 +173,7 @@ au BufNewFile,BufRead *.conf set filetype=conf
171173
au BufNewFile,BufRead *.template set filetype=html
172174
au BufNewFile,BufRead nginx.conf set filetype=nginx
173175
au BufNewFile,BufRead *.m set filetype=octave
176+
au BufNewFile,BufRead *.njk set ft=jinja
174177

175178
" Do not show the '.orig' or '~' files
176179
let NERDTreeIgnore=['\~$', '.*\.orig$', '.*\.pyc$']
@@ -261,7 +264,7 @@ fun! <SID>StripTrailingWhitespaces()
261264
let @/=_s
262265
call cursor(l, c)
263266
endfun
264-
autocmd FileType tex,r,octave,matlab,rst,sh,sql,html,javascript,typescript,latex,org,haskell,c,cpp,java,php,ruby,python,md,coffee,less autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()
267+
autocmd FileType tex,r,octave,matlab,rst,sh,sql,html,javascript,typescript,latex,org,haskell,c,cpp,java,php,ruby,python,md,coffee,less,yaml autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()
265268
autocmd FileType sql setlocal nospell
266269
autocmd FileType matlab setlocal nospell
267270
autocmd FileType tex setlocal indentexpr=

0 commit comments

Comments
 (0)