-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathinstall.yml
300 lines (264 loc) · 10.2 KB
/
install.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
- name: Install packages and binaries for el9 and Fedora
hosts: localhost
vars:
user_programs: /usr/local/bin
el9_packages:
- ImageMagick
- bat
- blender
- borgbackup
- ffmpeg
- gcc-c++
- gh
- gnome-tweaks
- gthumb
- inotify-tools
- keepassxc
- kitty
- lazygit
- mediainfo
- nnn
- nodejs
- optipng
- pandoc
- ripgrep
- shellcheck
- stow
- thunderbird
- tldr
- transmission
- trash-cli
- xclip
- xdg-desktop-portal-gnome
- yt-dlp
- zathura
- zathura-bash-completion
flatpak_packages:
- com.obsproject.Studio
- com.obsproject.Studio.Plugin.MoveTransition
- fr.handbrake.ghb
- org.bunkus.mkvtoolnix-gui
- org.kde.krita
- org.signal.Signal
- com.github.tchx84.Flatseal
- io.mpv.Mpv
npm_packages:
tasks:
# =========================================================================
# Add and enable repositories
# =========================================================================
- name: Add the GitHub CLI repository
become: true
ansible.builtin.command:
cmd: dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
args:
creates: /etc/yum.repos.d/gh-cli.repo
- name: Add the Flathub repository
community.general.flatpak_remote:
name: flathub
flatpakrepo_url: https://flathub.org/repo/flathub.flatpakrepo
state: present
- name: Add el9 only repositories
become: true
when: ansible_facts.distribution != "Fedora"
block:
- name: Enable the el9 CodeReady Linux Builder repository
ansible.builtin.command: dnf config-manager --enable crb
args:
creates: /etc/yum.repos.d/*-crb.repo
- name: Add the Extra Packages for Enterprise Linux repository
ansible.builtin.dnf:
name:
epel-release
state: present
- name: Add the el9 Lazygit repository
community.general.copr:
name: atim/lazygit
chroot: "epel-9-{{ ansible_architecture }}"
- name: Add the el9 RPM Fusion repository
ansible.builtin.dnf:
name: "{{ item }}"
state: present
disable_gpg_check: true
loop:
- https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-{{ ansible_distribution_major_version }}.noarch.rpm
- https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-{{ ansible_distribution_major_version }}.noarch.rpm
- name: Add Fedora only repositories
become: true
when: ansible_facts.distribution == "Fedora"
block:
- name: Add the Fedora Lazygit repository
community.general.copr:
name: atim/lazygit
chroot: "fedora-{{ ansible_distribution_version }}-{{ ansible_architecture }}"
- name: Add Fedora RPM Fusion repository
ansible.builtin.dnf:
name: "{{ item }}"
state: present
disable_gpg_check: true
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
- name: Switch to full FFmpeg
ansible.builtin.shell: sudo dnf -y swap ffmpeg-free ffmpeg --allowerasing
# =========================================================================
# Remove packages
# =========================================================================
- name: Remove unwanted desktop apps
become: true
ansible.builtin.dnf:
name:
- cheese
- gedit
- rhythmbox
- totem
state: absent
# =========================================================================
# Install packages
# =========================================================================
- name: Upgrade all packages
become: true
ansible.builtin.dnf:
name: "*"
state: latest # noqa package-latest
- name: Install el9 packages
become: true
ansible.builtin.dnf:
name: "{{ el9_packages }}"
state: present
- name: Install Flatpak packages
community.general.flatpak:
name: "{{ flatpak_packages }}"
state: present
- name: Install NPM global packages
become: true
loop: "{{ npm_packages }}"
community.general.npm:
name: "{{ item }}"
state: present
global: true
# =========================================================================
# Install binaries
# =========================================================================
- name: Check packages
ansible.builtin.package_facts:
manager: auto
# nnn plugins
- name: Download the latest nnn plugins
when: "'nnn' in ansible_facts.packages"
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs
dest: /tmp/getplugs
mode: '0755'
- name: Install nnn plugins
when: "'nnn' in ansible_facts.packages"
ansible.builtin.command: /tmp/getplugs
args:
creates: "{{ lookup('env', 'HOME') }}/.config/nnn/plugins"
# Fonts
- name: Create ~/.local/share/fonts directory
ansible.builtin.file:
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.local/share/fonts"
state: directory
- name: Copy nerd fonts symbols only
ansible.builtin.copy:
src: "{{ playbook_dir }}/extras/SymbolsNerdFontMono-Regular.ttf"
dest: "{{ lookup('ansible.builtin.env', 'HOME') }}/.local/share/fonts/SymbolsNerdFontMono-Regular.ttf"
- name: Refresh font cache
ansible.builtin.command: fc-cache -vf
changed_when: false
# GitHub binaries
- name: Download and install GitHub binaries
become: true
block:
- name: Download and install Marksman language server
ansible.builtin.get_url:
url: https://github.com/artempyanykh/marksman/releases/download/2023-07-01/marksman-linux-x64
dest: "{{ user_programs }}/marksman"
mode: '0755'
- name: Download and install shfmt
ansible.builtin.get_url:
url: https://github.com/patrickvane/shfmt/releases/download/master/shfmt_linux_amd64
dest: "{{ user_programs }}/shfmt"
mode: '0755'
- name: Download and install delta
ansible.builtin.unarchive:
src: https://github.com/dandavison/delta/releases/download/0.15.1/delta-0.15.1-x86_64-unknown-linux-musl.tar.gz
dest: "{{ user_programs }}"
remote_src: true
extra_opts:
- "--strip-components=1"
- "delta-0.15.1-x86_64-unknown-linux-musl/delta"
- name: Download and install ltex-ls
ansible.builtin.unarchive:
src: https://github.com/valentjn/ltex-ls/releases/download/16.0.0/ltex-ls-16.0.0.tar.gz
dest: "{{ user_programs }}"
remote_src: true
extra_opts:
- "--strip-components=1"
- "ltex-ls-16.0.0/bin"
- "ltex-ls-16.0.0/lib"
- name: Create symlink to ltex-ls binary
ansible.builtin.file:
src: "{{ user_programs }}/bin/ltex-ls"
dest: "{{ user_programs }}/ltex-ls"
state: link
- name: Download and install vale
ansible.builtin.unarchive:
src: https://github.com/errata-ai/vale/releases/download/v2.27.0/vale_2.27.0_Linux_64-bit.tar.gz
dest: "{{ user_programs }}"
remote_src: true
include: vale
- name: Download and install tt
ansible.builtin.get_url:
url: https://github.com/lemnos/tt/releases/download/v0.4.2/tt-linux
dest: "{{ user_programs }}/tt"
mode: '0755'
- name: Download and install tt man page
ansible.builtin.get_url:
url: https://github.com/lemnos/tt/releases/download/v0.4.2/tt.1.gz
dest: /usr/share/man/man1/tt.1.gz
# =========================================================================
# Stow dotfiles
# =========================================================================
# Stow * Stow will fail if you have run kitty or lazygit in advance as they both create non link config files on first run
- name: Create ~/.dotfile directory
ansible.builtin.file:
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.dotfiles"
state: directory
- name: Copy dotfiles
ansible.builtin.copy:
src: "{{ playbook_dir }}/dotfiles/"
dest: "{{ lookup('ansible.builtin.env', 'HOME') }}/.dotfiles/"
- name: Stat ./bashrc to later check if it is a link
ansible.builtin.stat:
path: "{{ ansible_env.HOME }}/.bashrc"
register: link
- name: Backup and remove files
when: link.stat.islnk is defined and link.stat.islnk == False
block:
- name: Backup .bashrc
ansible.builtin.copy:
src: "{{ ansible_env.HOME }}/.bashrc"
dest: "{{ ansible_env.HOME }}/.bashrc_backup"
- name: Backup .bash_profile
ansible.builtin.copy:
src: "{{ ansible_env.HOME }}/.bash_profile"
dest: "{{ ansible_env.HOME }}/.bash_profile_backup"
- name: Delete original files to prevent stow errors
ansible.builtin.file:
path: '{{ item }}'
state: absent
with_items:
- "{{ ansible_env.HOME }}/.bashrc"
- "{{ ansible_env.HOME }}/.bash_profile"
- name: Run stow
ansible.builtin.command: "stow --dir={{ ansible_env.HOME }}/.dotfiles --target {{ ansible_env.HOME }} autostart helix mpv pandoc kitty shell lazygit --verbose=2"
register: result
changed_when: 'result.stderr is search("LINK: ")'