forked from Addvilz/dots
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworkstation.yml
449 lines (417 loc) · 13.5 KB
/
workstation.yml
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
---
- name: Configure Fedora workstation
hosts: workstation
remote_user: matiss
vars:
host_username: 'matiss'
git_email: '[email protected]'
git_name: 'Matīss Treinis'
git_signing_key: '3B44AE79519B1C6552941B109123B913EBF53D43'
git_commit_gpgsign: 'true'
git_diff_tool: 'meld'
git_push_default: 'current'
authorized_keys: '{{ lookup("file", "files/id_rsa.pub") }}'
handlers:
- name: Restart sshd
service: name=sshd state=restarted
become: true
- name: Update dconf
shell: dconf update
become: true
- name: Update initramfs
shell: update-initramfs -u
become: true
tasks:
- name: Install base system packages
package:
name: '{{item}}'
state: latest
loop:
- NetworkManager-openvpn
- NetworkManager-openvpn-gnome
- arc-theme
- curl
- dnsutils
- file-roller
- firewall-config
- git
- git-extras
- gnome-extensions-app
- gnome-shell-extension-caffeine
- gnome-shell-extension-openweather
- gnome-tweaks
- gnupg
- hexedit
- htop
- openvpn
- p7zip
- papirus-icon-theme
- python3
- python3-pip
- traceroute
- unzip
- wget
- whois
- zip
- zsh
tags: [ 'base_packages', 'packages' ]
become: yes
- name: Add RPM keys (.rpm repos)
rpm_key:
state: present
key: '{{item}}'
loop:
- 'https://rpmfusion.org/keys?action=AttachFile&do=get&target=RPM-GPG-KEY-rpmfusion-free-fedora-2020'
- 'https://rpmfusion.org/keys?action=AttachFile&do=get&target=RPM-GPG-KEY-rpmfusion-nonfree-fedora-2020'
- 'https://rpms.remirepo.net/RPM-GPG-KEY-remi2021'
become: yes
tags: [ 'repositories' ]
- name: Install repositories (.rpm)
dnf:
name: '{{ item }}'
state: present
loop:
- 'https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-{{ansible_distribution_major_version}}.noarch.rpm'
- 'https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-{{ansible_distribution_major_version}}.noarch.rpm'
- 'https://rpms.remirepo.net/fedora/remi-release-{{ansible_distribution_major_version}}.rpm'
become: yes
tags: [ 'repositories' ]
- name: Enable repositories
shell: 'dnf config-manager --set-enabled {{item}}'
register: dnf_set_enabled
loop:
- remi
- remi-php81
- rpmfusion-free
- rpmfusion-free-updates
- rpmfusion-nonfree
- rpmfusion-nonfree-updates
become: yes
tags: [ 'repositories' ]
changed_when: false
- name: Install workstation packages
package:
name: '{{item}}'
state: latest
loop:
- VirtualBox
- chromium-freeworld
- clang
- cloud-utils
- cmake
- cups
- ffmpeg
- filezilla
- fzf
- geary
- gimp
- inkscape
- libreoffice-base
- libreoffice-calc
- libreoffice-impress
- libreoffice-writer
- make
- meld
- micro
- moby-engine
- ncdu
- nmap
- nodejs
- rubygems
- sshpass
- syncthing
- terminator
- tmux
- transmission
- uget
- valgrind
- virt-manager
- vlc
- yarnpkg
become: yes
tags: [ 'packages' ]
- name: Remove not-needed packages
package:
name: '{{item}}'
state: absent
loop:
- fedora-chromium-config
tags: [ 'packages' ]
become: yes
- name: Add the flathub repository
flatpak_remote:
name: flathub
state: present
flatpakrepo_url: https://dl.flathub.org/repo/flathub.flatpakrepo
become: yes
tags: [ 'packages', 'flatpak' ]
- name: Install Flatpak packages
flatpak:
name:
- com.bitwarden.desktop
- com.mattermost.Desktop
- com.skype.Client
- com.slack.Slack
- com.spotify.Client
- com.usedbottles.bottles
- com.valvesoftware.Steam
- io.atom.Atom
- org.signal.Signal
- org.telegram.desktop
- rest.insomnia.Insomnia
- us.zoom.Zoom
become: yes
tags: [ 'packages', 'flatpak' ]
- name: Ensure system files
copy:
src: '{{item.src}}'
dest: '{{item.dest}}'
mode: '0644'
owner: root
group: root
loop:
- { src: menu-icon.svg, dest: /etc/menu-icon.svg } # Used by Arc Menu GNOME extension.
- { src: wallpaper.jpg, dest: /etc/wallpaper.jpg } # System default wallpaper
become: yes
- name: Configure DCONF
file:
path: /etc/dconf/profile
state: directory
mode: '0755'
owner: root
group: root
become: yes
- name: Copy dconf user profile config
copy:
src: dconf_profile_user
dest: /etc/dconf/profile/user
mode: '0644'
owner: root
group: root
become: yes
- name: Create /etc/dconf/db/local.d
file:
path: /etc/dconf/db/local.d
state: directory
mode: '0755'
owner: root
group: root
become: yes
- name: Update dconf settings
copy:
src: dconf_settings.ini
dest: /etc/dconf/db/local.d/00-global
mode: '0644'
owner: root
group: root
notify: [ Update dconf ]
become: yes
tags: [ 'tmp' ]
- name: Configure boot screen
copy:
src: plymouthd.conf
dest: /etc/plymouth/plymouthd.conf
mode: '0644'
owner: root
group: root
notify: [ Update initramfs ]
become: yes
- name: Install oh-my-zsh for self
script:
cmd: 'scripts/oh-my-zsh-setup.sh --unattended --keep-zshrc'
chdir: '/home/{{host_username}}'
creates: '/home/{{host_username}}/.oh-my-zsh'
changed_when: false # ignore
- name: Install oh-my-zsh for root
script:
cmd: 'scripts/oh-my-zsh-setup.sh --unattended --keep-zshrc'
creates: '/root/.oh-my-zsh'
changed_when: false # ignore
become: yes
- name: Install fonts
copy:
src: fonts/
dest: /usr/local/share/fonts
become: yes
- name: Ensure group "docker" exists
group:
name: docker
state: present
become: yes
- name: Update own user profile
user:
name: '{{host_username}}'
shell: /bin/zsh
groups: docker
append: yes
create_home: yes
password: '*' # Initial password is none, account locked
update_password: on_create # Do not reset password from ansible
become: yes
- name: Set root shell to zsh
user:
name: root
shell: /bin/zsh
become: yes
- name: Create ~/.ssh/
file:
path: '/home/{{host_username}}/.ssh'
state: directory
mode: '0700'
owner: '{{host_username}}'
group: '{{host_username}}'
become: yes
- name: Ensure personal dot files
copy:
src: '{{item.src}}'
dest: '{{item.dest}}'
mode: '0600'
owner: '{{host_username}}'
group: '{{host_username}}'
loop:
- { src: dots/zshrc.zsh, dest: '/home/{{host_username}}/.zshrc' }
- { src: dots/tmux.conf, dest: '/home/{{host_username}}/.tmux.conf' }
- { src: dots/editorconfig, dest: '/home/{{host_username}}/.editorconfig' }
- { src: dots/wgetrc, dest: '/home/{{host_username}}/.wgetrc' }
- { src: dots/gitignore, dest: '/home/{{host_username}}/.gitignore' }
- { src: dots/curlrc, dest: '/home/{{host_username}}/.curlrc' }
- { src: dots/.atom/config.cson, dest: '/home/{{host_username}}/.var/app/io.atom.Atom/data/config.cson' }
- { src: dots/.atom/styles.less, dest: '/home/{{host_username}}/.var/app/io.atom.Atom/data/styles.less' }
tags: [ 'dots' ]
- name: Ensure root dot files
copy:
src: '{{item.src}}'
dest: '{{item.dest}}'
mode: '0600'
owner: root
group: root
loop:
- { src: dots/zshrc.zsh, dest: '/root/.zshrc' }
- { src: dots/editorconfig, dest: '/root/.editorconfig' }
- { src: dots/wgetrc, dest: '/root/.wgetrc' }
- { src: dots/curlrc, dest: '/root/.curlrc' }
become: yes
tags: [ 'dots' ]
- name: Ensure personal files (from templates)
template:
src: '{{item.src}}'
dest: '{{item.dest}}'
mode: '0600'
owner: '{{host_username}}'
group: '{{host_username}}'
loop:
- { src: dots/gitconfig, dest: '/home/{{host_username}}/.gitconfig' }
- { src: dots/authorized_keys, dest: '/home/{{host_username}}/.ssh/authorized_keys' }
- name: Ensure default directories in home
file:
path: '{{item}}'
state: directory
mode: '0700'
owner: '{{host_username}}'
group: '{{host_username}}'
loop:
- '/home/{{host_username}}/dots'
- '/home/{{host_username}}/Projects'
- '/home/{{host_username}}/Projects/Work'
- '/home/{{host_username}}/Projects/Work/Archive'
- '/home/{{host_username}}/Projects/Work/Scratch'
- '/home/{{host_username}}/Projects/Personal'
- '/home/{{host_username}}/Projects/Personal/Archive'
- '/home/{{host_username}}/Projects/Personal/Scratch'
- '/home/{{host_username}}/Documents/Work/Archive'
- '/home/{{host_username}}/Documents/Personal/Archive'
become: yes
tags: [ 'dir-structure' ]
# Configure icons in Nautilus for some directories.
- name: Set home folder icons
shell: 'gio set -t string {{item.dir}} metadata::custom-icon file://{{item.icon}}'
changed_when: false # Really not that important...
loop:
- { dir: '/home/{{host_username}}/dots', icon: '/usr/share/icons/Papirus/64x64/places/folder-orange-sync.svg' }
- { dir: '/home/{{host_username}}/Projects', icon: '/usr/share/icons/Papirus/64x64/places/folder-magenta-projects.svg' }
- { dir: '/home/{{host_username}}/Projects/Work', icon: '/usr/share/icons/Papirus/64x64/places/folder-red-projects.svg' }
- { dir: '/home/{{host_username}}/Projects/Work/Archive', icon: '/usr/share/icons/Papirus/64x64/places/folder-red-tar.svg' }
- { dir: '/home/{{host_username}}/Projects/Work/Scratch', icon: '/usr/share/icons/Papirus/64x64/places/folder-red-java.svg' }
- { dir: '/home/{{host_username}}/Projects/Personal', icon: '/usr/share/icons/Papirus/64x64/places/folder-teal-projects.svg' }
- { dir: '/home/{{host_username}}/Projects/Personal/Archive', icon: '/usr/share/icons/Papirus/64x64/places/folder-teal-tar.svg' }
- { dir: '/home/{{host_username}}/Projects/Personal/Scratch', icon: '/usr/share/icons/Papirus/64x64/places/folder-teal-java.svg' }
- { dir: '/home/{{host_username}}/Documents/Work', icon: '/usr/share/icons/Papirus/64x64/places/folder-red-documents.svg' }
- { dir: '/home/{{host_username}}/Documents/Work/Archive', icon: '/usr/share/icons/Papirus/64x64/places/folder-red-tar.svg' }
- { dir: '/home/{{host_username}}/Documents/Personal', icon: '/usr/share/icons/Papirus/64x64/places/folder-teal-documents.svg' }
- { dir: '/home/{{host_username}}/Documents/Personal/Archive', icon: '/usr/share/icons/Papirus/64x64/places/folder-teal-tar.svg' }
tags: [ 'dir-structure' ]
# Install python extra packages and ensure they are up to date.
- name: Ensure pip3 packages
pip:
name: '{{item}}'
executable: pip3
state: latest
loop:
- ansible # Yo dawg i herd you like Ansible so we put a Ansible in yo Ansible so you can automate while u automate
- awscli
- cloudsmith-cli
- django
- docker-compose
- pipenv
become: yes
- name: Remove global, default PHP, if installed
package:
name: '{{item}}'
state: absent
loop:
- php-cli
- php-fpm
- php-common
tags: [ 'php', 'packages' ]
become: yes
- name: Install PHP packages
package:
name: '{{item}}'
state: latest
loop:
# PHP8.1
- php81-php-cli
- php81-php-curl
- php81-php-devel
- php81-php-gd
- php81-php-gmp
- php81-php-intl
- php81-php-intl
- php81-php-ldap
- php81-php-mbstring
- php81-php-mysqlnd
- php81-php-pdo
- php81-php-xml
tags: [ 'php', 'packages' ]
become: yes
- name: Link PHP binary to point to usable version
file:
src: /usr/bin/php81
dest: /usr/bin/php
owner: root
group: root
state: link
become: yes
tags: [ 'php' ]
- name: Install composer globally
script:
cmd: 'scripts/composer-setup.sh'
chdir: /tmp
creates: /usr/local/bin/composer
changed_when: false # ignore
tags: [ 'php' ]
become: yes
- name: Install Symfony CLI globally
script:
cmd: 'scripts/symfony-setup.sh --install-dir=/usr/local/bin/'
chdir: /tmp
creates: /usr/local/bin/symfony
changed_when: false # ignore
tags: [ 'php' ]
become: yes
- name: Install pyenv for own user
script:
cmd: 'scripts/pyenv-setup.sh'
chdir: '/home/{{host_username}}'
creates: '/home/{{host_username}}/.pyenv'
changed_when: false # ignore