-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.yaml
334 lines (311 loc) · 11.5 KB
/
setup.yaml
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
---
- name: Machine setup
hosts: localhost
become: true
remote_user: tmeijn
connection: local
gather_facts: true
vars:
teams_for_linux_version: "v1.4.37"
arch_mapping: # Map ansible architecture {{ ansible_architecture }} names to Docker's architecture names
x86_64: amd64
aarch64: arm64
tasks:
- name: Setting facts based on ansible_architecture
block:
- name: Set facts for amd64
ansible.builtin.set_fact:
aws_ssm_plugin_deb_url: https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb
teams_for_linux_deb_url: https://github.com/IsmaelMartinez/teams-for-linux/releases/download/{{ teams_for_linux_version }}/teams-for-linux_{{ teams_for_linux_version | regex_replace('^v','') }}_amd64.deb
vscode_deb_url: https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64
when: ansible_architecture == 'x86_64'
- name: Set facts for arm64
ansible.builtin.set_fact:
aws_ssm_plugin_deb_url: https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_arm64/session-manager-plugin.deb
teams_for_linux_deb_url: https://github.com/IsmaelMartinez/teams-for-linux/releases/download/{{ teams_for_linux_version }}/teams-for-linux_{{ teams_for_linux_version | regex_replace('^v','') }}_arm64.deb
vscode_deb_url: https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-arm64
when: ansible_architecture == 'aarch64'
- name: Install packages
ansible.builtin.apt:
pkg:
- build-essential
- curl
- ffmpeg
- gawk
- git
- gnome-shell-extensions
- gnome-tweaks
- graphviz
- gtk2-engines-murrine
- jc
- kitty # Our terminal!
- nala
- network-manager-l2tp
- network-manager-l2tp-gnome
- pandoc
- pavucontrol
- poppler-utils
- px
- qemu-system
- timeshift
- vim
- virt-manager
- xclip
update_cache: true
- name: Ensure packages are absent
ansible.builtin.apt:
pkg:
- gnome-shell-extension-ubuntu-dock # This cannot be disabled, see https://askubuntu.com/q/1498249.
state: absent
- name: Set Kitty as default
ansible.builtin.shell: |
sudo update-alternatives --set x-terminal-emulator "$(which kitty)"
changed_when: false
- name: "[BLOCK] Setting up Flatpak"
block:
- name: Install Flatpak and dependencies if not present
ansible.builtin.package:
name:
- flatpak
- gnome-software-plugin-flatpak
- name: Setup Flathub as a remote
community.general.flatpak_remote:
name: flathub
state: present
flatpakrepo_url: https://dl.flathub.org/repo/flathub.flatpakrepo
- name: Install Flatpak packages
community.general.flatpak:
name:
- org.videolan.VLC
- org.gnome.meld
- io.podman_desktop.PodmanDesktop
- org.flameshot.Flameshot
- io.dbeaver.DBeaverCommunity
- io.github.seadve.Kooha
- com.axosoft.GitKraken
- md.obsidian.Obsidian
- app.getclipboard.Clipboard
- dev.vencord.Vesktop
- com.moonlight_stream.Moonlight
state: present
- name: Install Firefox as snap (arm64 is not available yet on Flatpak)
community.general.snap:
name: firefox
- name: "[BLOCK] Install AWS Session Manager Plugin if not present"
block:
- name: ==== Check if plugin is present
become: false
ansible.builtin.shell:
cmd: command -v session-manager-plugin
register: aws_ssm_plugin_installed
ignore_errors: true
changed_when: false
- name: ==== Download Plugin
ansible.builtin.apt:
deb: "{{ aws_ssm_plugin_deb_url }}"
state: present
when: aws_ssm_plugin_installed is failed
- name: "[BLOCK] Install Visual Studio Code if not present"
block:
- name: ==== Check if VSCode is present
become: false
ansible.builtin.shell:
cmd: command -v code
register: vscode_installed
ignore_errors: true
changed_when: false
- name: ==== Download VSCode
ansible.builtin.apt:
deb: "{{ vscode_deb_url }}"
state: present
when: vscode_installed is failed
- name: "[BLOCK] Add repo, install and configure Docker"
block:
- name: Add Docker's official GPG key
ansible.builtin.apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
keyring: /etc/apt/keyrings/docker.gpg
state: present
- name: Add Docker repository
ansible.builtin.apt_repository:
repo: >-
deb [arch={{ arch_mapping[ansible_architecture] | default(ansible_architecture) }}
signed-by=/etc/apt/keyrings/docker.gpg]
https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable
filename: docker
state: present
- name: Install Docker and related packages
ansible.builtin.apt:
pkg:
- docker-ce
- docker-ce-cli
- containerd.io
state: present
update_cache: true
- name: Add Docker group
ansible.builtin.group:
name: docker
state: present
- name: Add user to Docker group
ansible.builtin.user:
name: "{{ ansible_user }}"
groups: docker
append: true
- name: Enable and start Docker services
ansible.builtin.systemd:
name: "{{ item }}"
enabled: true
state: started
loop:
- docker.service
- containerd.service
- name: "[BLOCK] Add repo, install and configure Incus"
block:
- name: Add Incus's official GPG key
ansible.builtin.apt_key:
url: https://pkgs.zabbly.com/key.asc
keyring: /etc/apt/keyrings/zabbly.asc
state: present
- name: Add Incus repository
ansible.builtin.apt_repository:
repo: >-
Enabled: yes
Types: deb
URIs: https://pkgs.zabbly.com/incus/stable
Suites: noble
Components: main
Architectures: {{ arch_mapping[ansible_architecture] | default(ansible_architecture) }}
Signed-By: /etc/apt/keyrings/zabbly.asc
filename: incus
state: present
- name: Install Incus and related packages
ansible.builtin.apt:
pkg:
- incus
state: present
update_cache: true
- name: Add incus-admin group
ansible.builtin.group:
name: incus-admin
state: present
- name: Add user to incus-admin group
ansible.builtin.user:
name: "{{ ansible_user }}"
groups: incus-admin
append: true
# === NOTE: This is currently not working on Ubuntu Asahi
# - name: "[BLOCK] Add repo, install and configure Firefox"
# block:
# - name: Add Firefox's official GPG key
# ansible.builtin.apt_key:
# url: https://packages.mozilla.org/apt/repo-signing-key.gpg
# keyring: /etc/apt/keyrings/packages.mozilla.org.gpg
# state: absent
# - name: Add Firefox repository
# ansible.builtin.apt_repository:
# repo: >-
# deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.gpg]
# https://packages.mozilla.org/apt mozilla main
# filename: mozilla
# state: absent
# - name: Install Firefox
# ansible.builtin.apt:
# pkg:
# - firefox
# state: absent
# update_cache: true
# === NOTE: This is currently not working on Ubuntu Asahi
# - name: "[BLOCK] Add repo, install and configure Progressive Web Apps for Firefox"
# block:
# - name: ==== Add firefoxpwa's official GPG key
# ansible.builtin.apt_key:
# url: https://packagecloud.io/filips/FirefoxPWA/gpgkey
# keyring: /usr/share/keyrings/firefoxpwa-keyring.gpg
# state: absent
# - name: Add firefoxpwa repository
# ansible.builtin.apt_repository:
# repo: >-
# deb [signed-by=/usr/share/keyrings/firefoxpwa-keyring.gpg]
# https://packagecloud.io/filips/FirefoxPWA/any any main
# filename: firefoxpwa
# state: absent
# - name: Install Progressive Web Apps for Firefox
# ansible.builtin.apt:
# pkg:
# - firefoxpwa
# state: absent
# update_cache: true
# NOTE: this should be absolutely last as afterwards restart is needed.
- name: Install Pop Shell if not present
become: false
block:
- name: Check if extension is present
ansible.builtin.shell:
cmd: gnome-extensions list | grep [email protected] -q
register: gnome_pop_shell_installed
ignore_errors: true
changed_when: false
- name: Download Plugin
ansible.builtin.shell: |
npm -g i typescript
git clone --recursive --depth 1 --shallow-submodules --branch master_noble https://github.com/pop-os/shell.git
cd shell
make local-install
cd ..
rm -rf shell
when: gnome_pop_shell_installed is failed
- name: Install Nerd Fonts if not present
become: false
vars:
nerd_fonts_dir: "/home/{{ ansible_env.SUDO_USER }}/.local/share/fonts/NerdFonts"
nerd_fonts_list:
- "FiraCode"
- "Hack"
- "JetBrainsMono"
nerd_fonts_base_url: "https://github.com/ryanoasis/nerd-fonts/releases/latest/download"
block:
- name: Ensure fonts directory exists
file:
path: "{{ nerd_fonts_dir }}"
state: directory
mode: '0755'
- name: Check if font files for each font exist
shell: |
ls {{ nerd_fonts_dir }} | grep -qi "{{ item }}"
register: font_check
changed_when: false
failed_when: false
loop: "{{ nerd_fonts_list }}"
loop_control:
label: "{{ item }}"
- name: Download Nerd Font if not installed
get_url:
url: "{{ nerd_fonts_base_url }}/{{ item }}.zip"
dest: "/tmp/{{ item }}.zip"
mode: '0644'
when: font_check.results[ansible_loop.index0].rc != 0
loop: "{{ nerd_fonts_list }}"
loop_control:
label: "{{ item }}"
extended: true
- name: Extract font files
unarchive:
src: "/tmp/{{ item }}.zip"
dest: "{{ nerd_fonts_dir }}"
remote_src: yes
when: font_check.results[ansible_loop.index0].rc != 0
loop: "{{ nerd_fonts_list }}"
loop_control:
label: "{{ item }}"
extended: true
- name: Clean up temporary font zip
file:
path: "/tmp/{{ item }}.zip"
state: absent
when: font_check.results[ansible_loop.index0].rc != 0
loop: "{{ nerd_fonts_list }}"
loop_control:
label: "{{ item }}"
extended: true
- name: Update font cache
command: fc-cache -fv