-
Notifications
You must be signed in to change notification settings - Fork 5
/
provision.yml
308 lines (264 loc) · 8.59 KB
/
provision.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
- hosts: localhost
connection: local
tasks:
- name: Save username
shell: whoami
register: username
- hosts: localhost
connection: local
become: true
tasks:
- name: Add Opera repository
yum_repository:
name: opera
description: Opera YUM Repo
baseurl: https://rpm.opera.com/rpm
gpgcheck: yes
gpgkey: https://rpm.opera.com/rpmrepo.key
- name: Add VSCode repository
yum_repository:
name: vscode
description: VSCode YUM Repo
baseurl: https://packages.microsoft.com/yumrepos/vscode
gpgcheck: yes
gpgkey: https://packages.microsoft.com/keys/microsoft.asc
- name: Add 1Password repository
yum_repository:
name: 1Password
description: 1Password YUM Repo
baseurl: https://downloads.1password.com/linux/rpm/beta/x86_64
gpgcheck: yes
gpgkey: https://downloads.1password.com/linux/keys/1password.asc
- name: Install dnf plugins
dnf:
name: dnf-plugins-core
update_cache: yes
state: present
- name: No idea how to do this the proper way
command: dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
- name: Enable rpmfusion repos
dnf:
name: "{{ item }}"
state: present
disable_gpg_check: yes
with_items:
- "https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-{{ansible_distribution_major_version}}.noarch.rpm"
- "https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-{{ansible_distribution_major_version}}.noarch.rpm"
- name: Install applications
dnf:
name: ["chromium", "opera-stable", "emacs", "screen", "vim-enhanced", "gnome-tweak-tool", "htop", "transmission", "code", "fbreader", "vlc", "texlive-latex", "texlive-collection-mathextra", "texlive-scheme-medium", "texlive-grffile", "texlive-wrapfig", "texlive-ulem", "texlive-amsmath", "1password"]
update_cache: yes
state: present
- name: Install language tools
dnf:
name: ["golang-bin", "rust", "cargo", "nodejs", "python3-devel"]
update_cache: yes
state: present
- name: Install dev tools
dnf:
name: ["docker", "python3-virtualenv", "python3-virtualenvwrapper", "libpq-devel", "@development-tools", "autoconf", "openssl", "openssl-devel", "postgresql", "libpng-devel", "freetype-devel", "ffmpeg", "openvpn", "libtool", "cmake", "unrar", "vagrant", "ibm-plex-mono-fonts", "terraform"]
update_cache: yes
state: present
# The following section is only if you want to replace the red hat
# implementation of containerd with docker. If you don't want to do so, just
# delete it.
- hosts: localhost
connection: local
become: true
tasks:
- name: Enable experimental docker features
copy:
src: files/daemon.json
dest: "/etc/docker/daemon.json"
- name: Enable and start docker service
systemd:
name: docker
enabled: yes
state: started
- name: Create docker group
group:
name: "docker"
state: present
- name: Add user to group
user:
name: "{{ username.stdout }}"
groups: docker
append: yes
- ansible.posix.firewalld:
zone: trusted
interface: docker0
permanent: yes
state: enabled
- ansible.posix.firewalld:
zone: FedoraWorkstation
permanent: yes
state: enabled
masquerade: yes
- hosts: localhost
connection: local
tasks:
- name: Ensure .ssh directory exists.
file:
dest: "~/.ssh"
mode: 0700
owner: "{{ ansible_user_id }}"
state: directory
- name: Install private ssh key
copy:
src: files/id_rsa.vault
dest: "~/.ssh/id_rsa"
decrypt: yes
mode: 0600
owner: "{{ ansible_user_id }}"
- name: Install work ssh key
copy:
src: files/id_rsa_work.vault
dest: "~/.ssh/id_rsa_work"
decrypt: yes
mode: 0600
owner: "{{ ansible_user_id }}"
- name: Copy public keys
copy:
src: "files/{{ item }}"
dest: "~/.ssh/{{ item }}"
decrypt: yes
mode: 0600
owner: "{{ ansible_user_id }}"
with_items:
- id_rsa.pub
- id_rsa_work.pub
- name: Create some directories
file:
path: "~/{{ item }}"
state: directory
with_items:
- work
- projects
- code
- ".aws"
- name: Copy aws config
copy:
src: "files/aws-{{ item }}.vault"
dest: "~/.aws/{{ item }}"
decrypt: yes
mode: 0600
owner: "{{ ansible_user_id }}"
with_items:
- config
- credentials
# Replace with repos for work
- name: Check out work repos
git:
repo: "{{ item.repo }}"
dest: "~/work/{{ item.directory }}"
accept_hostkey: yes
ignore_errors: yes
with_items:
- { repo: "[email protected]:work-company/product.git", directory: "product" }
- { repo: "[email protected]:work-company/tooling.git", directory: "tooling" }
# Remove if you don't use Emacs
- name: Check out .emacs.d
git:
repo: "[email protected]:afroisalreadyinu/emacsd.git"
dest: "~/.emacs.d"
ignore_errors: yes
# Replace with your personal project repos
- name: Check out project repos
git:
repo: "{{ item.repo }}"
dest: "~/projects/{{ item.directory }}"
accept_hostkey: yes
ignore_errors: yes
with_items:
- { repo: "[email protected]:afroisalreadyinu/abl-mode.git", directory: "abl-mode" }
- { repo: "[email protected]:afroisalreadyinu/miniboss.git", directory: "miniboss" }
# Example for configuration files
- name: Copy screen config
copy:
src: files/screenrc.txt
dest: "~/.screenrc"
# Example for installing from code; this will be compiled and installed later
- name: Clone vcprompt
git:
repo: "https://github.com/powerman/vcprompt"
dest: "~/code/vcprompt"
accept_hostkey: yes
- name: Checkout emacs-vterm
git:
repo: "[email protected]:akermu/emacs-libvterm.git"
dest: "~/code/emacs-libvterm"
accept_hostkey: yes
- name: Create build directory
file:
path: "~code/emacs-libvterm/build"
state: directory
- name: Build vterm
command: "cmake ../ && make"
args:
creates: "~/code/emacs-libvterm/vterm-module.so"
- name: Add the flathub flatpak repository remote to the user installation
community.general.flatpak_remote:
name: flathub
state: present
flatpakrepo_url: https://flathub.org/repo/flathub.flatpakrepo
method: user
- name: Install software from flatpak
community.general.flatpak:
name: "{{ item }}"
state: present
method: user
with_items:
- org.signal.Signal
- us.zoom.Zoom
- com.spotify.Client
- name: Remap capslock to escape
community.general.dconf:
key: "/org/gnome/desktop/input-sources/xkb-options"
value: "['caps:escape']"
state: present
- name: Remove super-s keybinding
community.general.dconf:
key: "/org/gnome/shell/keybindings/toggle-overview"
value: "@as []"
state: present
- name: Install cargo packages
command: "cargo install tealdeer hyperfine rates"
args:
creates: "/home/{{ username.stdout }}/.cargo/bin/tldr"
- name: Install goimports
command: go get golang.org/x/tools/cmd/goimports
args:
creates:
- "/home/{{ username.stdout }}/go/bin/goimports"
# Replace Your Username with your username
- name: Configure git username
community.general.git_config:
name: user.name
scope: global
value: Your Username
# Replace your@email with your email
- name: Configure git email
community.general.git_config:
name: user.email
scope: global
value: your@email
# Remove if you want to keep nano
- name: Configure git editor
community.general.git_config:
name: core.editor
scope: global
value: vim
- hosts: localhost
connection: local
become: true
tasks:
# Example for compiling and installing from code
- name: Install vcprompt
command: "{{ item }}"
args:
chdir: "/home/{{ username.stdout }}/code/vcprompt"
creates: "/usr/local/bin/vcprompt"
with_items:
- "autoconf"
- "./configure"
- "make install"