-
Notifications
You must be signed in to change notification settings - Fork 1
/
playbook.yaml
1002 lines (943 loc) · 35.3 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
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
# 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_generator_plantuml
- install_generator_asciidoctor
- install_cross_compile_toolchain
- install_avr_build_tools
- install_gs_avr_toolchain
- install_42
tasks:
- name: Install build-essential
apt:
name: build-essential
update_cache: yes
-
# Install zlib
hosts: localhost
connection: local
tags:
- install_doctools
- install_generator_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 autoconf
hosts: localhost
connection: local
tags:
- install_doctools
- install_generator_plantuml
- install_gpredict
- install_42
tasks:
- name: Install autoconf
apt:
name: autoconf
update_cache: yes
-
# Install OpenSSL development package
hosts: localhost
connection: local
gather_facts: yes
tags:
- install_avr_build_tools
- install_doctools
- install_utilities
tasks:
- name: Install libssl-dev
apt:
name: libssl-dev
update_cache: yes
-
# Install doctools
hosts: localhost
connection: local
gather_facts: yes
tags:
- install_generator_asciidoctor
- 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.18
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
- name: Install yq # https://mikefarah.gitbook.io/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 gs-avr-toolchain
hosts: localhost
connection: local
tags: install_gs_avr_toolchain
tasks:
- name: Install libmpfr6 with apt
apt:
name: libmpfr6
update_cache: yes
- name: Create symbolic link for libmpfr.so.4
shell: ln -srv /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4
- name: Install unzip with apt
apt:
name: unzip
update_cache: yes
- name: Install gs-avr-toolchain
shell:
cmd: /home/kasm-default-profile/install_files/avr_toolchain/gs-avr32-toolchain-3.4.2_gs1/install-avr32.sh
chdir: /home/kasm-default-profile/install_files/avr_toolchain/gs-avr32-toolchain-3.4.2_gs1/
executable: /bin/bash
- name: Add /usr/local/avr32/bin to PATH
shell: echo 'export PATH="/usr/local/avr32/bin:$PATH"' >> /home/kasm-default-profile/.bashrc
-
# Install Pharo
hosts: localhost
connection: local
tags:
- install_pharo
vars:
pharo_launcher_version: "c661cf8e517bf2695fb637aa058d7fab3449107a"
pharo_version: "11"
roassal_version: "v1.01b"
roassalexporter_version: "v1.0"
neocsv_version: "fcffa0bba57b2c8c4624eb356fd29afc9b3dbf4a"
xmlparser_version: "531f9b7c711c89e51ac54cb878099f5a89bca50e"
tasks:
- name: Clone PharoLauncher
shell:
cmd: git clone https://github.com/pharo-project/pharo-launcher.git
chdir: /home/kasm-default-profile
executable: /bin/bash
- name: Checkout {{ pharo_launcher_version }} in pharo-launcher repo
shell:
cmd: git checkout {{ pharo_launcher_version }}
chdir: /home/kasm-default-profile/pharo-launcher
executable: /bin/bash
- name: Download Pharo {{ pharo_version }} image + vm in pharo-launcher
shell:
cmd: curl https://get.pharo.org/{{ pharo_version }}0+vm | bash
chdir: /home/kasm-default-profile/pharo-launcher
executable: /bin/bash
- name: Rename Pharo.image to PharoLauncher.image
shell:
cmd: mv Pharo.image PharoLauncher.image
chdir: /home/kasm-default-profile/pharo-launcher
executable: /bin/bash
- name: Load PharoLauncher with Metachello from shell # as per https://github.com/pharo-project/pharo-launcher/blob/feature/cmd-line/build.sh#L31C2-L31C183
shell:
cmd: ./pharo PharoLauncher.image eval --save "Metacello new baseline{{ ':' }} 'PharoLauncher'; repository{{ ':' }} 'gitlocal{{ ':' }}//src'; ignoreImage; onConflictUseIncoming; onWarning{{ ':' }} [{{ ':' }}ex | ex load]; load"
chdir: /home/kasm-default-profile/pharo-launcher
executable: /bin/bash
- name: Enable PharoDarkTheme in PharoLauncher
shell:
cmd: ./pharo PharoLauncher.image eval --save "PharoDarkTheme beCurrent"
chdir: /home/kasm-default-profile/pharo-launcher
executable: /bin/bash
- name: Configure pharo-launcher bash script
shell: echo "#!/usr/bin/env bash\n/home/kasm-default-profile/pharo-launcher/pharo-ui /home/kasm-default-profile/pharo-launcher/PharoLauncher.image eval 'PharoLauncherApplication openFull'" > /home/kasm-default-profile/install_files/pharo-launcher
- name: Copy pharo-launcher bash script into /home/kasm-default-profile/pharo-launcher and set to executable
copy:
src: /home/kasm-default-profile/install_files/pharo-launcher
dest: /home/kasm-default-profile/pharo-launcher
remote_src: yes
owner: root
group: root
mode: a+x
- name: Create symlink for pharo-launcher in /usr/local/bin
shell: ln -sv /home/kasm-default-profile/pharo-launcher/pharo-launcher /usr/local/bin/pharo-launcher
- name: Configure PharoLauncher desktop shortcut
shell: echo "[Desktop Entry]\nName=Pharo\nGenericName=Pharo\nExec=pharo-launcher\nIcon=/home/kasm-default-profile/pharo-launcher/icons/pharo-launcher.png\nTerminal=false\nType=Application\nStartupNotify=false\nCategories=Application;Development;" > /usr/share/applications/pharo.desktop
- name: Create RoassalPlayground (pharo image) using PharoLaucher-CLI
shell:
cmd: ./pharo PharoLauncher.image clap launcher image create fromRepo --newImageName RoassalPlayground pharo-graphics/Roassal
chdir: /home/kasm-default-profile/pharo-launcher
executable: /bin/bash
- name: Change remote origin to https://github.com/ObjectProfile/Roassal3.git
shell:
cmd: git remote set-url origin https://github.com/ObjectProfile/Roassal3.git
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground/pharo-local/iceberg/pharo-graphics/Roassal
- name: Fetch upstream in Roassal repo
shell:
cmd: git fetch
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground/pharo-local/iceberg/pharo-graphics/Roassal
- name: Checkout {{ roassal_version }} in Roassal repo
shell:
cmd: git checkout {{ roassal_version }}
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground/pharo-local/iceberg/pharo-graphics/Roassal
executable: /bin/bash
- name: Download Pharo {{ pharo_version }} image + vm into RoassalPlayground
shell:
cmd: curl https://get.pharo.org/{{ pharo_version }}0+vm | bash
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground
executable: /bin/bash
- name: Rename Pharo.changes to RoassalPlayground.changes
shell:
cmd: mv Pharo.changes RoassalPlayground.changes
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground
executable: /bin/bash
- name: Rename Pharo.image to RoassalPlayground.image
shell:
cmd: mv Pharo.image RoassalPlayground.image
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground
executable: /bin/bash
- name: Enable PharoDarkTheme in RoassalPlayground
shell:
cmd: ./pharo RoassalPlayground.image eval --save "PharoDarkTheme beCurrent"
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground
executable: /bin/bash
- name: Load Full Roassal3 package from local repo into RoassalPlayground using Metacello
shell:
cmd: ./pharo RoassalPlayground.image eval --save "[Metacello new baseline{{ ':' }} 'Roassal3'; repository{{ ':' }} 'gitlocal{{ ':' }}//./pharo-local/iceberg/pharo-graphics/Roassal/src'; load{{ ':' }} 'Full'] on{{ ':' }} MCMergeOrLoadWarning do{{ ':' }} [:warning | warning load ]"
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground
executable: /bin/bash
- name: Create directory for svenvc/NeoCSV in RoassalPlayground/pharo-local/iceberg
shell:
cmd: mkdir svenvc
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground/pharo-local/iceberg/
- name: Clone NeoCSV into RoassalPlayground/pharo-local/iceberg/svenvc
shell:
cmd: git clone https://github.com/svenvc/NeoCSV.git
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground/pharo-local/iceberg/svenvc
- name: Checkout {{ neocsv_version }} in NeoCSV repo
shell:
cmd: git checkout {{ neocsv_version }}
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground/pharo-local/iceberg/svenvc/NeoCSV
executable: /bin/bash
- name: Load NeoCSV package from local repo into RoassalPlayground using Metacello
shell:
cmd: ./pharo RoassalPlayground.image eval --save "[Metacello new baseline{{ ':' }} 'NeoCSV'; repository{{ ':' }} 'gitlocal{{ ':' }}//./pharo-local/iceberg/svenvc/NeoCSV/repository'; load] on{{ ':' }} MCMergeOrLoadWarning do{{ ':' }} [:warning | warning load ]"
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground
executable: /bin/bash
- name: Clone XML-XMLParser into RoassalPlayground/pharo-local/iceberg/pharo-contributions
shell:
cmd: git clone https://github.com/pharo-contributions/XML-XMLParser.git
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground/pharo-local/iceberg/pharo-contributions
- name: Checkout {{ xmlparser_version }} in NeoCSV repo
shell:
cmd: git checkout {{ xmlparser_version }}
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground/pharo-local/iceberg/pharo-contributions/XML-XMLParser
executable: /bin/bash
- name: Load XMLParser package from local repo into RoassalPlayground using Metacello
shell:
cmd: ./pharo RoassalPlayground.image eval --save "[Metacello new baseline{{ ':' }} 'XMLParser'; repository{{ ':' }} 'gitlocal{{ ':' }}//./pharo-local/iceberg/pharo-contributions/XML-XMLParser/src'; load] on{{ ':' }} MCMergeOrLoadWarning do{{ ':' }} [:warning | warning load ]"
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground
executable: /bin/bash
- name: Clone Roassal3Exporters into RoassalPlayground/pharo-local/iceberg/pharo-contributions
shell:
cmd: git clone https://github.com/ObjectProfile/Roassal3Exporters
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground/pharo-local/iceberg/pharo-contributions
- name: Checkout {{ roassalexporter_version }} in Roassal3Exporters repo
shell:
cmd: git checkout {{ roassalexporter_version }}
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground/pharo-local/iceberg/pharo-contributions/Roassal3Exporters
executable: /bin/bash
- name: Load Roassal3Exporters package from local repo into RoassalPlayground using Metacello
shell:
cmd: ./pharo RoassalPlayground.image eval --save "[Metacello new baseline{{ ':' }} 'Roassal3Exporters'; repository{{ ':' }} 'gitlocal{{ ':' }}//./pharo-local/iceberg/pharo-contributions/Roassal3Exporters/src'; load] on{{ ':' }} MCMergeOrLoadWarning do{{ ':' }} [:warning | warning load ]"
chdir: /home/kasm-default-profile/Pharo/images/RoassalPlayground
executable: /bin/bash
-
# install GMAT
hosts: localhost
connection: local
tags: install_gmat
tasks:
- name: Install GMAT dependencies with Apt
apt:
name: libopengl0
update_cache: yes
- name: Join parts of GMAT tarball
shell: cat /home/kasm-default-profile/install_files/gmat-ubuntu-x64-R2022a.tar.gz.part* > /home/kasm-default-profile/gmat-ubuntu-x64-R2022a.tar.gz
- name: Extract GMAT tarball to /opt
unarchive:
src: /home/kasm-default-profile/gmat-ubuntu-x64-R2022a.tar.gz
dest: /opt
remote_src: yes
creates: /opt/GMAT/R2022a/README.txt
- name: Delete GMAT tarball
shell: rm /home/kasm-default-profile/gmat-ubuntu-x64-R2022a.tar.gz
- name: Configure GMAT desktop shortcut
shell: echo "[Desktop Entry]\nName=GMAT\nGenericName=GMAT\nExec=/opt/GMAT/R2022a/bin/GMAT_Beta\nIcon=/opt/GMAT/R2022a/data/graphics/icons/GMATLogo.png\nTerminal=false\nType=Application\nStartupNotify=false\nCategories=Application;Education;" > /usr/share/applications/gmat.desktop
-
# install Octave
hosts: localhost
connection: local
tasks:
- name: Install Octave with Apt
apt:
name: octave
update_cache: yes
- name: Install octave-doc with Apt
apt:
name: octave-doc
update_cache: yes
- name: Install liboctave-dev with Apt
apt:
name: liboctave-dev
update_cache: yes
- name: Install octave-control with Apt
apt:
name: octave-control
update_cache: yes
- name: Install octave-image with Apt
apt:
name: octave-image
update_cache: yes
- name: Install octave-io with Apt
apt:
name: octave-io
update_cache: yes
- name: Install octave-optim with Apt
apt:
name: octave-optim
update_cache: yes
- name: Install octave-signal with Apt
apt:
name: octave-signal
update_cache: yes
- name: Install octave-statistics with Apt
apt:
name: octave-statistics
update_cache: yes
-
# install Minicom from debian package
hosts: localhost
connection: local
tags: install_minicom
tasks:
- name: Install Minicom debian package from install_files
shell: dpkg -i /home/kasm-default-profile/install_files/minicom_2.7.1-1.1_amd64.deb
- name: Add USER to dialout group
user:
name: default
shell: /bin/bash
groups: "dialout"
state: present
remove: yes
-
# Configure pulseaudio
hosts: localhost
connection: local
tasks:
- name: Apt install pulseaudio-utils with Apt
apt:
name: pulseaudio-utils
update_cache: yes
- name: Set up user attributes in /etc/passwd
shell: echo "default:x:1000:1000:default User,,,:/home/default:/bin/bash" >> /etc/passwd
- name: Connect to the host's server using the mounted UNIX socket
shell: echo "default-server = unix:/run/user/1000/pulse/native" >> /etc/pulse/client.conf
- name: Prevent the use of shared memory
shell: echo "enable-shm = false" >> /etc/pulse/client.conf
-
# install keychain, git, and @capsulecorplab .vimrc and .gitconfig
hosts: localhost
connection: local
gather_facts: yes
tags:
- install_utilities
- install_42
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/
- name: Create /etc/ssh/sshd_config file with AuthorizedKeysFil/home/kasm-user/.ssh/id_ed25519e set to /home/kasm-user/.ssh/id_ed25519
shell: echo "AuthorizedKeysFile /home/kasm-user/.ssh/id_ed25519" > /etc/ssh/sshd_config
-
# install 42 (Spacecraft simulation)
hosts: localhost
connection: local
tags: install_42
vars:
fortytwo_commit: "0019f2475f609de6d4a5b02ca9fe2e7b8893b391"
tasks:
- name: Install 42 dependencies with Apt
apt:
name: g++, freeglut3-dev, libgl-dev, libglfw3-dev
update_cache: yes
- name: Clone 42 git repo
shell:
cmd: git clone https://github.com/ericstoneking/42.git
chdir: /home/kasm-default-profile/install_files
executable: /bin/bash
- name: Checkout {{ fortytwo_commit }} in 42 git repo
shell:
cmd: git checkout {{ fortytwo_commit }}
chdir: /home/kasm-default-profile/install_files/42
executable: /bin/bash
- name: Build 42
shell:
cmd: make 42 > /tmp/42_build_output.txt 2>&1
chdir: /home/kasm-default-profile/install_files/42
executable: /bin/bash
- name: Copy 42 binary into /usr/local/bin directory
copy:
src: /home/kasm-default-profile/install_files/42/42
dest: /usr/local/bin
remote_src: yes
- name: Change 42 binary permissions to 0555
file:
path: /usr/local/bin/42
owner: root
group: root
mode: '0555'
-
# install Python packages with pip
hosts: localhost
connection: local
gather_facts: yes
tags:
- install_python_packages
- install_avr_build_tools
- install_gs_avr_toolchain
- install_doctools
vars:
fprime_version: "3.2.0"
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:
- jupyterlab
- notebook
- voila
- pint
- toml
- requests
- argparse
- setuptools
- bikeshed
- rdflib==6.2.0
- linkml==1.5.6
- linkml-owl==0.2.4
- jinja2-cli==0.8.2
- pandas
- numpy==1.24.3
- seaborn
- click>=8.1.3
- black
- name: Install fprime {{ fprime_version }} python packages & dependencies
pip:
requirements: https://raw.githubusercontent.com/nasa/fprime/v{{ fprime_version }}/requirements.txt
- name: Get fprime version
shell: pip freeze | grep fprime-tools | sed 's/=//g' | sed 's/-//g' | sed 's/[[:alpha:]|[:space:]]//g'
register: installed_fprime_version
- name: Display fprime versions
debug:
msg: "fprime = {{ installed_fprime_version.stdout }}"
- name: Test fprime version
fail:
msg: "fprime Version Error: Expected {{ fprime_version }} | Found {{ installed_fprime_version.stdout }}"
when: installed_fprime_version.stdout != fprime_version
-
# 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 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 Cross-compile toolchain for embedded Linux target
hosts: localhost
connection: local
gather_facts: yes
tags:
- install_cross_compile_toolchain
- install_avr_build_tools
- install_gs_avr_toolchain
- install_doctools
tasks:
- name: Install gcc-arm-linux-gnueabihf with Apt
apt:
name: gcc-arm-linux-gnueabihf
update_cache: yes
- name: Install g++-arm-linux-gnueabihf with Apt
apt:
name: g++-arm-linux-gnueabihf
update_cache: yes
- name: Install gdb-multiarch with Apt
apt:
name: gdb-multiarch
update_cache: yes
- name: Extract cmake source files
unarchive:
src: /home/kasm-default-profile/install_files/cmake-3.23.1.tar.gz
dest: /home/kasm-default-profile/
remote_src: yes
creates: /home/kasm-default-profile/cmake-3.23.1/README
- name: Build cmake
shell:
cmd: ./configure && make > /tmp/cmake_build_output.txt 2>&1 && make install
chdir: /home/kasm-default-profile/cmake-3.23.1/
executable: /bin/bash
- name: Delete cmake source files
shell: rm -rf /home/kasm-default-profile/cmake-3.23.1/
-
# Install NodeJS Tools
hosts: localhost
connection: local
gather_facts: yes
tags:
- install_node
- install_doctools
vars:
node_version: "18.5.0"
v_node_version: "v{{ node_version }}"
npm_version: "8.12.1"
npx_version: "8.12.1"
yarn_version: "3.5.0"
yo_version: "4.3.1"
generator_code_version: "1.7.5"
typescript_version: "5.1.3"
tasks: # Test Node JS Tools versions
- name: Install Yarn
shell: "corepack enable && corepack prepare yarn@{{ yarn_version }} --activate"
- 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: Get TypeScript Compiler version
shell: tsc --version | sed 's/[[:alpha:]|(|[:space:]]//g'
register: installed_tsc_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: Display TypeScript Compiler version
debug:
msg: "tsc = {{ installed_tsc_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
- name: Test TypeScript Compiler version
fail:
msg: "TypeScript Compiler Version Error: Expected {{ typescript_version }} | Found {{ installed_tsc_version.stdout }}"
when: installed_tsc_version.stdout != typescript_version
roles:
- role: grzegorznowak.nvm_node
nvm_install_script_version: "0.39.3"
nvm_node_version: "{{ node_version }}"
nvm_install_globally:
- name: yo
version: "{{ yo_version }}"
- name: generator-code
version: "{{ generator_code_version }}"
- name: typescript
version: "{{ typescript_version }}"
-
# install GPredict
hosts: localhost
connection: local
gather_facts: yes
tags:
- install_gpredict
vars:
gpredict_version: "2.3"
gpredict_version_to_install: "{{ gpredict_version }}-72-gc596101-3"
tasks:
- name: Install libtool
apt:
name: libtool
update_cache: yes
- name: Install intltool
apt:
name: intltool
update_cache: yes
- name: Install automake
apt:
name: automake
update_cache: yes
- name: Install libcurl4-openssl-dev
apt:
name: libcurl4-openssl-dev
update_cache: yes
- name: Install pkg-config
apt:
name: pkg-config
update_cache: yes
- name: Install libglib2.0-dev
apt:
name: libglib2.0-dev
update_cache: yes
- name: Install libgtk-3-dev
apt:
name: libgtk-3-dev
update_cache: yes
- name: Install libgoocanvas-2.0-dev
apt:
name: libgoocanvas-2.0-dev
update_cache: yes
- name: install GPredict with apt
apt:
name: "gpredict={{ gpredict_version_to_install }}"
update_cache: yes
-
# install GNU Radio Software
hosts: localhost
connection: local
tags: install_gnuradio
vars:
gnuradio_version: "3.10.1.1"
gnuradio_version_to_install: "{{ gnuradio_version }}-2"
grsatellites_version: "4.4.0"
grsatellites_version_to_install: "{{ grsatellites_version }}-2build1"
tasks:
- name: install gnuradio dependencies # as per https://wiki.gnuradio.org/index.php?title=UbuntuInstall#Focal_Fossa_(20.04)_through_Kinetic_Kudu_(22.10)
apt:
name: g++, libboost-all-dev, libgmp-dev, swig, python3-numpy, python3-mako, python3-sphinx, python3-lxml, doxygen, libfftw3-dev, libsdl1.2-dev, libgsl-dev, libqwt-qt5-dev, libqt5opengl5-dev, python3-pyqt5, liblog4cpp5-dev, libzmq3-dev, python3-yaml, python3-click, python3-click-plugins, python3-zmq, python3-scipy, python3-gi, python3-gi-cairo, gir1.2-gtk-3.0, libcodec2-dev, libgsm1-dev, libusb-1.0-0, libusb-1.0-0-dev, libudev-dev
update_cache: yes
install_recommends: yes
- name: Add PPA repository for GNU Radio (latest)
shell: add-apt-repository ppa:gnuradio/gnuradio-releases
- name: Add universe PPA repository for installing gr-satellites
shell: add-apt-repository universe
- name: Install GNU Radio {{ gnuradio_version_to_install }} with Apt
apt:
name: gnuradio={{ gnuradio_version_to_install }}
update_cache: yes
install_recommends: yes
- name: Install gr-satellites {{ grsatellites_version_to_install }} with Apt
apt:
name: gr-satellites={{ grsatellites_version_to_install }}
update_cache: yes
install_recommends: yes
- name: Get GNU Radio version
shell: gnuradio-config-info -v
register: installed_gnuradio_version
- name: Get gr-satellites version
shell: gr_satellites --version | grep gr_satellites | awk '{ print $2}' | sed 's/[[:alpha:]|[:space:]]//g'
register: installed_grsatellites_version
- name: Display GNU Radio versions
debug:
msg: "GNU Radio = {{ installed_gnuradio_version.stdout }}"
- name: Display gr-satellites versions
debug:
msg: "gr-satellites = {{ installed_grsatellites_version.stdout }}"
- name: Test GNU Radio version
fail:
msg: "GNU Radio Version Error: Expected {{ gnuradio_version }} | Found {{ installed_gnuradio_version.stdout }}"
when: installed_gnuradio_version.stdout != gnuradio_version
- name: Test gr-satellites version
fail:
msg: "gr-satellites Version Error: Expected {{ grsatellites_version }} | Found {{ installed_grsatellites_version.stdout }}"
when: installed_grsatellites_version.stdout != grsatellites_version
-
# 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
- jebbs.plantuml
- 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,
"plantuml.exportFormat": "png",
"plantuml.jar": "/usr/local/bin/plantuml.jar",
"plantuml.render": "Local",
"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