-
Notifications
You must be signed in to change notification settings - Fork 5
/
octopi.yml
389 lines (343 loc) · 13 KB
/
octopi.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
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
---
# Download and install OctoPi from https://github.com/OctoPrint/OctoPi-UpToDate
# On the first Ansible run, use `-K`
- hosts: octopi
vars:
application: octopi
common_user: pi
octopi_mattermost_hook: !vault |
$ANSIBLE_VAULT;1.1;AES256
65646232623931316138666530363335326435386464613864343639313166656164646632386262
3632333334653863373336306635323135313261383630370a373362386265363931376532366331
38353762343166633036663634353138343233393065613031623731333239356335323564626434
3834366538393035620a323461313739393362343962666363356463636561633562306439626631
33636331613032343665353233303662633438356538376565363036393561333731
octodash_api_key: !vault |
$ANSIBLE_VAULT;1.1;AES256
62636163363931333466386636393564353064313264396532303639653461373635376362383136
3437626433333037326563353962363561636138316334330a306537663930346230383235353762
33363133376365346338616633613037616564646331353230323562656439663730636561613534
3833633830626433320a326464323131623732396637353865366264666664396464613436383664
35363835313564623031393563306666303763333330343932653639316537376230633135383135
6230326261396163653438323762353864303933323131333637
handlers:
- name: Reboot
ansible.builtin.reboot:
reboot_timeout: 360
- name: Restart OctoPrint
ansible.builtin.service:
name: octoprint
state: restarted
tasks:
- name: Disable requiretty to enable Ansible pipelining
ansible.builtin.lineinfile:
dest: /etc/sudoers
line: "{{ item.line }}"
state: "{{ item.state }}"
loop:
- line: Defaults requiretty
state: absent
- line: Defaults !requiretty
state: present
vars:
ansible_ssh_pipelining: false
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
cache_valid_time: 600
changed_when: false
- name: Set authorized keys
ansible.posix.authorized_key:
user: "{{ item }}"
state: present
key: https://github.com/calvinbui.keys
comment: github keys
loop:
- root
- "{{ common_user }}"
- name: No password sudo
community.general.sudoers:
name: "{{ common_user }}"
user: "{{ common_user }}"
commands: ALL
nopassword: true
- name: Install apt packages
ansible.builtin.apt:
name:
- neovim
- htop
- iftop
- nano
- tree
- unzip
- ncdu
- curl
- wget
- dnsutils
- git
- avrdude
- python3-yaml
state: present
- name: Remove packages
ansible.builtin.apt:
name:
- popularity-contest
- pastebinit
state: present
- name: Set timezone
community.general.timezone:
name: "{{ common_timezone }}"
- name: Remove git sanity check
ansible.builtin.file:
path: /root/bin/git
state: absent
- name: OctoDash installation and configuration
block:
# https://github.com/UnchartedBull/OctoDash/wiki/Installation#manual-installation
- name: Install OctoDash dependencies
ansible.builtin.apt:
name:
- libgtk-3-0
- libnotify4
- libnss3
- libxss1
- libxtst6
- xdg-utils
- libatspi2.0-0
- libuuid1
- libappindicator3-1
- libsecret-1-0
# packages below needed for starting octodash on boot
- xserver-xorg
- ratpoison
- x11-xserver-utils
- xinit
- libgtk-3-0
- xdotool
- name: Install OctoDash
ansible.builtin.apt:
deb: "https://github.com/UnchartedBull/OctoDash/releases/download/v2.3.1/octodash_2.3.1_armv7l.deb"
notify: Reboot
- name: Enable Console Autologin
ansible.builtin.command: sudo raspi-config nonint do_boot_behaviour B2
become: true
become_user: "{{ common_user }}"
changed_when: false
- name: Create .xinitrc file
ansible.builtin.copy:
content: |
#!/bin/sh
xset s off
xset s noblank
xset -dpms
ratpoison&
octodash
dest: "/home/{{ common_user }}/.xinitrc"
mode: "0755"
owner: "{{ common_user }}"
group: "{{ common_user }}"
- name: Make xinit autostart on boot
ansible.builtin.blockinfile:
block: |
if [ -z "$SSH_CLIENT" ] || [ -z "$SSH_TTY" ]; then
xinit -- -nocursor
fi
path: "/home/{{ common_user }}/.bashrc"
- name: Create OctoDash config directory
ansible.builtin.file:
path: "/home/pi/.config/octodash/"
state: directory
owner: "{{ common_user }}"
group: "{{ common_user }}"
mode: "0700"
- name: Configure OctoDash
ansible.builtin.template:
src: "{{ files_directory }}/octodash/config.json.j2"
dest: "/home/{{ common_user }}/.config/octodash/config.json"
owner: "{{ common_user }}"
group: "{{ common_user }}"
mode: "0740"
notify: Reboot
- name: Rotate X11 for Octodash
ansible.builtin.copy:
content: |
Section "Monitor"
Identifier "DPI-1"
Option "Rotate" "left"
EndSection
dest: "/usr/share/X11/xorg.conf.d/88-dsi-1-rotate.conf"
mode: "0644"
owner: "root"
group: "root"
notify: Reboot
- name: Fix touchscreen input for rotated screen
ansible.builtin.copy:
content: |
Section "InputClass"
Identifier "HyperPixel4 Goodix Capacitive TouchScreen"
MatchProduct "Goodix Capacitive TouchScreen"
Option "CalibrationMatrix" "1 0 0 0 1 0 0 0 1"
Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"
EndSection
dest: "/usr/share/X11/xorg.conf.d/88-hyperpixel4-touch.conf"
mode: "0644"
owner: "root"
group: "root"
notify: Reboot
# see options using `v4l2-ctl --all`
- name: Disable webcam autofocus and set manual focus
ansible.builtin.lineinfile:
path: /etc/rc.local
insertbefore: exit 0
line: "{{ item }}"
loop:
- v4l2-ctl --set-ctrl=focus_automatic_continuous=0
- v4l2-ctl --set-ctrl=focus_absolute=4
# https://github.com/pimoroni/hyperpixel4/issues/177
- name: Enable HyperPixel display
community.general.ini_file:
path: /boot/config.txt
section: null
option: dtoverlay
value: "{{ item }}"
state: present
no_extra_spaces: true
mode: "0755"
exclusive: false
loop:
- vc4-kms-v3d
- vc4-kms-dpi-hyperpixel4,rotate=270
notify: Reboot
- name: Install plugins
ansible.builtin.pip:
name: "{{ item }}"
executable: "/home/{{ common_user }}/oprint/bin/pip"
state: present
become_user: "{{ common_user }}"
become: false
loop:
- https://github.com/TheSpaghettiDetective/OctoPrint-Obico/archive/master.zip
- https://github.com/jneilliii/OctoPrint-OctoDashCompanion/archive/master.zip
- https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/archive/master.zip
- https://github.com/OllisGit/OctoPrint-DisplayLayerProgress/releases/latest/download/master.zip
- https://github.com/marian42/octoprint-preheat/archive/master.zip
- https://github.com/eyal0/OctoPrint-PrintTimeGenius/archive/master.zip
- https://github.com/jneilliii/OctoPrint-PrusaSlicerThumbnails/archive/master.zip
- https://github.com/fraschetti/Octoslack/archive/master.zip
notify: Restart OctoPrint
- name: Check if config is ready for updating
yedit: # noqa fqcn[action]
src: "/home/{{ common_user }}/.octoprint/config.yaml"
key: appearance.color
state: list
register: _octoprint_config_ready
- name: Prompt to go through startup process
ansible.builtin.pause:
prompt: "Go through the setup process https://{{ application }}.{{ common_local_tld }} save the config first"
when: _octoprint_config_ready.result != "black"
- name: Configure OctoPrint
yedit: # noqa fqcn[action]
src: "/home/{{ common_user }}/.octoprint/config.yaml"
key: "{{ item.key }}"
value: "{{ item.value }}"
notify: Restart OctoPrint
loop: "{{ _octoprint_config | dict2items }}"
vars:
_octoprint_config:
api.allowCrossOrigin: true
appearance:
color: black
defaultLanguage: en
fuzzyTimes: false
showInternalFilename: false
feature:
modelSizeDetection: false
sdSupport: false
plugins.DisplayLayerProgress:
showAllPrinterMessages: false
showOnBrowserTitle: false
showOnNavBar: false
plugins.Octoslack.channel: 3d-printing
plugins.Octoslack.connection_method: WEBHOOK
plugins.Octoslack.include_raspi_temp: false
plugins.Octoslack.mattermost_compatability_mode: true
plugins.Octoslack.minio_config:
AccessKey: XqmnkyiQ0sy9uhMRFlQw
Bucket: octoprint
Endpoint: minio.{{ common_tld }}
SecretKey: !vault |
$ANSIBLE_VAULT;1.1;AES256
35333065386639356632386239343435316237323832373630393464326530623235653264323634
3338626336656138663832616363653162636538613161390a373035653262366231616534613630
61613537646438643232643764623564666533316135623132663262383866353930626463353138
3465346465333363620a343331303438313465636639643561653063336664633564343637353035
62623834303638656163656466353937623131386430333364626265393830333736643866663230
6435653836653161626362383063396364343138653762613134
plugins.Octoslack.slack_webhook_config.webhook_url: "https://mattermost.{{ common_tld }}/hooks/{{ octopi_mattermost_hook }}"
plugins.Octoslack.snapshot_upload_method: MINIO
plugins.Octoslack.supported_events.PrintStarted.Enabled: false
plugins.Octoslack.supported_events.PrintFailed.Enabled: false
plugins.Octoslack.supported_events.PrintCancelling.Enabled: false
plugins.Octoslack.supported_events.PrintCancelled.Enabled: false
plugins.Octoslack.supported_events.PrintPaused.Enabled: false
plugins.Octoslack.supported_events.PrintResumed.Enabled: false
plugins.Octoslack.supported_events.Error.Enabled: true
plugins.Octoslack.supported_events.PrintDone.Enabled: true
plugins.Octoslack.supported_events.PrintDone.CaptureSnapshot: true
plugins._disabled:
- tracking
- logging
- virtual_printer
plugins.announcements.enabled_channels:
- _important
- _releases
plugins.tplinksmartplug.arrSmartplugs:
- autoConnect: true
autoConnectDelay: 10
autoDisconnect: true
autoDisconnectDelay: 0
automaticShutdownEnabled: true
btnColor: '#808080'
countdownOffDelay: 1
countdownOnDelay: '0'
currentState: 'off'
displayWarning: false
emeter:
get_realtime: {}
event_on_disconnect: false
event_on_error: false
event_on_shutdown: false
event_on_startup: false
event_on_upload: false
gcodeCmdOff: false
gcodeCmdOn: false
gcodeEnabled: false
gcodeOffDelay: 0
gcodeOnDelay: 0
gcodeRunCmdOff: ''
gcodeRunCmdOn: ''
icon: icon-print
ip: 192.168.3.23/3
label: Printer & Lights
sysCmdOff: false
sysCmdOffDelay: 0
sysCmdOn: false
sysCmdOnDelay: 0
sysRunCmdOff: ''
sysRunCmdOn: ''
thermal_runaway: false
useCountdownRules: true
warnPrinting: true
plugins.tplinksmartplug.idleTimeout: '15'
plugins.tplinksmartplug.powerOffWhenIdle: true
plugins.tracking.enabled: false
server.onlineCheck.enabled: false
server.pluginBlacklist.enabled: false
temperature.profiles:
- bed: 85
extruder: 230
name: PETG
- bed: 60
extruder: 210
name: PLA
webcam.timelapseEnabled: false