-
Notifications
You must be signed in to change notification settings - Fork 1
/
local.yml
332 lines (287 loc) · 9.73 KB
/
local.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
---
# tasks to complete before running roles
- hosts: all
tags: always
become: true
pre_tasks:
- name: pre-run | update package cache (arch)
tags: always
pacman: update_cache=yes
changed_when: False
when: ansible_distribution == "Archlinux"
- name: pre-run | update package cache (debian, etc)
tags: always
apt: update_cache=yes
changed_when: False
when: ansible_distribution in ["Debian", "Ubuntu"]
# run roles
- hosts: all
tags: base
become: true
roles:
- base
- hosts: workstation
tags: workstation
become: true
roles:
- workstation
# end of run cleanup and reporting
- hosts: all
become: true
tasks:
- name: cleanup package cache (debian and ubuntu)
tags: always
apt:
autoclean: yes
changed_when: false
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu"]
- name: autoremove orphan packages (debian and ubuntu)
tags: always
apt:
autoremove: yes
purge: yes
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu"]
- name: send completion alert
include_tasks: playbooks/send_completion_alert.yml
tags: always
when:
- task_failed is not defined
- name: send failure alert
include_tasks: playbooks/send_failure_alert.yml
tags: always
when:
- task_failed is defined
- task_failed == true
# TODO: reorganize tasks in its respective roles
tasks:
# Install utility packages
- name: system setup | utilities | install utility packages
become_user: jfgomez
package:
state: latest
name:
- dconf-cli
- python3-psutil
- htop
- vim-nox
- curl
- make
when: ansible_distribution in ["Ubuntu"]
- name: system setup | utilities | install utility packages
become_user: jfgomez
package:
state: latest
name:
- htop
- curl
- make
when: ansible_distribution in ["MacOSX"]
# Install GPaste
- name: software | gpaste | install package
become_user: jfgomez
package:
state: latest
name:
- gpaste
when: ansible_distribution in ["Ubuntu"]
# Install Flameshot
- name: software | flameshot | install package
become_user: jfgomez
package:
state: latest
name:
- flameshot
when: ansible_distribution in ["Ubuntu"]
# Configure wallpaper
- name: gnome | appearance | copy wallpaper file
copy:
src: files/spider-verse-wallpaper.jpg
dest: /usr/share/backgrounds/spider-verse-wallpaper.jpg
owner: root
group: root
when: ansible_distribution in ["Ubuntu"]
- name: gnome | appearance | copy wallpaper file
copy:
src: files/spider-verse-wallpaper.jpg
dest: /System/Library/Desktop Pictures/spider-verse-wallpaper.jpg
owner: root
group: root
when: ansible_distribution in ["MacOSX"]
- name: gnome | appearance | set wallpaper
become_user: jfgomez
dconf:
key: "/org/gnome/desktop/background/picture-uri"
value: "'file:///System/Library/Desktop Pictures/spider-verse-wallpaper.jpg'"
- name: gnome | appearance | set wallpaper position
become_user: jfgomez
dconf:
key: "/org/gnome/desktop/background/picture-options"
value: "'zoom'"
# Configure auto-provision for ansible runs
- name: add ansible user
user:
name: velociraptor
system: yes
- name: set up sudo for ansible user
copy:
src: files/sudoer_velociraptor
dest: /etc/sudoers.d/velociraptor
owner: root
group: root
mode: 0440
- name: add ansible-pull cron job
cron:
name: ansible auto-provision
user: velociraptor
minute: "*/10"
job: ansible-pull -o -U https://github.com/jfgomez0912/ansible_desktop.git
# Installed packages
- name: return information about installed packages
package_facts:
manager: auto
# Install Google Chrome
- name: software | google-chrome | add repository key
apt_key:
url: https://dl-ssl.google.com/linux/linux_signing_key.pub
- name: software | google-chrome | add repository
apt_repository:
repo: "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main"
filename: google-chrome
register: chrome_repo
- name: software | google-chrome | update sources (repo added or changed)
apt:
update_cache: yes
changed_when: False
when: chrome_repo.changed
- name: software | google-chrome | install package
apt:
name: google-chrome-stable
# Install VSCode
- name: software | vscode | add repository key
apt_key:
url: https://packages.microsoft.com/keys/microsoft.asc
- name: software | vscode | add repository
apt_repository:
repo: "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
filename: vscode
register: vscode_repo
- name: software | vscode | update sources (repo added or changed)
apt:
update_cache: yes
changed_when: False
when: vscode_repo.changed
- name: software | vscode | install package
apt:
name: code
# Install Spotify
- name: software | spotify | install package
snap:
name: spotify
# Install Terraform
- name: software | terraform | install binary
unarchive:
src: https://releases.hashicorp.com/terraform/1.0.7/terraform_1.0.7_linux_amd64.zip
dest: /usr/local/bin
remote_src: yes
mode: 0755
owner: root
group: root
# Install Docker
- name: software | docker | add repository key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
keyring: /usr/share/keyrings/docker-archive-keyring.gpg
- name: software | docker | add repository
apt_repository:
repo: "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu focal stable"
filename: docker
register: docker_repo
- name: software | docker | update sources (repo added or changed)
apt:
update_cache: yes
changed_when: False
when: docker_repo.changed
- name: software | docker | install package
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
# Install DBeaver
- name: software | dbeaver-ce | install package
snap:
name: dbeaver-ce
# Install AWS CLI
- name: software | aws-cli | download package
get_url:
url: https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
dest: /tmp/awscliv2.zip
when: "'aws-cli' in ansible_facts.packages"
- name: software | aws-cli | unzip package
unarchive:
src: /tmp/awscliv2.zip
dest: /tmp
when: "'aws-cli' in ansible_facts.packages"
- name: software | aws-cli | install package
command: /tmp/aws/install
when: "'aws-cli' in ansible_facts.packages"
# Install Postman
- name: software | postman | install package
snap:
name: postman
# Set favorite apps
- name: gnome | shell settings | set favorite apps
become_user: jfgomez
dconf:
key: "/org/gnome/shell/favorite-apps"
value: "['org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop', 'google-chrome.desktop', 'code.desktop', 'dbeaver-ce_dbeaver-ce.desktop', 'postman_postman.desktop', 'org.remmina.Remmina.desktop', 'spotify_spotify.desktop']"
# Key Bindings Settings
- name: gnome | keybindings | disable default toogle message tray keybinding
become_user: jfgomez
dconf:
key: "/org/gnome/shell/keybindings/toggle-message-tray"
value: "['<Super>m']"
- name: gnome | keybindings | disable default screenshot keybinding
become_user: jfgomez
dconf:
key: "/org/gnome/settings-daemon/plugins/media-keys/screenshot"
value: "@as []"
- name: gnome | keybindings | set custom-keybindings
become_user: jfgomez
dconf:
key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings"
value: "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/']"
- name: gnome | keybindings | set GPaste keybinding
become_user: jfgomez
dconf:
key: "{{ item.key }}"
value: "{{ item.value}}"
with_items:
- { key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/name", value: "'GPaste'" }
- { key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/binding", value: "'<Super>v'" }
- { key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/command", value: "'gpaste-client ui'" }
- name: gnome | keybindings | set Flameshot keybinding
become_user: jfgomez
dconf:
key: "{{ item.key }}"
value: "{{ item.value}}"
with_items:
- { key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/name", value: "'Flameshot'" }
- { key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/binding", value: "'print'" }
- { key: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/command", value: "'flameshot gui'" }
# Terminal Settings
- name: gnome | terminal | set terminal configuration
become_user: jfgomez
dconf:
key: "/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/{{ item.key }}"
value: "{{ item.value}}"
with_items:
- { key: background-color, value: "'rgb(0,43,54)'" }
- { key: default-size-columns, value: "120" }
- { key: foreground-color, value: "'rgb(131,148,150)'" }
- { key: scrollback-unlimited, value: "true" }
- { key: scrollbar-policy, value: "'never'" }
- { key: use-system-font, value: "false" }
- { key: use-theme-colors, value: "false" }
- { key: visible-name, value: "'Main'" }
- { key: font, value: "'Ubuntu Mono Regular 15'" }