-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook.yaml
770 lines (721 loc) · 28.8 KB
/
playbook.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
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
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
---
# List of plays
-
# Hosts: where our play will run and options it will run with
hosts: localhost
connection: local
gather_facts: yes
tags: always
# Vars: variables that will apply to the play, on all targets
# Tasks: the list of tasks that will be executed within
# the play, this section can also be used for
# pre and post tasks
tasks:
# from https://superuser.com/questions/1395954/ansible-playbook-to-determine-os-release
- name: System details
debug: msg="{{ item }}"
with_items:
- "{{ ansible_distribution }}"
- "{{ ansible_distribution_version }}"
- "{{ ansible_distribution_major_version }}"
- name: Verify install_files is present
debug: msg="install_files/_README = {{ lookup('file', '/home/kasm-default-profile/install_files/_README') }}"
# Detect if we are running on a WSL2 environment
- name: Set wsl2_environment fact default to false
set_fact:
wsl2_environment: false
- name: Set wsl2_environment fact True
set_fact:
wsl2_environment: true
when: ansible_kernel is search("microsoft-standard-WSL2")
# fix for .gnupg/ permissions when building custom images
- name: Add fix for .gnupg/ permissions
lineinfile:
path: "/etc/bash.bashrc"
line: "chmod 700 ~/.gnupg/"
- name: Add custom prompt to /etc/skel/.profile
lineinfile:
path: "/etc/skel/.profile"
line: 'export PS1="\[\033[00;32m\][\w]\$\[\033[00m\] "'
# Handlers: the list of handlers that are executed as a notify
# key from a task
# Roles: list of roles to be imported into the play
roles:
- role: irixjp.role_example_hello
# Add additional plays here (remember the list entry -)
# Be sure to use the same hosts and connection entries above
# addtional plays
-
# Install build-essential
hosts: localhost
connection: local
tags:
- install_doctools
- install_plantuml
- install_avr_build_tools
- install_oshw_tools
tasks:
- name: Install build-essential
apt:
name: build-essential
update_cache: yes
#-
# # Install zlib
# hosts: localhost
# connection: local
# tags:
# - install_doctools
# - install_plantuml
#
# tasks:
# - name: Extract zlib v1.2.13 source from tarball
# unarchive:
# src: /home/kasm-default-profile/install_files/zlib-1.2.13.tar.gz
# dest: /home/kasm-default-profile/install_files
# remote_src: yes
# creates: /home/kasm-default-profile/install_files/zlib-1.2.13/README
# - name: Build zlib v1.2.13
# shell:
# cmd: ./configure && make > /tmp/zlib_build_output.txt 2>&1 && make install
# chdir: /home/kasm-default-profile/install_files/zlib-1.2.13/
# executable: /bin/bash
-
# Install OpenSSL
hosts: localhost
connection: local
gather_facts: yes
tags:
- install_avr_build_tools
- install_oshw_tools
- install_doctools
- install_utilities
tasks:
- name: Install libssl-dev
apt:
name: libssl-dev
update_cache: yes
#-
# # Install doctools
# hosts: localhost
# connection: local
# tags: install_doctools
#
# vars:
# pandoc_version: "2.18"
# texlive_version: "2021.20220204-1"
# texlive_version_expected: "pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2022/dev/Debian)"
# asciidoctor_version: 2.0.17
# asciidoctor_version_expected: "{{ asciidoctor_version }}[.]"
#
# tasks:
# - name: Install Ruby
# apt:
# name: ruby-full
# update_cache: yes
# - name: Join parts of jabref tarball
# shell: cat /home/kasm-default-profile/install_files/jabref_5.6-1_amd64.deb.part* > /home/kasm-default-profile/install_files/jabref_5.6-1_amd64.deb
# - name: install jabref from deb
# apt:
# deb: /home/kasm-default-profile/install_files/jabref_5.6-1_amd64.deb
# update_cache: yes
# - name: Run gem install for asciidoctor
# shell:
# cmd: "gem install asciidoctor -v {{ asciidoctor_version }}"
# - name: install asciidoctor-bibtex as ruby gem
# shell: gem install asciidoctor-bibtex
# - name: install asciidoctor-diagram as ruby gem
# shell: gem install asciidoctor-diagram
# - name: install asciidoctor-pdf as ruby gem
# shell: gem install asciidoctor-pdf
# - name: install asciidoctor-revealjs as ruby gem
# shell: gem install asciidoctor-revealjs
# - name: install TeX Live
# apt:
# name: "texlive-full={{ texlive_version }}"
# update_cache: yes
# # https://mikefarah.gitbook.io/yq/
# - name: Install yq
# copy:
# src: /home/kasm-default-profile/install_files/yq
# dest: /usr/bin/yq
# remote_src: yes
# owner: root
# group: root
# mode: '0755'
# - name: Install pandoc-citeproc
# apt:
# name: pandoc-citeproc
# update_cache: yes
# - name: Get pandoc version
# shell: pandoc --version | grep -m 1 -i pandoc | sed 's/[[:alpha:]|(|[:space:]]//g'
# register: installed_pandoc_version
# - name: Get TeX Live version
# shell: latex --version | grep -i Tex -m 1
# register: installed_texlive_version
# - name: Display pandoc and texlive versions
# debug:
# msg: "pandoc = {{ installed_pandoc_version.stdout }} | texlive = {{ installed_texlive_version.stdout }}"
# - name: Test pandoc version
# fail:
# msg: "Pandoc Version Error: Expected {{ pandoc_version }} | Found {{ installed_pandoc_version.stdout }}"
# when: installed_pandoc_version.stdout != pandoc_version
# - name: Test texlive version
# fail:
# msg: "TeX Live Version Error: Expected {{ texlive_version_expected }} | Found {{ installed_texlive_version.stdout }}"
# when: installed_texlive_version.stdout != texlive_version_expected
# - name: Get asciidoctor version
# shell: asciidoctor --version | grep Asciidoctor | sed 's/[[:alpha:]|(|[:space:]]//g' | sed 's/[*~://]//g'
# register: installed_asciidoctor_version
# - name: Display asciidoctor version
# debug:
# msg: "ASCII Doctor = {{ installed_asciidoctor_version.stdout }}"
# - name: Test asciidoctor version
# fail:
# msg: "ASCII Doctor Version Error: Expected {{ asciidoctor_version_expected }} | Found {{ installed_asciidoctor_version.stdout }}"
# when: installed_asciidoctor_version.stdout != asciidoctor_version_expected
#
# roles:
# - role: andrewrothstein.pandoc
# pandoc_ver: "{{ pandoc_version }}"
#-
# # install PlantUML
# hosts: localhost
# connection: local
# gather_facts: yes
# tags:
# - install_plantuml
# - install_doctools
#
# vars:
# jdk_version: 2:1.11-72build2
# graphviz_version_expected: "dot - graphviz version 2.50.0 (20211204.2007)"
#
# tasks:
# - name: Install JDK
# apt:
# name: "default-jdk={{ jdk_version }}"
# update_cache: yes
# - name: Get JDK Version
# shell: java --version | grep -m 1 -i openjdk
# register: installed_jdk_version
# - name: Install pre-reqs to build graphviz
# apt:
# name: libcairo2-dev, libexpat-dev, libfreetype-dev, libgd-dev, fontconfig-config, libglib2.0-dev, libgtk2.0-dev, libpng-dev, libsdl-pango-dev, libgts-bin, libgtk-3-dev, libgtkglext1-dev, glade, freeglut3-dev, autoconf, automake, bison, flex, ghostscript, libtool, pkg-config, swig
# update_cache: yes
# - name: Expand source files archive
# unarchive:
# src: /home/kasm-default-profile/install_files/graphviz-2.50.0.tar.gz
# dest: /home/kasm-default-profile/install_files/
# remote_src: yes
# creates: /home/kasm-default-profile/install_files/graphviz-2.50.0/README
# - name: Build graphviz
# shell:
# cmd: ./configure --enable-perl=no && make > /tmp/graphviz_build_output.txt 2>&1 && make install
# chdir: /home/kasm-default-profile/install_files/graphviz-2.50.0/
# executable: /bin/bash
# - name: Get graphviz version
# shell: dot -V
# register: installed_graphviz_version
# - name: install plantuml
# copy:
# src: /home/kasm-default-profile/install_files/plantuml.jar
# dest: /usr/local/bin/plantuml.jar
# remote_src: yes
# - name: Display JDK and GraphViz versions
# debug:
# msg: "JDK = {{ installed_jdk_version.stdout }} | graphviz = {{ installed_graphviz_version.stderr }}"
# - name: Test Graphviz version
# fail:
# msg: "Graphviz Version Error: Expected {{ graphviz_version_expected }} | Found {{ installed_graphviz_version.stderr }}"
# when: installed_graphviz_version.stderr != graphviz_version_expected
-
# install PrusaSlicer
hosts: localhost
connection: local
gather_facts: yes
tags:
- install_oshw_tools
- install_prusaslicer
vars:
prusaslicer_version: 2.7.1
prusaslicer_release_date: 202312121425
prusaslicer_dir: "PrusaSlicer-{{ prusaslicer_version }}+linux-x64-GTK3-{{ prusaslicer_release_date }}"
tasks:
- name: Join parts of PrusaSlicer tarball
shell: cat /home/kasm-default-profile/install_files/{{ prusaslicer_dir }}.tar.bz2.parta* > /home/kasm-default-profile/install_files/{{ prusaslicer_dir }}.tar.bz2
- name: Extract PrusaSlicer for 64-bit Linux to /opt
unarchive:
src: /home/kasm-default-profile/install_files/{{ prusaslicer_dir }}.tar.bz2
dest: /opt
remote_src: yes
creates: /opt/{{ prusaslicer_dir }}/bin/prusa-slicer
- name: Create symlink for prusa-slicer in /usr/local/bin
shell: ln -srv /opt/{{ prusaslicer_dir }}/bin/prusa-slicer /usr/local/bin/prusa-slicer
- name: Configure PrusaSlicer desktop shortcut
shell: echo "[Desktop Entry]\nName=PrusaSlicer\nGenericName=PrusaSlicer\nExec=/usr/local/bin/prusa-slicer\nIcon=/opt/{{ prusaslicer_dir }}/resources/icons/PrusaSlicer.png\nTerminal=false\nType=Application\nStartupNotify=false\nCategories=Application;Development;" > /usr/share/applications/prusaslicer.desktop
- name: Get prusa-slicer version
shell: prusa-slicer --help | grep PrusaSlicer- | awk '{ print $1 '}
register: installed_prusaslicer_version
- name: Display prusa-slicer version
debug:
msg: "prusa-slicer = {{ installed_prusaslicer_version.stdout }}"
- name: Test prusa-slicer version
fail:
msg: "prusa-slicer Error: Expected {{ prusaslicer_dir }} | Found {{ installed_prusaslicer_version.stdout }}"
when: installed_prusaslicer_version.stdout != prusaslicer_dir
-
# install NodeJs
hosts: localhost
connection: local
gather_facts: yes
tags:
- install_doctools
vars:
node_version: "16.14.0"
v_node_version: "v{{ node_version }}"
npm_version: "8.3.1"
npx_version: "8.3.1"
yarn_version: "1.22.11"
yo_version: "4.3.0"
generator_code_version: "1.6.7"
tasks: # Test Node JS Tools versions
- name: Get node version
shell: node --version
register: installed_node_version
- name: Get npm version
shell: npm --version
register: installed_npm_version
- name: Get npx installed version
shell: npx --version
register: installed_npx_version
- name: Get yarn version
shell: yarn --version
register: installed_yarn_version
- name: Display node tool versions
debug:
msg: "Node = {{ installed_node_version.stdout }} | npm = {{ installed_npm_version.stdout }} | npx = {{ installed_npx_version.stdout }} | yarn = {{ installed_yarn_version.stdout }}"
- name: Test node version
fail:
msg: "NodeJS Version Error: Expected {{ v_node_version }} | Found {{ installed_node_version.stdout }}"
when: installed_node_version.stdout != v_node_version
- name: Test npm version
fail:
msg: "NPM Version Error: Expected {{ npm_version }} | Found {{ installed_npm_version.stdout }}"
when: installed_npm_version.stdout != npm_version
- name: Test npx version
fail:
msg: "NPX Version Error: Expected {{ npx_version }} | Found {{ installed_npx_version.stdout }}"
when: installed_npx_version.stdout != npx_version
- name: Test yarn version
fail:
msg: "Yarn Version Error: Expected {{ yarn_version }} | Found {{ installed_yarn_version.stdout }}"
when: installed_yarn_version.stdout != yarn_version
roles:
- role: grzegorznowak.nvm_node
nvm_install_script_version: "0.39.1"
nvm_node_version: "{{ node_version }}"
nvm_install_globally:
- name: yarn
version: "{{ yarn_version }}"
- name: yo
version: "{{ yo_version }}"
- name: generator-code
version: "{{ generator_code_version }}"
-
# install Hugo (extended)
hosts: localhost
connection: local
gather_facts: yes
vars:
hugo_version: "0.101.0"
tasks:
- name: Download Hugo {{ hugo_version }} (extended) tarball
shell: wget https://github.com/gohugoio/hugo/releases/download/v{{ hugo_version }}/hugo_extended_{{ hugo_version }}_Linux-64bit.tar.gz -O /home/kasm-default-profile/hugo_extended_{{ hugo_version }}_Linux-64bit.tar.gz
- name: Create temp directory for extracting Hugo tarball
shell: mkdir -p /home/kasm-default-profile/hugo_extended_{{ hugo_version }}_Linux-64bit
- name: Extract Hugo tarball
unarchive:
src: /home/kasm-default-profile/hugo_extended_{{ hugo_version }}_Linux-64bit.tar.gz
dest: /home/kasm-default-profile/hugo_extended_{{ hugo_version }}_Linux-64bit
remote_src: yes
- name: Delete Hugo tarball
shell: rm /home/kasm-default-profile/hugo_extended_{{ hugo_version }}_Linux-64bit.tar.gz
- name: Install Hugo binary in /usr/local/bin
shell: mv /home/kasm-default-profile/hugo_extended_{{ hugo_version }}_Linux-64bit/hugo /usr/local/bin
- name: Delete Hugo temp directory
shell: rm -rf /home/kasm-default-profile/hugo_extended_{{ hugo_version }}_Linux-64bit
-
# add default user to dialout group
hosts: localhost
connection: local
gather_facts: yes
tags:
- install_arduino_tools
tasks:
- name: Add kasm-user to dialout group (for flashing binaries with Arduino IDE) as per https://www.shellhacks.com/arduino-dev-ttyacm0-permission-denied/
user:
name: kasm-user
shell: /bin/bash
groups: "dialout"
state: present
remove: yes
-
# install Arduino 1.8.19
hosts: localhost
connection: local
gather_facts: yes
tags:
- install_arduino_tools
- install_oshw_tools
vars:
arduino_version: "1.8.19"
arduino_cli_version: "0.33.0"
arduino_pico_version: "3.3.0"
arduino_esp32_version: "2.0.9"
tasks:
- name: Join parts of Arduino tarball
shell: cat /home/kasm-default-profile/install_files/arduino-{{ arduino_version }}-linux64.tar.xz.part* > /home/kasm-default-profile/install_files/arduino-{{ arduino_version }}-linux64.tar.xz
- name: unarchive Arduino tarball
unarchive:
src: /home/kasm-default-profile/install_files/arduino-{{ arduino_version }}-linux64.tar.xz
dest: /opt
remote_src: yes
creates: /opt/arduino-{{ arduino_version }}/install.sh
- name: Unarchive AVR-GCC toolchain for arduino
unarchive:
src: /home/kasm-default-profile/install_files/avr-gcc-7.3.0-atmel3.6.1-arduino7-x86_64-pc-linux-gnu.tar.bz2
dest: /opt/arduino-{{ arduino_version }}/hardware/tools
remote_src: yes
- name: install Arduino
shell:
cmd: /opt/arduino-{{ arduino_version }}/install.sh
executable: /bin/bash
- name: Create directory for Arduino CLI tarball
shell: mkdir -p /home/kasm-default-profile/install_files/arduino-cli_{{ arduino_cli_version }}
- name: unarchive Arduino CLI tarball
unarchive:
src: /home/kasm-default-profile/install_files/arduino-cli_{{ arduino_cli_version }}_Linux_64bit.tar.gz
dest: /home/kasm-default-profile/install_files/arduino-cli_{{ arduino_cli_version }}
remote_src: yes
creates: /home/kasm-default-profile/install_files/arduino-cli_{{ arduino_cli_version }}/License.txt
- name: install Arduino CLI to /usr/local/bin
shell: mv /home/kasm-default-profile/install_files/arduino-cli_{{ arduino_cli_version }}/arduino-cli /usr/local/bin
- name: Create arduino workspace directory in /home/kasm-default-profile/.arduino15/ for installing Arduino board libraries
shell: mkdir -p /home /home/kasm-default-profile/.arduino15/
- name: install package_rp2040_index.json for QT Py
get_url:
url: https://github.com/earlephilhower/arduino-pico/releases/download/{{ arduino_pico_version }}/package_rp2040_index.json
dest: /home/kasm-default-profile/.arduino15/
- name: install Arduino-Pico {{ arduino_pico_version }} using arduino-cli
shell: arduino-cli core install rp2040:rp2040@{{ arduino_pico_version }} --additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/{{ arduino_pico_version }}/package_rp2040_index.json
- name: Download Arduino-ESP32 {{ arduino_esp32_version }} package index to /home/kasm-default-profile/.arduino15/
shell: wget https://github.com/espressif/arduino-esp32/releases/download/{{ arduino_esp32_version }}/package_esp32_index.json -O /home/kasm-default-profile/.arduino15/package_esp32_index.json
- name: Add Arduino-Pico {{ arduino_pico_version }} package index to /home/kasm-default-profile/.arduino15/preferences.txt
shell: echo "boardsmanager.additional.urls=https://github.com/earlephilhower/arduino-pico/releases/download/{{ arduino_pico_version }}/package_rp2040_index.json" >> /home/kasm-default-profile/.arduino15/preferences.txt
- name: Add Arduino-ESP32 {{ arduino_esp32_version }} package index to /home/kasm-default-profile/.arduino15/preferences.txt
shell: echo "boardsmanager.additional.urls=https://github.com/espressif/arduino-esp32/releases/download/{{ arduino_esp32_version }}/package_esp32_index.json" >> /home/kasm-default-profile/.arduino15/preferences.txt
- name: install Arduino-ESP32 {{ arduino_esp32_version }} using arduino-cli
shell: arduino-cli core install esp32:esp32@{{ arduino_esp32_version }} --additional-urls https://github.com/espressif/arduino-esp32/releases/download/{{ arduino_esp32_version }}/package_esp32_index.json
- name: Get Arduino version
shell: arduino --version 2>/dev/null | sed 's/[[:alpha:]\:|(|[:space:]]//g'
register: installed_arduino_version
- name: Get Arduino CLI version
shell: arduino-cli version | sed 's/arduino-cli/\n/g' | sed 's/Commit:/\n/g' | grep Version | sed 's/[[:alpha:]|[:space:]]//g' | sed 's/://g'
register: installed_arduino_cli_version
- name: Get Arduino-Pico version
shell: arduino-cli core list | grep rp2040 | awk '{ print $2'}
register: installed_arduino_pico_version
- name: Get Arduino-ESP32 version
shell: arduino-cli core list | grep esp32 | awk '{ print $2'}
register: installed_arduino_esp32_version
- name: Display Arduino version
debug:
msg: "Arduino version = {{ installed_arduino_version.stdout }}"
- name: Display Arduino CLI version
debug:
msg: "Arduino CLI version = {{ installed_arduino_cli_version.stdout }}"
- name: Display Arduino-Pico version
debug:
msg: "Arduino-Pico version = {{ installed_arduino_pico_version.stdout }}"
- name: Display Arduino-ESP32 version
debug:
msg: "Arduino-ESP32 version = {{ installed_arduino_esp32_version.stdout }}"
- name: Test Arduino version
fail:
msg: "Arduino Version Error: Expected {{ arduino_version }} | Found {{ installed_arduino_version.stdout }}"
when: installed_arduino_version.stdout != arduino_version
- name: Test Arduino CLI version
fail:
msg: "Arduino CLI Version Error: Expected {{ arduino_cli_version }} | Found {{ installed_arduino_cli_version.stdout }}"
when: installed_arduino_cli_version.stdout != arduino_cli_version
- name: Test Arduino-Pico version
fail:
msg: "Arduino-Pico Version Error: Expected {{ arduino_pico_version }} | Found {{ installed_arduino_pico_version.stdout }}"
when: installed_arduino_pico_version.stdout != arduino_pico_version
- name: Test Arduino-ESP32 version
fail:
msg: "Arduino-ESP32 Version Error: Expected {{ arduino_esp32_version }} | Found {{ installed_arduino_esp32_version.stdout }}"
when: installed_arduino_esp32_version.stdout != arduino_esp32_version
-
# install firefox
hosts: localhost
connection: local
gather_facts: yes
tags: install_firefox
vars:
firefox_profiles:
default:
extensions:
- ublock-origin
preferences:
network.cookie.cookieBehavior: 1
privacy.donottrackheader.enabled: true
datareporting.healthreport.uploadEnabled: false
secondprofile:
extensions:
- adblock-plus
preferences:
privacy.donottrackheader.enabled: false
privacy.trackingprotection.enabled: false
signon.rememberSignons: false
datareporting.healthreport.uploadEnabled: false
pre_tasks:
- name: Update apt packages
apt:
update_cache: yes
roles:
- role: staticdev.firefox
-
# install keychain, git, and @capsulecorplab .vimrc and .gitconfig
hosts: localhost
connection: local
gather_facts: yes
tags:
- install_utilities
- install_oshw_tools
vars:
git_version: "2.43.0"
git_version_to_install: "1:{{ git_version }}-0ppa1~ubuntu22.04.1"
keychain_version: "2.8.5"
keychain_version_to_install: "{{ keychain_version }}-2"
keychain_version_expected: "{{ keychain_version }}.."
tasks:
- name: Add git PPA
shell: add-apt-repository ppa:git-core/ppa
- name: Install git
apt:
name: "git={{ git_version_to_install }}"
- name: Install Git Bash Completion
apt:
name: bash-completion
update_cache: yes
- name: Install Keychain
apt:
name: "keychain={{ keychain_version_to_install }}"
update_cache: yes
- name: install ping
apt:
name: iputils-ping
update_cache: yes
- name: Get git version
shell: git version | sed 's/[[:alpha:]|(|[:space:]]//g'
register: installed_git_version
- name: Get keychain version
shell:
cmd: keychain -V 2> >(grep -i keychain) 2> >(sed 's/[[:alpha:]|(|[:space:]]//g') | fgrep '*' | sed 's/[*~://]//g'
executable: /bin/bash
register: installed_keychain_version
- name: Display git and keychain versions
debug:
msg: "git = {{ installed_git_version.stdout }} | keychain = {{ installed_keychain_version.stdout }}"
- name: Test git version
fail:
msg: "Git Version Error: Expected {{ git_version }} | Found {{ installed_git_version.stdout }}"
when: installed_git_version.stdout != git_version
- name: Test keychain version
fail:
msg: "Keychain Version Error: Expected {{ keychain_version_expected }} | Found {{ installed_keychain_version.stdout }}"
when: installed_keychain_version.stdout != keychain_version_expected
- name: auto-launch keychain in shell, if ssh keys exists
shell: echo 'if [ -r ~/.ssh/id_ed25519 ]; then\n eval `keychain --eval id_ed25519`\nfi' >> /home/kasm-default-profile/.bashrc
- name: Install @capsulecorplab .vimrc
get_url:
url: https://gist.githubusercontent.com/capsulecorplab/495058e7a57ed8adaed3c40c80d09739/raw/4a6e6f6ff92b96919be111c9cbb5a4a21ab472d2/.vimrc
dest: /home/kasm-default-profile/
- name: Install @capsulecorplab .gitconfig
get_url:
url: https://gist.githubusercontent.com/capsulecorplab/401ba2fe0857a328f2a626adbf078cc6/raw/b89a6234f0d620ff60bcfe37f95de197b8772377/.gitconfig
dest: /home/kasm-default-profile/
-
# install KiCad
hosts: localhost
connection: local
tags:
- install_kicad
- install_oshw_tools
vars:
kicad_version: "7.0.10"
kicad_version_to_install: "{{ kicad_version }}~ubuntu22.04.1"
tasks:
- name: Add PPA repository for KiCad 7.0
shell: add-apt-repository ppa:kicad/kicad-7.0-releases
- name: install KiCad {{ kicad_version }} with Apt
apt:
name: kicad={{ kicad_version_to_install }}
update_cache: yes
install_recommends: yes
- name: Get KiCad version
shell: kicad-cli version
register: installed_kicad_version
- name: Display KiCad versions
debug:
msg: "kicad = {{ installed_kicad_version.stdout }}"
- name: Test KiCad version
fail:
msg: "KiCad Version Error: Expected {{ kicad_version }} | Found {{ installed_kicad_version.stdout }}"
when: installed_kicad_version.stdout != kicad_version
-
# install FreeCAD
hosts: localhost
connection: local
gather_facts: yes
tags:
- install_freecad
- install_oshw_tools
vars:
freecad_version: "0.21.2"
tasks:
- name: Install kmod with apt
apt:
name: kmod
update_cache: yes
- name: add universe for installing FUSE 2.x # as per https://github.com/AppImage/AppImageKit/wiki/FUSE#install-fuse
shell: add-apt-repository universe
- name: Install FUSE 2.x with apt # as per https://github.com/AppImage/AppImageKit/wiki/FUSE#install-fuse and https://docs.appimage.org/user-guide/troubleshooting/fuse.html#setting-up-fuse-2-x-alongside-of-fuse-3-x-on-recent-ubuntu-22-04-debian-and-their-derivatives
apt:
name: libfuse2
update_cache: yes
- name: Download FreeCAD {{ freecad_version }} source tarball
shell: wget https://github.com/FreeCAD/FreeCAD/archive/refs/tags/{{ freecad_version }}.tar.gz -O /home/kasm-default-profile/install_files/freecad-{{ freecad_version }}.tar.gz
- name: Download FreeCAD {{ freecad_version }} AppImage
shell: wget https://github.com/FreeCAD/FreeCAD/releases/download/{{ freecad_version }}/FreeCAD-{{ freecad_version }}-Linux-x86_64.AppImage -O /home/kasm-default-profile/install_files/FreeCAD-{{ freecad_version }}-Linux-x86_64.AppImage
- name: Unarchive FreeCAD {{ freecad_version }} source tarball
unarchive:
src: /home/kasm-default-profile/install_files/freecad-{{ freecad_version }}.tar.gz
dest: /home/kasm-default-profile/install_files
remote_src: yes
creates: /home/kasm-default-profile/install_files/FreeCAD-{{ freecad_version }}/LICENSE
- name: Create FreeCAD folder in /opt
shell: mkdir -p /opt/FreeCAD
- name: Copy FreeCAD icon to FreeCAD directory
copy:
src: /home/kasm-default-profile/install_files/FreeCAD-{{ freecad_version }}/src/Gui/Icons/freecad-icon-16.png
dest: /opt/FreeCAD
remote_src: yes
- name: Install FreeCAD {{ freecad_version }}
copy:
src: /home/kasm-default-profile/install_files/FreeCAD-{{ freecad_version }}-Linux-x86_64.AppImage
dest: /opt/FreeCAD/FreeCAD-{{ freecad_version }}-Linux-x86_64.AppImage
remote_src: yes
owner: root
group: root
mode: '0755'
- name: Create symlink for FreeCAD AppImage in /usr/local/bin
shell: ln -srv /opt/FreeCAD/FreeCAD-{{ freecad_version }}-Linux-x86_64.AppImage /usr/local/bin/freecad
- name: Configure FreeCAD desktop shortcut
shell: echo "[Desktop Entry]\nName=FreeCAD\nGenericName=FreeCAD\nExec=/usr/local/bin/freecad\nIcon=/opt/FreeCAD/freecad-icon-16.png\nTerminal=false\nType=Application\nStartupNotify=false\nCategories=Application;Development;" > /usr/share/applications/freecad.desktop
-
# install Python packages with pip
hosts: localhost
connection: local
gather_facts: yes
tags:
- install_python_tools
- install_doctools
- install_arduino_tools
tasks:
- name: Update OS to point python to python3
apt:
name: python-is-python3
update_cache: yes
- name: Install pip for python3 with Apt
apt:
name: python3-pip
update_cache: yes
- name: Install python packages with pip
pip:
name:
- pyserial
- jupyterlab
- notebook
- pint
- jinja2==3.1.2
- linkml==1.4.1
- jinja2-cli==0.8.2
# roles:
# - role: geerlingguy.pip
-
# install sudo for the vs-code role below
hosts: localhost
connection: local
tasks:
- name: Install Sudo
apt:
name: sudo
update_cache: yes
- name: Preserve DONT_PROMPT_WSL_INSTALL in sudoers
lineinfile:
path: "/etc/sudoers"
line: "Defaults env_keep += \"DONT_PROMPT_WSL_INSTALL\""
when: wsl2_environment
-
# add dev user to give vs code somewhere to install extensions
hosts: localhost
connection: local
tasks:
- name: Add dev user
user:
name: dev
uid: 1002
-
# install the remainder of the tools
hosts: localhost
connection: local
environment:
DONT_PROMPT_WSL_INSTALL: 1
roles:
- role: gantsign.visual-studio-code
users:
- username: "dev"
visual_studio_code_extensions:
- ms-python.python
- James-Yu.latex-workshop
visual_studio_code_settings_overwrite: yes
visual_studio_code_settings: {
"extensions.ignoreRecommendations": true,
"update.mode": "none",
"extensions.autoUpdate": false,
"extensions.autoCheckUpdates": false,
"terminal.integrated.profiles.linux": {
"bash (login)": {
"path": "bash",
"args": ["-l"]
}
},
"terminal.integrated.defaultProfile.linux": "bash (login)"
}
-
# Copy VS Code changes to kasm-default-profile and lean up (remove) dev user now that vs code is installed
hosts: localhost
connection: local
tasks:
- name: Copy VS Code changes to kasm-default-profile
shell:
cmd: cp -r /home/dev/.config/Code/ /home/kasm-default-profile/.config/Code/ && cp -r /home/dev/.vscode/ /home/kasm-default-profile/.vscode/
- name: Remove dev user
user:
name: dev
state: absent
remove: yes
# Three dots indicate the end of a YAML document
...