-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yml
213 lines (179 loc) · 5.54 KB
/
playbook.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
---
- name: Install base packages via apt and flatpak
tags: [pkgs, base, apt]
hosts: all
tasks:
- name: Stop packagekit
service:
name: packagekit
state: stopped
- name: Update all packages to their latest version
become: true
apt:
name: "*"
state: latest
update_cache: true
- name: Add third-party repositories (ppa)
become: true
apt_repository:
repo: "{{ item.repo }}"
codename: "{{ item.codename }}"
update_cache: true
loop: "{{ ppa }}"
- name: Add third-party repository keys (non-ppa)
tags: [repos]
become: true
apt_key:
url: "{{ item.key_location }}"
state: present
loop: "{{ non_ppa }}"
- name: Add third-party repositories (non-ppa)
tags: [repos]
become: true
apt_repository:
repo: "{{ item.repo }}"
state: present
filename: "{{ item.filename }}"
update_cache: true
loop: "{{ non_ppa }}"
- name: Install packages
become: true
apt:
state: present
update_cache: true
pkg: "{{ pkgs_to_install }}"
- name: Remove unnecessary packages
become: true
apt:
state: absent
purge: true
update_cache: true
pkg: "{{ pkgs_to_remove }}"
- name: Install flatpacks from flathub.org
tags: [flatpak]
shell: flatpak install -y --noninteractive flathub {{ item }}
loop: "{{ flatpaks }}"
- name: Remove useless packages from the cache
become: true
apt:
autoclean: true
- name: Remove dependencies that are no longer required
become: true
apt:
autoremove: true
- name: Configure syncthing
tags: [syncthing]
hosts: all
tasks:
- name: Copy syncthing user service to systemd directory
become: true
copy:
src: "{{ playbook_dir }}/files/syncthing/service"
dest: "/etc/systemd/user/syncthing.service"
- name: Enable syncthing user service
service:
name: syncthing
enabled: true
state: started
scope: user
- name: Install Mullvad VPN
tags: [mullvad, vpn]
hosts: all
tasks:
- name: Get Mullvad VPN Signing Key
shell: "wget https://mullvad.net/media/mullvad-code-signing.asc -O /tmp/mullvad-code-signing.asc"
- name: Get Mullvad VPN Signing Key
shell: "gpg2 --import /tmp/mullvad-code-signing.asc"
- name: Get Mullvad VPN client
get_url:
url: "https://mullvad.net/download/app/deb/latest"
dest: "{{ ansible_env.HOME }}/Downloads"
- name: Get Mullvad VPN client signing key
get_url:
url: "https://mullvad.net/download/app/deb/latest/signature"
dest: "{{ ansible_env.HOME }}/Downloads"
- name: Get Mullvad VPN Signing Key
shell: "gpg2 --verify {{ ansible_env.HOME }}/Downloads/MullvadVPN-*.asc"
- name: Install Mullvad VPN client
become: true
shell: "yes | dpkg -i {{ ansible_env.HOME }}/Downloads/Mullvad*.deb"
- name: Set Mullvad VPN account key
become: true
shell: "mullvad account set {{ mullvad_account_number }}"
- name: Install and set up fish shell
tags: [fish, shell]
hosts: all
tasks:
- name: Symlink relevant config files to playbook-workstation
file:
src: "{{ playbook_dir }}/files/fish/{{ item.fname }}"
dest: "{{ ansible_env.HOME }}/{{ item.fpath }}/{{ item.fname }}"
state: link
force: true
loop:
- fname: config.fish
fpath: .config/fish
- name: Change user shell to /usr/bin/fish
become: true
user:
name: "{{ ansible_env.USER }}"
shell: /usr/bin/fish
- name: Download starship release
get_url:
url: "{{ starship_url }}"
dest: /tmp/starship.tar.gz
sha256sum: "{{ starship_sha256sum }}"
- name: Extract starship binary
unarchive:
src: /tmp/starship.tar.gz
dest: "{{ ansible_env.HOME }}/.local/bin"
- name: Download fisher init script
get_url:
url: "https://raw.githubusercontent.com/jorgebucaran/fisher/HEAD/functions/fisher.fish"
dest: /tmp/fisher.fish
- name: Install fisher
shell: "fish -c 'source /tmp/fisher.fish && fisher install jorgebucaran/fisher'"
- name: Install plugins via fisher
shell: "fish -c 'fisher install {{ item }}'"
loop: "{{ fisher_plugins }}"
- name: Setup (Doom) Emacs
tags: [emacs, doom, editor]
hosts: all
tasks:
- name: Sync fonts
unarchive:
src: "{{ playbook_dir }}/files/fonts/{{ item }}"
dest: "{{ ansible_env.HOME }}/.local/share/fonts"
loop:
- "Rubik.tar.xz"
- "Iosevka.tar.xz"
- name: Refresh fonts cache
tags: [fonts]
shell: "fish -c 'fc-cache -f -v'"
- name: Clone Doom Emacs
git:
repo: "https://github.com/hlissner/doom-emacs.git"
dest: "~/.emacs.d"
force: true
depth: 1
- name: Clone private Doom Emacs configuration
git:
repo: "https://git.sr.ht/~linozen/doom"
dest: "~/.doom.d"
force: true
depth: 1
- name: Run 'doom install'
shell: "fish -c 'yes | doom install'"
- name: Run 'doom sync'
shell: "fish -c 'yes | doom sync'"
- name: Copy Emacs service to systemd directory
become: true
copy:
src: "{{ playbook_dir }}/files/emacs/service"
dest: "/etc/systemd/user/emacs.service"
- name: Enable Emacs service
service:
name: emacs
enabled: true
state: started
scope: user