195 Commits

Author SHA1 Message Date
bd0b74ba19 Merge branch 'Kubernetes.Bootstrap.Appliance' of https://code.spamasaurus.com/djpbessems/Packer.Images into Kubernetes.Bootstrap.Appliance
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-28 10:00:59 +02:00
521b323de2 Add retries 2022-08-28 10:00:58 +02:00
35b3d5d3b9 Refine task order w/ tags;Fix API check
Some checks failed
continuous-integration/drone/push Build is failing
2022-08-28 09:07:17 +02:00
675dce4160 Split up tasklist;Revert namespace;Distribute root cert
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-27 21:10:51 +02:00
bd7c1f92e8 Set traefik cert duration
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-26 11:31:12 +02:00
7d837a1711 Fix indentation
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-08-26 08:29:55 +02:00
e1b57cfdea Fix configmap name
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-25 16:06:29 +02:00
84d644db67 Fix namespace #2
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-25 13:11:33 +02:00
5cffb61544 Fix indentation
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-08-25 13:08:35 +02:00
1083937d5d Fix configmap namespace
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-08-25 12:56:37 +02:00
e52c63f80c Fix ingress namespace
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-08-25 12:51:29 +02:00
c7579ea4a6 Fix endpoint
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-08-25 12:06:56 +02:00
fba2e3e4b1 Disable http challenge;Inject stepca cert;Set default certresolver
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-08-25 12:04:51 +02:00
1c43bb19d2 Add acme provisioner;Force system certs update
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-25 08:22:28 +02:00
9a3898e0b8 Retrieve step-ca more reliably;Configure step-ca admin credentials
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-24 17:44:30 +02:00
a3da5b8f93 Migrate from helm-controlled ingress to passthrough ingressRoute
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-24 11:21:51 +02:00
5f02ddab49 Add default value 2022-08-23 14:38:03 +02:00
585e39cb97 Disable Harbor tls (rely on Traefik);Configure Traefik with custom certResolver;Retrieve & install root ca in truststore
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-23 14:31:53 +02:00
1cd7e1510f Configure CA w/ ingress
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-23 12:37:38 +02:00
0534b031fa Handle duplicate images;Add registry endpoint
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-22 14:54:54 +02:00
c8509aa3d5 Fix keyname
Some checks failed
continuous-integration/drone/push Build is failing
2022-08-22 14:28:06 +02:00
158af986c3 Add quotes
Some checks failed
continuous-integration/drone/push Build is failing
2022-08-22 13:46:43 +02:00
5e537966f6 Debug Ansible issue
Some checks failed
continuous-integration/drone/push Build is failing
2022-08-22 13:20:03 +02:00
3849b79493 Add step-ca component
Some checks failed
continuous-integration/drone/push Build is failing
2022-08-22 12:52:47 +02:00
5f1d1bfa8a Change order (test timing of handler)
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-19 12:55:53 +02:00
fe306bd845 Allow handler to fail (timing issue helm charts)
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-18 12:54:16 +02:00
ccbd4ed984 Fix task order;Add default hostname value
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-18 12:44:08 +02:00
fdc5c44e6a Remove handler from non-firstboot steps;Fix kubeconfig order/logic
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-17 08:32:35 +02:00
c57291af6d Force apply manifests w/ handler;Add dependency
Some checks failed
continuous-integration/drone/push Build is failing
2022-08-16 15:16:20 +02:00
d652cf0346 Configure ArgoCD declaratively
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-15 14:43:55 +02:00
a1b8837cc5 Add more memory
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-09 15:56:50 +02:00
5b7b93dd30 Increase diskspace
Some checks failed
continuous-integration/drone/push Build is failing
2022-08-09 14:56:30 +02:00
d89ccd57da Revert compression changes
Some checks failed
continuous-integration/drone/push Build is failing
2022-08-09 13:29:19 +02:00
53da641926 Test xz compression
Some checks failed
continuous-integration/drone/push Build is failing
2022-08-09 12:01:39 +02:00
a3e9bc659a Add powercli container
Some checks failed
continuous-integration/drone/push Build is failing
2022-08-09 11:57:31 +02:00
fc51bf3f94 Optimize node template handling
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-04 08:55:50 +02:00
3d96f8c13b Add missing dependency #2
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-03 15:16:24 +02:00
488fe10e1e Add missing dependency
Some checks failed
continuous-integration/drone/push Build is failing
2022-08-03 14:56:55 +02:00
01e168a7f9 Refactor package installation
Some checks failed
continuous-integration/drone/push Build is failing
2022-08-03 14:39:36 +02:00
c48f27c42e Rebase pip packages
Some checks failed
continuous-integration/drone/push Build is failing
2022-08-03 13:53:54 +02:00
185b332764 Fix linting error
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-03 09:23:27 +02:00
e89505bef6 Handle existing templates
Some checks failed
continuous-integration/drone/push Build is failing
2022-08-03 08:53:40 +02:00
b763d2b562 Avoid uncaught exception
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-31 22:29:47 +02:00
d607f615e9 Remove redundant quotes
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-31 18:21:18 +02:00
ed7a474dbb Update vApp properties;Rebase static binary;Refactor dictionary;Combine similar steps;Housekeeping
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-31 18:17:13 +02:00
14c6720196 Fix typo
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-29 11:39:57 +02:00
277c91eeba Fix module name;Add indentation;Update dependencies #2
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-29 11:39:39 +02:00
c9f3c648b7 Fix vApp property type;Include missing role;Update dependencies
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-29 10:56:34 +02:00
8e680c45be Housekeeping;Provision node templates;Add vApp properties
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-28 23:22:41 +02:00
7440d5824c Add missing parameter
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-27 14:23:33 +02:00
8e75925b52 Rebase dependency;Comment out redundant logic
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-27 13:33:04 +02:00
d6234321d9 Add dependencies
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-27 12:51:18 +02:00
ea20b1290c Add initial steps for workload cluster staging;Include govc (temporarily)
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-26 16:50:50 +02:00
d986d5ab25 Debug existing config map;Fix key;Fix tty mess of typos;Fix git push
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-26 10:08:35 +02:00
c29728594c Ignore errors for debugging
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-25 16:51:00 +02:00
10d5d6f389 Fix linting errors
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-22 09:44:35 +02:00
96dccef450 Housekeeping;Add tty console message
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-22 09:38:03 +02:00
05e0c50217 Debugging;Housekeeping;Push source gitops repository
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-20 20:50:39 +02:00
261e91ee2e Create additional SSH-keypair;Configure gitea
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-20 08:40:18 +02:00
1746af9b9d Fix variable references
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-18 14:07:12 +02:00
7c2ff54019 Fix helm chart ref
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-18 12:38:55 +02:00
193ce9a534 Move manifest injection to firstboot;Add SealedSecrets;Replace traefik dashboard
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-18 12:09:54 +02:00
9e91bef7b7 Disable phone-home;Add SealedSecrets;Flatten list
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-15 14:39:33 +02:00
05b30287bd Fix label;Configure gitea SSH;Fix git folder
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-15 14:02:27 +02:00
54caff8fb6 Add conditional;Inject manifests
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-15 12:14:12 +02:00
2f976898eb Remove redundant key/value;Add debugging
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-14 22:45:35 +02:00
44befeda4b Increase cpu sizing;Change default value;Fix filename;Fix endpoint;Add dependency;Fix filemode
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-14 14:54:04 +02:00
81847d3b93 Interact with argocd API
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-14 11:04:35 +02:00
39cc83ac57 Add missing key;Add traefik ssh entrypoint
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-14 10:33:26 +02:00
0263b2dfc4 Add (unversioned) clone of metacluster git repo 2022-07-13 12:17:46 +02:00
e7e3b69d95 Change block syntax
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-13 12:05:08 +02:00
b6ac086a31 Add conditional to K3s installation;Populate Gitea #2
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-13 12:00:03 +02:00
20ce62fb6d Enable offlineMode for gitea;Cleanup comments;Populate /etc/hosts
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-12 14:20:43 +02:00
0918eb36fe Fix parenthesis
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-11 13:37:55 +02:00
93e7d4dc9b Fix invalid var name
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-11 13:21:49 +02:00
9a0a33816c Add dummy file to preserve empty dir
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-11 10:18:33 +02:00
eeb1364f1b Refactor templating #3
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-11 09:56:02 +02:00
f04095db8c Refactor templating #42
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-11 09:24:04 +02:00
2847542976 Add vars_file reference
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-10 13:47:53 +02:00
929186d123 Revert var references
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-10 10:10:36 +02:00
d6c885240a Remove debugging;Revert default quotes;Test dynamic helm chart values
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-10 09:54:41 +02:00
0b97ae2fc5 Write whole dict to file
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-09 23:37:57 +02:00
abacbf90ce Refine templating #5
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-09 12:35:29 +02:00
243cf426d7 Add missing jinja delimiters
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-09 11:08:11 +02:00
64b7ea45c0 Fix linting error
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-09 09:26:13 +02:00
3a2dbe572e Refactor templating logic
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-09 09:18:13 +02:00
2be42989e5 Refine templating #4;Update sizing
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-07 20:16:18 +02:00
cb97703406 Refine templating #3
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-07 17:35:31 +02:00
16df0b65fc Disable TLS verify 2022-07-07 09:57:56 +02:00
847b255e3b Refine templating #2
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-06 17:03:48 +02:00
d005697438 Change ansible module
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-06 16:32:39 +02:00
ab010643df Revert blob storage test
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-06 16:09:21 +02:00
e17cd1b633 Test optimizing skopeo blob storage
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-06 15:28:13 +02:00
504764af10 Fix filename templating
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-06 14:52:25 +02:00
405fb5938f Force creation of new tarball
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-06 14:36:30 +02:00
77e0f7b7cb Refine templating
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-06 11:55:29 +02:00
7fb0e80537 Configure ArgoCD w/ password;Add bcrypt dependency
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-05 16:09:02 +02:00
fb8b9b735f Disable tls for argocd
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-05 15:52:17 +02:00
86e99b1515 Install argo-cd;Housekeeping
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-05 09:56:56 +02:00
952e92082f Fix var reference
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-04 18:00:57 +02:00
33e0220e34 Test making dd play nice 2022-07-04 17:57:56 +02:00
a51d922f00 Add marker key
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-04 17:35:02 +02:00
b441717ee1 Add retries to image downloads #2
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-04 17:10:15 +02:00
b7da591571 Add retries to image downloads 2022-07-04 17:08:46 +02:00
fa0fa30062 Fix ansible module name
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-04 16:45:09 +02:00
dd4e79901e Invert jinja delimiter declaration
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-04 16:07:30 +02:00
1fcaa4b212 Remove redundant/wrong scalar blocks
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-04 15:48:48 +02:00
164fd15c60 Prevent parsing of jinja delimiters;Revert exotic syntax
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-04 15:47:24 +02:00
241551169a Change syntax wrt raw jinja strings #3
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-04 15:34:52 +02:00
a2b20f49cc Add missing chart value key
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-04 15:21:47 +02:00
fe8765ded7 Different syntax to allow raw jinja strings
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-04 15:12:27 +02:00
caf45b5270 Fix quotes 2022-07-04 14:55:07 +02:00
9ba2df08cd Fix linting error 2022-07-04 14:15:08 +02:00
9458f49744 Avoid invalid yaml w/ jinja syntax
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-04 14:13:30 +02:00
369aaaa0b5 Fix typo in dynamic disk 2022-07-04 14:02:55 +02:00
6220e2a9aa Add chart values to var_file;Add default null
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-04 13:49:37 +02:00
e3e46bae7d Test injecting dictionaries into yaml file
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-04 13:26:35 +02:00
6e6e7900da Update gitea chart values;Add registry mirror definitions
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-04 12:39:53 +02:00
6c329a36e9 Move payload file
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-03 22:32:17 +02:00
f33f2912f1 Fix linting error
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-03 15:19:41 +02:00
9541942c23 Install gitea chart;Add tea cli binary
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-03 15:08:57 +02:00
2f937aded7 Rename vapp property;Configure node for private registry 2022-07-03 14:52:01 +02:00
95dea97382 Fix skopeo copy syntax
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-01 13:10:26 +02:00
a840306245 Change hypervisor cluster 2022-07-01 11:13:29 +02:00
bbd103d527 Fix scalar block syntax
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-01 10:39:47 +02:00
b2ceee8720 Push images to registry
Some checks failed
continuous-integration/drone/push Build is failing
2022-07-01 10:32:58 +02:00
d5c886f02b Fix Harbor config;Add extra container images
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-30 16:21:19 +02:00
1d59cd4b3c Configure Harbor;Disable tarball deletion
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-30 11:20:39 +02:00
f2d9147291 Fix syntax error
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-30 08:03:13 +02:00
bc9f1c260f Reconfigure Longhorn/Harbor
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-29 17:06:23 +02:00
368f84769b Reenable image handling;Configure Longhorn/Harbor
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-29 13:07:34 +02:00
51366476cc Fix linting error
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-29 11:31:13 +02:00
dcbaf6b807 Create/mount logical volume;Add lvm2 dependency
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-29 11:29:22 +02:00
5dfc3a7813 Redirect crontab output 2022-06-29 09:58:10 +02:00
0989d0c586 Remove debugging;Add missing collection
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-29 09:27:03 +02:00
8a83f47572 Redirect error output;Add debugging;Housekeeping
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-29 09:06:13 +02:00
a3bbf88ce3 Rename file 2022-06-29 08:54:36 +02:00
5e0cebf733 Fix linting error 2022-06-29 08:00:02 +02:00
00e3266360 Test dynamic disk;Disable containerimages temporarily
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-29 07:59:17 +02:00
c6a8f9f7bd Fix linting errors
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-06-28 17:11:11 +02:00
4f1231f973 Set longhorn defaults
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-28 17:10:24 +02:00
049bedbd8f Mount dynamic disk
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-28 16:37:54 +02:00
0e7cfa0934 Add dynamic disk;Add kubectl tab completion
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-28 15:46:55 +02:00
5435f73402 Disable local-path storageclass
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-28 12:02:12 +02:00
6917e0799a Add missing kubeconfig key
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-28 11:53:17 +02:00
4616b9b070 Fix typo
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-28 09:37:49 +02:00
8c741dc120 Fix parse logic
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-27 22:50:12 +02:00
8cbfcb016b Remove debugging; Cleanup redundant logic;Add vapp property
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-27 20:26:09 +02:00
4ba7b590ba Debugging & revert override logic
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-27 19:43:07 +02:00
52660e1414 Fix var reference
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-27 17:05:30 +02:00
0ab6aaeaa5 Fix foldername 2022-06-27 16:57:14 +02:00
02c26b2465 Scale down cpu/ram 2022-06-27 16:46:27 +02:00
1842a08a39 Add Gitea;Allow override of helm-chart basedir
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-27 16:32:25 +02:00
0c01f024e9 Increase disksize;Add container image import during firstboot
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-27 16:02:11 +02:00
40489ff373 Housekeeping #2 2022-06-27 15:34:15 +02:00
c491066384 Housekeeping 2022-06-27 15:33:49 +02:00
4c054cc434 Switch module
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-27 14:38:48 +02:00
dcbe6c397f Change tarball scope;Try zeroing disk
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-27 13:55:59 +02:00
cb84a02b6f Readd parse_logic
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-27 12:27:11 +02:00
8f432d3353 Remove debugging;Housekeeping;Rename dict 2022-06-27 10:55:17 +02:00
1cdbcaccaf Filter invalid results
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-27 10:28:27 +02:00
f1c6161bcb Revert debugging;Switch ansible module
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-27 09:56:48 +02:00
123518a787 Debugging versions
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-27 09:54:57 +02:00
2ec6a756b7 Quote whole cli string
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-27 09:27:33 +02:00
a1779be079 Change yq syntax
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-27 09:03:43 +02:00
8ed9b2f754 Fix firstboot logic;Refactor helm chart parsing;Housekeeping
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-27 08:44:16 +02:00
72202d9f21 Fix missing parenthesis;Attempt parsing argo-cd chart
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-26 22:30:10 +02:00
9eb5fbd0a3 Fix component name;Temporarily add ignore_errors
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-26 21:35:41 +02:00
c58ede04c4 Add missing galaxy collection;Fix logic to parse charts for container images;Add ArgoCD
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-26 21:20:16 +02:00
662e8984c3 Fix linting errors; Extend firstboot logic
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-26 21:01:27 +02:00
b7abf25907 Fix version number;Parse, Pull & Compress container images
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-26 20:56:45 +02:00
18fa7742fa Add short pause before first provisioner
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-26 18:48:06 +02:00
f6993c2052 Remove redundant quotes
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-26 18:32:05 +02:00
59d1730ca5 Update var reference #2
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-26 18:24:57 +02:00
b087203cfb Update var reference
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-26 18:06:15 +02:00
d39d594bf0 Reorganize vars dict;Parse & loop through dict key/values
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-26 17:54:19 +02:00
487239365e Remove debugging;Set loop_control label
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-25 23:57:55 +02:00
6ea03d152c Debugging paths
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-25 23:43:20 +02:00
01991435ae Remove loop redundancy
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-25 23:32:29 +02:00
a64b5b2325 Fix missing quote
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-25 21:14:47 +02:00
38d7442025 Remove redundant tasks
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-25 21:03:42 +02:00
cf91519076 Add jinja filter
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-25 20:48:15 +02:00
bae044e145 Fix misaligned var references
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-25 20:23:27 +02:00
f39b4bbb62 Try dynamic logic for archived/compressed/flat static binaries
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-25 18:44:43 +02:00
9739c51100 Fix var reference
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-25 08:49:53 +02:00
0df98d4341 Quote special char string
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-25 08:33:12 +02:00
fc23dc068d Fix var reference;Install packages;Change DHCP identifier to MAC
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-25 08:28:44 +02:00
4d78d65ad8 Add missing role reference
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-25 01:13:37 +02:00
c1440d9dcd Add ansible galaxy collection requirements
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-25 01:08:11 +02:00
4a5f390ae1 Fix linting errors
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-25 00:54:36 +02:00
e0a5b5a5da Reorganize dependencies/components;Fix folder name
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-25 00:50:44 +02:00
081aaaaa19 Fix/Replace old references;Fix syntaxes
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-24 23:55:54 +02:00
2bd0f8df0a Initial build based on 22.04
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-24 23:44:10 +02:00
2c57dbcddc Fix boot kernel command;Rename files&folders
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-22 11:40:25 +02:00
0f01e803f2 First attempt at 22.04
Some checks failed
continuous-integration/drone/push Build is failing
2022-06-22 11:20:14 +02:00
55 changed files with 1417 additions and 109 deletions

View File

@@ -14,29 +14,32 @@ steps:
- name: Debugging information - name: Debugging information
image: bv11-cr01.bessems.eu/library/packer-extended image: bv11-cr01.bessems.eu/library/packer-extended
commands: commands:
- yamllint --version
- packer --version
- ansible --version - ansible --version
- ovftool --version - ovftool --version
- name: Ubuntu Server 20.04 - packer --version
- yamllint --version
- name: Kubernetes Bootstrap Appliance
image: bv11-cr01.bessems.eu/library/packer-extended image: bv11-cr01.bessems.eu/library/packer-extended
pull: always pull: always
commands: commands:
- | - |
sed -i -e "s/<<img-password>>/$${SSH_PASSWORD}/g" \ sed -i -e "s/<<img-password>>/$${SSH_PASSWORD}/g" \
packer/preseed/UbuntuServer20.04/user-data packer/preseed/UbuntuServer22.04/user-data
- | - |
yamllint -d "{extends: relaxed, rules: {line-length: disable}}" \ yamllint -d "{extends: relaxed, rules: {line-length: disable}}" \
ansible \ ansible \
packer/preseed/UbuntuServer20.04/user-data \ packer/preseed/UbuntuServer22.04/user-data \
scripts scripts
- |
ansible-galaxy install \
-r ansible/requirements.yml
- | - |
packer init -upgrade \ packer init -upgrade \
./packer ./packer
- | - |
packer validate \ packer validate \
-var vm_name=$DRONE_BUILD_NUMBER-${DRONE_COMMIT_SHA:0:10} \ -var vm_name=$DRONE_BUILD_NUMBER-${DRONE_COMMIT_SHA:0:10} \
-var vm_guestos=ubuntuserver20.04 \ -var vm_guestos=k8sbootstrap \
-var repo_username=$${REPO_USERNAME} \ -var repo_username=$${REPO_USERNAME} \
-var repo_password=$${REPO_PASSWORD} \ -var repo_password=$${REPO_PASSWORD} \
-var vsphere_password=$${VSPHERE_PASSWORD} \ -var vsphere_password=$${VSPHERE_PASSWORD} \
@@ -46,7 +49,7 @@ steps:
packer build \ packer build \
-on-error=cleanup -timestamp-ui \ -on-error=cleanup -timestamp-ui \
-var vm_name=$DRONE_BUILD_NUMBER-${DRONE_COMMIT_SHA:0:10} \ -var vm_name=$DRONE_BUILD_NUMBER-${DRONE_COMMIT_SHA:0:10} \
-var vm_guestos=ubuntuserver20.04 \ -var vm_guestos=k8sbootstrap \
-var repo_username=$${REPO_USERNAME} \ -var repo_username=$${REPO_USERNAME} \
-var repo_password=$${REPO_PASSWORD} \ -var repo_password=$${REPO_PASSWORD} \
-var vsphere_password=$${VSPHERE_PASSWORD} \ -var vsphere_password=$${VSPHERE_PASSWORD} \

View File

@@ -1 +1 @@
# Packer.Images [![Build Status](https://ci.spamasaurus.com/api/badges/djpbessems/Packer.Images/status.svg?ref=refs/heads/Windows10)](https://ci.spamasaurus.com/djpbessems/Packer.Images) # Packer.Images [![Build Status](https://ci.spamasaurus.com/api/badges/djpbessems/Packer.Images/status.svg?ref=refs/heads/Kubernetes.Bootstrap.Appliance)](https://ci.spamasaurus.com/djpbessems/Packer.Images)

View File

@@ -1,7 +1,12 @@
--- ---
- hosts: all - hosts: all
gather_facts: false gather_facts: false
vars_files:
- metacluster.yml
- workloadcluster.yml
become: true become: true
roles: roles:
- os - os
- firstboot - firstboot
- appliance
- metacluster

4
ansible/requirements.yml Normal file
View File

@@ -0,0 +1,4 @@
collections:
- ansible.utils
- community.general
- kubernetes.core

View File

@@ -0,0 +1,27 @@
---
- name: Initialize tempfolder
ansible.builtin.tempfile:
state: directory
register: archive
- name: Download & extract archived static binary
ansible.builtin.unarchive:
src: "{{ item.url }}"
dest: "{{ archive.path }}"
remote_src: yes
extra_opts: "{{ item.extra_opts | default(omit) }}"
- name: Install extracted binary
ansible.builtin.copy:
src: "{{ archive.path }}/{{ item.filename }}"
dest: /usr/local/bin/{{ item.filename }}
remote_src: yes
owner: root
group: root
mode: 0755
- name: Cleanup tempfolder
ansible.builtin.file:
path: "{{ archive.path }}"
state: absent
when: archive.path is defined

View File

@@ -0,0 +1,53 @@
# - name: Create folder structure(s)
# ansible.builtin.file:
# path: "{{ item }}"
# state: directory
# loop:
# - /foo
- name: Download & install static binaries
ansible.builtin.get_url:
url: "{{ item.url }}"
url_username: "{{ item.username | default(omit) }}"
url_password: "{{ item.password | default(omit) }}"
dest: /usr/local/bin/{{ item.filename }}
owner: root
group: root
mode: 0755
loop: "{{ dependencies.static_binaries | selectattr('archive', 'undefined') }}"
loop_control:
label: "{{ item.filename }}"
- name: Download, extract & install archived static binaries
include_tasks: dependencies.archive_compressed.yml
loop: "{{ dependencies.static_binaries | rejectattr('archive', 'undefined') | selectattr('archive', 'equalto', 'compressed') }}"
loop_control:
label: "{{ item.filename }}"
- name: Install ansible-galaxy collections
ansible.builtin.shell:
cmd: ansible-galaxy collection install {{ item }}
loop: "{{ dependencies.ansible_galaxy_collections }}"
- name: Install distro packages
ansible.builtin.apt:
pkg: "{{ dependencies.packages.apt }}"
state: latest
update_cache: yes
install_recommends: no
- name: Upgrade all packages
ansible.builtin.apt:
name: '*'
state: latest
update_cache: yes
- name: Install additional python packages
ansible.builtin.pip:
name: "{{ dependencies.packages.pip }}"
state: latest
- name: Cleanup apt cache
ansible.builtin.apt:
autoremove: yes
purge: yes

View File

@@ -0,0 +1,2 @@
- name: Install & configure dependencies
import_tasks: dependencies.yml

View File

@@ -2,9 +2,23 @@
- hosts: 127.0.0.1 - hosts: 127.0.0.1
connection: local connection: local
gather_facts: false gather_facts: false
vars_files:
- metacluster.yml
# become: true # become: true
roles: roles:
- vapp - vapp
- network - network
- users - users
- disks
- metacluster
- workloadcluster
- tty
- cleanup - cleanup
handlers:
- name: Apply manifests
kubernetes.core.k8s:
src: "{{ item }}"
state: present
kubeconfig: "{{ kubeconfig.path }}"
with_fileglob: /var/lib/rancher/k3s/server/manifests/*.yaml
ignore_errors: yes

View File

@@ -2,19 +2,7 @@
ansible.builtin.cron: ansible.builtin.cron:
name: firstboot name: firstboot
state: absent state: absent
- name: Restore extra tty
ansible.builtin.lineinfile:
path: /etc/systemd/logind.conf
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
loop:
- { regexp: '^NAutoVTs=', line: '#NAutoVTs=6'}
- { regexp: '^ReserveVT=', line: '#ReserveVT=6'}
- name: Unmask getty@tty1 service
ansible.builtin.systemd:
name: getty@tty1
enabled: yes
masked: no
- name: Reboot host - name: Reboot host
ansible.builtin.shell: ansible.builtin.shell:
cmd: /usr/sbin/reboot now cmd: /usr/sbin/reboot now

View File

@@ -0,0 +1,24 @@
- name: Create volume group
community.general.lvg:
vg: longhorn_vg
pvs:
- /dev/sdb
pvresize: yes
- name: Create logical volume
community.general.lvol:
vg: longhorn_vg
lv: longhorn_lv
size: 100%VG
- name: Create filesystem
community.general.filesystem:
dev: /dev/mapper/longhorn_vg-longhorn_lv
fstype: ext4
- name: Mount dynamic disk
ansible.posix.mount:
path: /mnt/blockstorage
src: /dev/mapper/longhorn_vg-longhorn_lv
fstype: ext4
state: mounted

View File

@@ -0,0 +1,12 @@
- name: Extract container images
ansible.builtin.unarchive:
src: /opt/metacluster/container-images/image-tarballs.tgz
dest: /opt/metacluster/container-images
list_files: yes
register: imagetarballs
- name: Import container images
ansible.builtin.command:
cmd: k3s ctr image import {{ item }}
chdir: /opt/metacluster/container-images
loop: "{{ imagetarballs.files }}"

View File

@@ -0,0 +1,102 @@
- name: Install step-ca chart
kubernetes.core.helm:
name: step-certificates
chart_ref: /opt/metacluster/helm-charts/step-certificates
release_namespace: step-ca
create_namespace: yes
wait: yes
kubeconfig: "{{ kubeconfig.path }}"
values: "{{ components.stepcertificates.chart_values }}"
- block:
- name: Retrieve configmap w/ root certificate
kubernetes.core.k8s_info:
kind: ConfigMap
name: step-certificates-certs
namespace: step-ca
kubeconfig: "{{ kubeconfig.path }}"
register: stepca_cm_certs
- name: Store root certificate in namespaced secrets
kubernetes.core.k8s:
state: present
definition:
apiVersion: v1
kind: Secret
metadata:
name: step-certificates-certs
namespace: "{{ item }}"
data:
root_ca.crt: "{{ stepca_cm_certs.resources[0].data['root_ca.crt'] | b64encode }}"
kubeconfig: "{{ kubeconfig.path }}"
loop:
- argo-cd
- kube-system
tags:
- never
- final
- name: Configure step-ca passthrough ingress
ansible.builtin.template:
src: ingressroutetcp.j2
dest: /var/lib/rancher/k3s/server/manifests/{{ _template.name }}-manifest.yaml
owner: root
group: root
mode: 0600
vars:
_template:
name: step-ca
namespace: step-ca
config: |2
entryPoints:
- websecure
routes:
- match: HostSNI(`ca.{{ vapp['metacluster.fqdn'] }}`)
services:
- name: step-certificates
port: 443
tls:
passthrough: true
notify:
- Apply manifests
- name: Inject step-ca certificate into traefik container
ansible.builtin.blockinfile:
path: /var/lib/rancher/k3s/server/manifests/traefik-config.yaml
block: |2
volumes:
- name: step-certificates-certs
mountPath: /step-ca
type: configMap
env:
- name: LEGO_CA_CERTIFICATES
value: /step-ca/root_ca.crt
marker: ' # {mark} ANSIBLE MANAGED BLOCK'
tags:
- never
- final
notify:
- Apply manifests
- name: Trigger handlers
ansible.builtin.meta: flush_handlers
- name: Retrieve step-ca configuration
kubernetes.core.k8s_info:
kind: ConfigMap
name: step-certificates-config
namespace: step-ca
kubeconfig: "{{ kubeconfig.path }}"
register: stepca_cm_config
- name: Install root CA in system truststore
ansible.builtin.shell:
cmd: >-
step ca bootstrap \
--ca-url=https://ca.{{ vapp['metacluster.fqdn'] }} \
--fingerprint={{ stepca_cm_config.resources[0].data['defaults.json'] | from_json | json_query('fingerprint') }} \
--install \
--force
update-ca-certificates

View File

@@ -0,0 +1,24 @@
# - name: Create component entries in /etc/hosts
# ansible.builtin.lineinfile:
# path: /etc/hosts
# line: "{{ vapp['guestinfo.ipaddress'] }} {{ item + '.' + vapp['metacluster.fqdn'] }}"
# state: present
# loop:
# # TODO: Make this list dynamic
# - git
# - gitops
# - ingress
# - registry
# - storage
- name: Delete container image tarballs/archives
ansible.builtin.file:
path: "{{ item }}"
state: absent
with_fileglob: /opt/metacluster/container-images/*.tar
- name: Cleanup tempfile
ansible.builtin.file:
path: "{{ kubeconfig.path }}"
state: absent
when: kubeconfig.path is defined

View File

@@ -0,0 +1,137 @@
- block:
- name: Install gitea chart
kubernetes.core.helm:
name: gitea
chart_ref: /opt/metacluster/helm-charts/gitea
release_namespace: gitea
create_namespace: yes
wait: yes
kubeconfig: "{{ kubeconfig.path }}"
values: "{{ components.gitea.chart_values }}"
- name: Configure additional SSH ingress
ansible.builtin.template:
src: ingressroutetcp.j2
dest: /var/lib/rancher/k3s/server/manifests/{{ _template.name }}-manifest.yaml
owner: root
group: root
mode: 0600
vars:
_template:
name: gitea-ssh
namespace: gitea
config: |2
entryPoints:
- ssh
routes:
- match: HostSNI(`*`)
services:
- name: gitea-ssh
port: 22
notify:
- Apply manifests
- name: Trigger handlers
ansible.builtin.meta: flush_handlers
- name: Ensure gitea API availability
ansible.builtin.uri:
url: https://git.{{ vapp['metacluster.fqdn'] }}/api/healtz
method: GET
register: api_readycheck
until: api_readycheck.json.status | default(false) | bool
retries: 3
delay: 30
- name: Generate gitea API token
ansible.builtin.uri:
url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/users/administrator/tokens
method: POST
user: administrator
password: "{{ vapp['guestinfo.rootpw'] }}"
force_basic_auth: yes
body:
name: token_init_{{ lookup('password', '/dev/null length=5 chars=ascii_letters,digits') }}
register: gitea_api_token
- name: Retrieve existing gitea configuration
ansible.builtin.uri:
url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/repos/search
method: GET
register: gitea_existing_config
- block:
- name: Register SSH public key
ansible.builtin.uri:
url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/user/keys
method: POST
headers:
Authorization: token {{ gitea_api_token.json.sha1 }}
body:
key: "{{ gitops_sshkey.public_key }}"
read_only: false
title: GitOps
- name: Create organization(s)
ansible.builtin.uri:
url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/orgs
method: POST
headers:
Authorization: token {{ gitea_api_token.json.sha1 }}
body: "{{ item }}"
loop:
- full_name: Meta-cluster
description: Meta-cluster configuration items
username: mc
website: https://git.{{ vapp['metacluster.fqdn'] }}/mc
location: '[...]'
visibility: public
- full_name: Workload-cluster
description: Workload-cluster configuration items
username: wl
website: https://git.{{ vapp['metacluster.fqdn'] }}/wl
location: '[...]'
visibility: public
loop_control:
label: "{{ item.full_name }}"
- name: Create repositories
ansible.builtin.uri:
url: https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/orgs/{{ item.organization }}/repos
method: POST
headers:
Authorization: token {{ gitea_api_token.json.sha1 }}
body: "{{ item.body }}"
loop:
- organization: mc
body:
name: GitOps.Config
# auto_init: true
# default_branch: main
description: GitOps manifests
- organization: wl
body:
name: Template.GitOps.Config
# auto_init: true
# default_branch: main
description: GitOps manifests
loop_control:
label: "{{ item.organization + '/' + item.body.name }}"
- name: Rebase/Push source gitops repository
ansible.builtin.shell:
cmd: |
git config --local http.sslVerify false
git remote set-url origin https://administrator:{{ vapp['guestinfo.rootpw'] | urlencode }}@git.{{ vapp['metacluster.fqdn'] }}/mc/GitOps.Config.git
git push
chdir: /opt/metacluster/git-repositories/gitops
when: (gitea_existing_config.json is undefined) or (gitea_existing_config.json.data | length == 0)
module_defaults:
ansible.builtin.uri:
validate_certs: no
status_code: [200, 201]
body_format: json

View File

@@ -0,0 +1,58 @@
- block:
- name: Install argo-cd chart
kubernetes.core.helm:
name: argo-cd
chart_ref: /opt/metacluster/helm-charts/argo-cd
release_namespace: argo-cd
create_namespace: yes
wait: yes
kubeconfig: "{{ kubeconfig.path }}"
values: "{{ components.argocd.chart_values }}"
- name: Ensure argo-cd API availability
ansible.builtin.uri:
url: https://gitops.{{ vapp['metacluster.fqdn'] }}/api/version
method: GET
register: api_readycheck
until: api_readycheck.json.Version | default(false) | bool
retries: 3
delay: 30
- name: Generate argo-cd API token
ansible.builtin.uri:
url: https://gitops.{{ vapp['metacluster.fqdn'] }}/api/v1/session
method: POST
force_basic_auth: yes
body:
username: admin
password: "{{ vapp['guestinfo.rootpw'] }}"
register: argocd_api_token
# - name: Create umbrella application
# ansible.builtin.template:
#
- name: Configure metacluster-gitops repository
ansible.builtin.template:
src: gitrepo.j2
dest: /var/lib/rancher/k3s/server/manifests/{{ _template.name }}-manifest.yaml
owner: root
group: root
mode: 0600
vars:
_template:
name: argocd-gitrepo-metacluster
namespace: argo-cd
uid: "{{ lookup('ansible.builtin.password', '/dev/null length=5 chars=ascii_lowercase,digits seed=inventory_hostname') }}"
privatekey: "{{ lookup('ansible.builtin.file', '~/.ssh/git_rsa_id') | indent(4, true) }}"
notify:
- Apply manifests
- name: Trigger handlers
ansible.builtin.meta: flush_handlers
module_defaults:
ansible.builtin.uri:
validate_certs: no
status_code: [200, 201]
body_format: json

View File

@@ -0,0 +1,26 @@
- name: Configure traefik dashboard ingress
ansible.builtin.template:
src: ingressroute.j2
dest: /var/lib/rancher/k3s/server/manifests/{{ _template.name }}-manifest.yaml
owner: root
group: root
mode: 0600
vars:
_template:
name: traefik-dashboard
namespace: kube-system
config: |2
entryPoints:
- web
- websecure
routes:
- kind: Rule
match: Host(`ingress.{{ vapp['metacluster.fqdn'] }}`)
services:
- kind: TraefikService
name: api@internal
notify:
- Apply manifests
- name: Trigger handlers
ansible.builtin.meta: flush_handlers

View File

@@ -0,0 +1,42 @@
- name: Gather service facts
ansible.builtin.service_facts:
# Module requires no attributes
- name: Install K3s
ansible.builtin.command:
cmd: ./install.sh
chdir: /opt/metacluster/k3s
environment:
INSTALL_K3S_SKIP_DOWNLOAD: 'true'
INSTALL_K3S_EXEC: 'server --cluster-init --disable local-storage'
when: ansible_facts.services['k3s.service'] is undefined
- name: Ensure API availability
ansible.builtin.uri:
url: https://{{ vapp['guestinfo.ipaddress'] }}:6443/livez?verbose
method: GET
register: api_readycheck
until: api_readycheck.json.apiVersion | default(false) | bool
retries: 3
delay: 30
- name: Install kubectl tab-completion
ansible.builtin.shell:
cmd: kubectl completion bash | tee /etc/bash_completion.d/kubectl
- name: Initialize tempfile
ansible.builtin.tempfile:
state: file
register: kubeconfig
- name: Retrieve kubeconfig
ansible.builtin.command:
cmd: kubectl config view --raw
register: kubectl_config
- name: Store kubeconfig in tempfile
ansible.builtin.copy:
dest: "{{ kubeconfig.path }}"
content: "{{ kubectl_config.stdout }}"
mode: 0600
no_log: true

View File

@@ -0,0 +1,12 @@
- import_tasks: k3s.yml
- import_tasks: assets.yml
- import_tasks: ingress.yml
- import_tasks: storage.yml
- import_tasks: certauthority.yml
- import_tasks: registry.yml
- import_tasks: git.yml
- import_tasks: gitops.yml
- import_tasks: certauthority.yml
tags: final
- import_tasks: cleanup.yml

View File

@@ -0,0 +1,35 @@
- name: Install harbor chart
kubernetes.core.helm:
name: harbor
chart_ref: /opt/metacluster/helm-charts/harbor
release_namespace: harbor
create_namespace: yes
wait: yes
kubeconfig: "{{ kubeconfig.path }}"
values: "{{ components.harbor.chart_values }}"
- name: Push images to registry
ansible.builtin.shell:
cmd: >-
skopeo copy \
--insecure-policy \
--dest-tls-verify=false \
--dest-creds admin:{{ vapp['guestinfo.rootpw'] }} \
docker-archive:./{{ item }} \
docker://registry.{{ vapp['metacluster.fqdn'] }}/library/$( \
skopeo list-tags \
--insecure-policy \
docker-archive:./{{ item }} | \
jq -r '.Tags[0]')
chdir: /opt/metacluster/container-images/
loop: "{{ imagetarballs.files }}"
- name: Configure K3s node for private registry
ansible.builtin.template:
dest: /etc/rancher/k3s/registries.yaml
src: registries.j2
notify:
- Apply manifests
- name: Trigger handlers
ansible.builtin.meta: flush_handlers

View File

@@ -0,0 +1,9 @@
- name: Install longhorn chart
kubernetes.core.helm:
name: longhorn
chart_ref: /opt/metacluster/helm-charts/longhorn
release_namespace: longhorn-system
create_namespace: yes
wait: yes
kubeconfig: "{{ kubeconfig.path }}"
values: "{{ components.longhorn.chart_values }}"

View File

@@ -1,10 +1,12 @@
- name: Set hostname - name: Set hostname
ansible.builtin.hostname: ansible.builtin.hostname:
name: "{{ ovfproperties['guestinfo.hostname'] }}" name: "{{ vapp['guestinfo.hostname'] }}"
- name: Create netplan configuration file - name: Create netplan configuration file
ansible.builtin.template: ansible.builtin.template:
src: netplan.j2 src: netplan.j2
dest: /etc/netplan/00-installer-config.yaml dest: /etc/netplan/00-installer-config.yaml
- name: Apply netplan configuration - name: Apply netplan configuration
ansible.builtin.shell: ansible.builtin.shell:
cmd: /usr/sbin/netplan apply cmd: /usr/sbin/netplan apply

View File

@@ -3,8 +3,8 @@ network:
ethernets: ethernets:
ens192: ens192:
addresses: addresses:
- {{ ovfproperties['guestinfo.ipaddress'] }}/{{ ovfproperties['guestinfo.prefixlength'] }} - {{ vapp['guestinfo.ipaddress'] }}/{{ vapp['guestinfo.prefixlength'] }}
gateway4: {{ ovfproperties['guestinfo.gateway'] }} gateway4: {{ vapp['guestinfo.gateway'] }}
nameservers: nameservers:
addresses: addresses:
- {{ ovfproperties['guestinfo.dnsserver'] }} - {{ vapp['guestinfo.dnsserver'] }}

View File

@@ -0,0 +1,20 @@
- name: Create folder structure(s)
ansible.builtin.file:
path: "{{ item }}"
state: directory
loop:
- /opt/firstboot
- name: Save tty script file
ansible.builtin.template:
src: tty.j2
dest: /opt/firstboot/tty.sh
owner: root
group: root
mode: 0700
- name: Create @reboot crontab job
ansible.builtin.cron:
name: tty.consolemessage
special_time: reboot
job: /opt/firstboot/tty.sh

View File

@@ -1,14 +1,16 @@
- name: Set root password - name: Set root password
ansible.builtin.user: ansible.builtin.user:
name: root name: root
password: "{{ ovfproperties['guestinfo.rootpw'] | password_hash('sha512', 65534 | random(seed=ovfproperties['guestinfo.hostname']) | string) }}" password: "{{ vapp['guestinfo.rootpw'] | password_hash('sha512', 65534 | random(seed=vapp['guestinfo.hostname']) | string) }}"
generate_ssh_key: yes generate_ssh_key: yes
ssh_key_bits: 2048 ssh_key_bits: 2048
ssh_key_file: .ssh/id_rsa ssh_key_file: .ssh/id_rsa
- name: Save root SSH publickey - name: Save root SSH publickey
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /root/.ssh/authorized_keys path: /root/.ssh/authorized_keys
line: "{{ ovfproperties['guestinfo.rootsshkey'] }}" line: "{{ vapp['guestinfo.rootsshkey'] }}"
- name: Disable SSH password authentication - name: Disable SSH password authentication
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config path: /etc/ssh/sshd_config
@@ -16,8 +18,18 @@
line: "{{ item.line }}" line: "{{ item.line }}"
state: "{{ item.state }}" state: "{{ item.state }}"
loop: loop:
- { regex: '^#PasswordAuthentication', line: 'PasswordAuthentication no', state: present} - regex: '^#PasswordAuthentication'
- { regex: '^PasswordAuthentication yes', line: 'PasswordAuthentication yes', state: absent} line: 'PasswordAuthentication no'
state: present
- regex: '^PasswordAuthentication yes'
line: 'PasswordAuthentication yes'
state: absent
- name: Create dedicated SSH keypair
community.crypto.openssh_keypair:
path: /root/.ssh/git_rsa_id
register: gitops_sshkey
- name: Delete 'ubuntu' user - name: Delete 'ubuntu' user
ansible.builtin.user: ansible.builtin.user:
name: ubuntu name: ubuntu

View File

@@ -2,6 +2,21 @@
ansible.builtin.shell: ansible.builtin.shell:
cmd: /usr/bin/vmtoolsd --cmd "info-get guestinfo.ovfEnv" cmd: /usr/bin/vmtoolsd --cmd "info-get guestinfo.ovfEnv"
register: ovfenv register: ovfenv
- name: Parse XML for MoRef ID
community.general.xml:
xmlstring: "{{ ovfenv.stdout }}"
namespaces:
ns: http://schemas.dmtf.org/ovf/environment/1
ve: http://www.vmware.com/schema/ovfenv
xpath: /ns:Environment
content: attribute
register: environment_attribute
- name: Store MoRef ID
ansible.builtin.set_fact:
moref_id: "{{ ((environment_attribute.matches[0].values() | list)[0].values() | list)[1] }}"
- name: Parse XML for vApp properties - name: Parse XML for vApp properties
community.general.xml: community.general.xml:
xmlstring: "{{ ovfenv.stdout }}" xmlstring: "{{ ovfenv.stdout }}"
@@ -9,13 +24,15 @@
ns: http://schemas.dmtf.org/ovf/environment/1 ns: http://schemas.dmtf.org/ovf/environment/1
xpath: /ns:Environment/ns:PropertySection/ns:Property xpath: /ns:Environment/ns:PropertySection/ns:Property
content: attribute content: attribute
register: ovfenv register: property_section
- name: Assign vApp properties to dictionary - name: Assign vApp properties to dictionary
ansible.builtin.set_fact: ansible.builtin.set_fact:
ovfproperties: >- vapp: >-
{{ ovfproperties | default({}) | {{ vapp | default({}) | combine({
combine({((item.values() | list)[0].values() | list)[0]: ((item.values() | list)[0].values() | list)[0]:
((item.values() | list)[0].values() | list)[1]}) ((item.values() | list)[0].values() | list)[1]})
}} }}
loop: "{{ ovfenv.matches }}" loop: "{{ property_section.matches }}"
no_log: true loop_control:
label: "{{ ((item.values() | list)[0].values() | list)[0] }}"

View File

@@ -0,0 +1,106 @@
- block:
- name: Gather hypervisor details
ansible.builtin.shell:
cmd: govc ls -L {{ item.moref }} | awk -F/ '{print ${{ item.part }}}'
environment:
GOVC_INSECURE: '1'
GOVC_URL: "{{ vapp['hv.fqdn'] }}"
GOVC_USERNAME: "{{ vapp['hv.username'] }}"
GOVC_PASSWORD: "{{ vapp['hv.password'] }}"
register: govc_inventory
loop:
- attribute: cluster
moref: >-
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
jq -r '.[] | select(.Name == "runtime").Val.Host | .Type + ":" + .Value')
part: (NF-1)
- attribute: datacenter
moref: VirtualMachine:{{ moref_id }}
part: 2
- attribute: datastore
moref: >-
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
jq -r '.[] | select(.Name == "datastore").Val.ManagedObjectReference | .[].Type + ":" + .[].Value')
part: NF
- attribute: folder
moref: >-
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
jq -r '.[] | select(.Name == "parent").Val | .Type + ":" + .Value')
part: 0
# - attribute: host
# moref: >-
# $(govc object.collect -json VirtualMachine:{{ moref_id }} | \
# jq -r '.[] | select(.Name == "runtime").Val.Host | .Type + ":" + .Value')
# part: NF
- attribute: network
moref: >-
$(govc object.collect -json VirtualMachine:{{ moref_id }} | \
jq -r '.[] | select(.Name == "network").Val.ManagedObjectReference | .[].Type + ":" + .[].Value')
part: NF
loop_control:
label: "{{ item.attribute }}"
- name: Store hypervisor details in dictionary
ansible.builtin.set_fact:
vcenter_info: "{{ vcenter_info | default({}) | combine({ item.item.attribute : item.stdout }) }}"
loop: "{{ govc_inventory.results }}"
loop_control:
label: "{{ item.item.attribute }}"
- block:
- name: Check for existing templates on hypervisor
community.vmware.vmware_guest_info:
name: "{{ (item | basename | split('.'))[:-1] | join('.') }}"
register: existing_ova
with_fileglob: /opt/workloadcluster/node-templates/*.ova
ignore_errors: yes
- name: Parse OVA files for network mappings
ansible.builtin.shell:
cmd: govc import.spec -json {{ item }}
environment:
GOVC_INSECURE: '1'
GOVC_URL: "{{ vapp['hv.fqdn'] }}"
GOVC_USERNAME: "{{ vapp['hv.username'] }}"
GOVC_PASSWORD: "{{ vapp['hv.password'] }}"
register: ova_spec
when: existing_ova.results[index] is failed
with_fileglob: /opt/workloadcluster/node-templates/*.ova
loop_control:
index_var: index
- name: Deploy OVA templates on hypervisor
community.vmware.vmware_deploy_ovf:
cluster: "{{ vcenter_info.cluster }}"
datastore: "{{ vcenter_info.datastore }}"
folder: "{{ vcenter_info.folder }}"
name: "{{ (item | basename | split('.'))[:-1] | join('.') }}"
networks: "{u'{{ ova_spec.results[index].stdout | from_json | json_query('NetworkMapping[0].Name') }}':u'{{ vcenter_info.network }}'}"
allow_duplicates: no
power_on: false
ovf: "{{ item }}"
register: ova_deploy
when: existing_ova.results[index] is failed
with_fileglob: /opt/workloadcluster/node-templates/*.ova
loop_control:
index_var: index
- name: Mark deployed VM's as templates
community.vmware.vmware_guest:
name: "{{ item.instance.hw_name }}"
is_template: yes
when: ova_deploy.results[index] is not skipped
loop: "{{ ova_deploy.results }}"
loop_control:
index_var: index
label: "{{ item.item }}"
module_defaults:
group/vmware:
hostname: "{{ vapp['hv.fqdn'] }}"
validate_certs: no
username: "{{ vapp['hv.username'] }}"
password: "{{ vapp['hv.password'] }}"
datacenter: "{{ vcenter_info.datacenter }}"

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ _template.name }}-{{ _template.uid }}
namespace: {{ _template.namespace }}
labels:
argocd.argoproj.io/secret-type: repository
stringData:
url: ssh://git@gitea-ssh.gitea.svc.cluster.local/mc/GitOps.Config.git
name: {{ _template.name }}
insecure: 'true'
sshPrivateKey: |
{{ _template.privatekey }}

View File

@@ -0,0 +1,7 @@
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: {{ _template.name }}
namespace: {{ _template.namespace }}
spec:
{{ _template.config }}

View File

@@ -0,0 +1,7 @@
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteTCP
metadata:
name: {{ _template.name }}
namespace: {{ _template.namespace }}
spec:
{{ _template.config }}

View File

@@ -0,0 +1,25 @@
mirrors:
cr.step.cm:
endpoint:
- https://registry.{{ vapp['metacluster.fqdn'] }}
rewrite:
"(.*)": "library/cr.step.sm/$1"
docker.io:
endpoint:
- https://registry.{{ vapp['metacluster.fqdn'] }}
rewrite:
"(.*)": "library/docker.io/$1"
ghcr.io:
endpoint:
- https://registry.{{ vapp['metacluster.fqdn'] }}
rewrite:
"(.*)": "library/ghcr.io/$1"
quay.io:
endpoint:
- https://registry.{{ vapp['metacluster.fqdn'] }}
rewrite:
"(.*)": "library/quay.io/$1"
configs:
registry.{{ vapp['metacluster.fqdn'] }}:
tls:
insecure_skip_verify: true

View File

@@ -0,0 +1,42 @@
#!/bin/bash
export TERM=linux
BGRN='\033[1;92m'
BGRY='\033[1;30m'
BBLU='\033[1;34m'
BRED='\033[1;91m'
BWHI='\033[1;97m'
CBLA='\033[?16;0;30c' # Hide blinking cursor
DFLT='\033[0m' # Reset colour
LCLR='\033[K' # Clear to end of line
PRST='\033[0;0H' # Reset cursor position
# COMPONENTS=('ca' 'ingress' 'storage' 'registry' 'git' 'gitops')
COMPONENTS=('ca' 'storage' 'registry' 'git' 'gitops')
FQDN='{{ vapp['metacluster.fqdn'] }}'
IPADDRESS='{{ vapp['guestinfo.ipaddress'] }}'
# Waiting to allow boot sequence to finish; crude!
sleep 30
clear > /dev/tty1
while /bin/true; do
echo -e "${PRST}" > /dev/tty1
echo -e "\n\n\t${DFLT}To manage this appliance, please connect to one of the following:${LCLR}\n" > /dev/tty1
for c in "${COMPONENTS[@]}"; do
STATUS=$(curl -ks "https://${c}.${FQDN}" -o /dev/null -w '%{http_code}')
if [[ "${STATUS}" -eq "200" ]]; then
echo -e "\t [${BGRN}+${DFLT}] ${BBLU}https://${c}.${FQDN}${DFLT}${LCLR}" > /dev/tty1
else
echo -e "\t [${BRED}-${DFLT}] ${BBLU}https://${c}.${FQDN}${DFLT}${LCLR}" > /dev/tty1
fi
done
echo -e "\n\t${BGRY}Note that your DNS zone ${DFLT}must have${BGRY} respective records defined,\n\teach pointing to: ${DFLT}${IPADDRESS}${LCLR}" > /dev/tty1
echo -e "${CBLA}" > /dev/tty1
sleep 1
done

View File

@@ -2,6 +2,7 @@
ansible.builtin.file: ansible.builtin.file:
path: /opt/firstboot path: /opt/firstboot
state: directory state: directory
- name: Create firstboot script file - name: Create firstboot script file
ansible.builtin.template: ansible.builtin.template:
src: firstboot.j2 src: firstboot.j2
@@ -9,11 +10,13 @@
owner: root owner: root
group: root group: root
mode: o+x mode: o+x
- name: Create @reboot crontab job - name: Create @reboot crontab job
ansible.builtin.cron: ansible.builtin.cron:
name: firstboot name: firstboot
special_time: reboot special_time: reboot
job: "/opt/firstboot/firstboot.sh" job: "/opt/firstboot/firstboot.sh >/dev/tty1 2>&1"
- name: Copy payload folder - name: Copy payload folder
ansible.builtin.copy: ansible.builtin.copy:
src: ansible_payload/ src: ansible_payload/
@@ -21,6 +24,3 @@
owner: root owner: root
group: root group: root
mode: '0644' mode: '0644'
- name: Install ansible-galaxy collection
ansible.builtin.shell:
cmd: ansible-galaxy collection install community.general

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
# Apply firstboot configuration w/ ansible # Apply firstboot configuration w/ ansible
/usr/local/bin/ansible-playbook /opt/firstboot/ansible/playbook.yml | tee -a /var/log/firstboot.log > /dev/tty1 /usr/local/bin/ansible-playbook /opt/firstboot/ansible/playbook.yml | tee -a /var/log/firstboot.log > /dev/tty1 2>&1

View File

@@ -0,0 +1,4 @@
- name: Zero-out disk
ansible.builtin.shell:
cmd: nice -n 10 dd bs=1M count=$(df -m . | awk '/[0-9]%/{print $(NF-2)}') if=/dev/zero of=./zero; sync; sync; rm -f ./zero
chdir: /opt/metacluster

View File

@@ -0,0 +1,75 @@
- name: Create folder structure(s)
ansible.builtin.file:
path: "{{ item }}"
state: directory
loop:
- /opt/metacluster/helm-charts
- /opt/metacluster/container-images
- name: Add helm repositories
kubernetes.core.helm_repository:
name: "{{ item.name }}"
repo_url: "{{ item.url }}"
state: present
loop: "{{ platform.helm_repositories }}"
- name: Fetch helm charts
ansible.builtin.command:
cmd: helm fetch {{ item.value.helm.chart }} --untar --version {{ item.value.helm.version }}
chdir: /opt/metacluster/helm-charts
loop: "{{ lookup('ansible.builtin.dict', components) }}"
loop_control:
label: "{{ item.key }}"
- block:
- name: Aggregate chart_values into dict
ansible.builtin.set_fact:
chart_values: "{{ chart_values | default({}) | combine({ (item.key | regex_replace('[^A-Za-z0-9]', '')): { 'chart_values': (item.value.helm.chart_values | from_yaml) } }) }}"
when: item.value.helm.chart_values is defined
loop: "{{ lookup('ansible.builtin.dict', components) }}"
loop_control:
label: "{{ item.key }}"
- name: Write dict to vars_file
ansible.builtin.copy:
dest: /opt/firstboot/ansible/vars/metacluster.yml
content: "{{ { 'components': chart_values } | to_nice_yaml(indent=2, width=4096) }}"
- name: Parse helm charts for container images
ansible.builtin.shell:
cmd: "{{ item.value.helm.parse_logic }}"
chdir: /opt/metacluster/helm-charts/{{ item.key }}
register: containerimages
loop: "{{ lookup('ansible.builtin.dict', components) }}"
loop_control:
label: "{{ item.key }}"
- name: Pull and store containerimages
ansible.builtin.shell:
cmd: >-
skopeo copy \
--insecure-policy \
--retry-times=5 \
docker://{{ item }} \
docker-archive:./{{ ( item | regex_findall('[^/:]+'))[-2] }}.tar:{{ item }}
chdir: /opt/metacluster/container-images
loop: "{{ ((containerimages.results | map(attribute='stdout_lines') | flatten) + dependencies.container_images) | unique }}"
# - name: Inject manifests
# ansible.builtin.template:
# src: "{{ item.type }}.j2"
# dest: /var/lib/rancher/k3s/server/manifests/{{ item.name }}-manifest.yaml
# owner: root
# group: root
# mode: 0600
# loop: "{{ lookup('ansible.builtin.dict', components) | map(attribute='value.manifests') | list | select('defined') | flatten }}"
# loop_control:
# label: "{{ item.type + '/' + item.name }}"
- name: Compress tarballs
community.general.archive:
dest: /opt/metacluster/container-images/image-tarballs.tgz
path: /opt/metacluster/container-images/*
format: xz
remove: yes

View File

@@ -0,0 +1,52 @@
- name: Create folder structure(s)
ansible.builtin.file:
path: "{{ item }}"
state: directory
loop:
- /var/lib/rancher/k3s/agent/images
- /var/lib/rancher/k3s/server/manifests
- /opt/metacluster/k3s
- name: Download & install K3s binary
ansible.builtin.get_url:
url: https://github.com/k3s-io/k3s/releases/download/{{ platform.k3s.version }}/k3s
dest: /usr/local/bin/k3s
owner: root
group: root
mode: 0755
register: download
until: download is not failed
retries: 3
delay: 10
- name: Download K3s images tarball
ansible.builtin.get_url:
url: https://github.com/k3s-io/k3s/releases/download/{{ platform.k3s.version }}/k3s-airgap-images-amd64.tar.gz
dest: /var/lib/rancher/k3s/agent/images
register: download
until: download is not failed
retries: 3
delay: 10
- name: Download K3s install script
ansible.builtin.get_url:
url: https://get.k3s.io
dest: /opt/metacluster/k3s/install.sh
owner: root
group: root
mode: 0755
register: download
until: download is not failed
retries: 3
delay: 10
- name: Inject manifests
ansible.builtin.template:
src: helmchartconfig.j2
dest: /var/lib/rancher/k3s/server/manifests/{{ item.name }}-config.yaml
owner: root
group: root
mode: 0600
loop: "{{ platform.packaged_components }}"
loop_control:
label: "{{ item.name }}"

View File

@@ -0,0 +1,11 @@
- name: Pre-stage K3s components
import_tasks: k3s.yml
- name: Pre-stage meta-cluster components
import_tasks: components.yml
- name: Pre-stage meta-cluster configuration and workload-cluster components
import_tasks: staging.yml
- name: Cleanup
import_tasks: cleanup.yml

View File

@@ -0,0 +1,21 @@
- name: Create folder structure(s)
ansible.builtin.file:
path: "{{ item }}"
state: directory
loop:
- /opt/metacluster/git-repositories/gitops
- /opt/workloadcluster/node-templates
- name: Clone git repository
ansible.builtin.git:
repo: "{{ platform.gitops.repository.uri }}"
version: "{{ platform.gitops.repository.revision }}"
dest: /opt/metacluster/git-repositories/gitops
- name: Download node-template images
ansible.builtin.uri:
url: "{{ item.url }}"
dest: /opt/workloadcluster/node-templates/{{ downstream.node_templates.prefix }}{{ item.name }}
loop: "{{ downstream.node_templates.images }}"
loop_control:
label: "{{ downstream.node_templates.prefix }}{{ item.name }}"

View File

@@ -0,0 +1,8 @@
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
name: {{ item.name }}
namespace: {{ item.namespace }}
spec:
valuesContent: |-
{{ item.config }}

View File

@@ -1,6 +0,0 @@
- name: Install ansible (w/ dependencies)
ansible.builtin.pip:
name: "{{ item }}"
executable: pip3
state: latest
loop: "{{ pip_packages }}"

View File

@@ -3,6 +3,7 @@
name: cloud-init name: cloud-init
state: absent state: absent
purge: yes purge: yes
- name: Delete cloud-init files - name: Delete cloud-init files
ansible.builtin.file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"

View File

@@ -15,6 +15,3 @@
- name: Install packages - name: Install packages
import_tasks: packages.yml import_tasks: packages.yml
- name: Install ansible
import_tasks: ansible.yml

View File

@@ -1,14 +1,23 @@
- name: Install additional packages - name: Install additional packages
ansible.builtin.apt: ansible.builtin.apt:
name: "{{ item }}" pkg: "{{ packages.apt }}"
state: latest state: latest
update_cache: yes update_cache: yes
loop: "{{ packages }}" install_recommends: no
- name: Upgrade all packages - name: Upgrade all packages
ansible.builtin.apt: ansible.builtin.apt:
name: "*" name: '*'
state: latest state: latest
update_cache: yes update_cache: yes
- name: Install additional python packages
ansible.builtin.pip:
name: "{{ item }}"
executable: pip3
state: latest
loop: "{{ packages.pip }}"
- name: Cleanup - name: Cleanup
ansible.builtin.apt: ansible.builtin.apt:
autoremove: yes autoremove: yes

View File

@@ -3,14 +3,17 @@
name: snapd name: snapd
state: absent state: absent
purge: yes purge: yes
- name: Delete leftover files - name: Delete leftover files
ansible.builtin.file: ansible.builtin.file:
path: /root/snap path: /root/snap
state: absent state: absent
- name: Hold snapd package - name: Hold snapd package
ansible.builtin.dpkg_selections: ansible.builtin.dpkg_selections:
name: snapd name: snapd
selection: hold selection: hold
- name: Reload systemd unit configurations - name: Reload systemd unit configurations
ansible.builtin.systemd: ansible.builtin.systemd:
daemon_reload: yes daemon_reload: yes

View File

@@ -4,8 +4,11 @@
regexp: "{{ item.regexp }}" regexp: "{{ item.regexp }}"
line: "{{ item.line }}" line: "{{ item.line }}"
loop: loop:
- { regexp: '^#NAutoVTs=', line: 'NAutoVTs=1'} - regexp: '^#NAutoVTs='
- { regexp: '^#ReserveVT=', line: 'ReserveVT=11'} line: 'NAutoVTs=1'
- regexp: '^#ReserveVT='
line: 'ReserveVT=11'
- name: Mask getty@tty1 service - name: Mask getty@tty1 service
ansible.builtin.systemd: ansible.builtin.systemd:
name: getty@tty1 name: getty@tty1

View File

@@ -1,11 +1,12 @@
packages: packages:
apt:
- jq - jq
# (python3-*) Dependency for installation of Ansible
- python3-pip - python3-pip
- python3-setuptools pip:
- python3-wheel
pip_packages:
- pip
- ansible-core - ansible-core
- jinja2
- lxml - lxml
- markupsafe
- pip
- setuptools
- wheel

View File

@@ -0,0 +1,230 @@
platform:
k3s:
version: v1.24.1+k3s1
gitops:
repository:
uri: https://code.spamasaurus.com/djpbessems/GitOps.MetaCluster.git
# revision: v0.1.0
revision: HEAD
packaged_components:
- name: traefik
namespace: kube-system
config: |2
additionalArguments:
- "--certificatesResolvers.stepca.acme.caserver=https://step-certificates.step-ca.svc.cluster.local/acme/acme/directory"
- "--certificatesResolvers.stepca.acme.email=admin"
- "--certificatesResolvers.stepca.acme.storage=/data/acme.json"
- "--certificatesResolvers.stepca.acme.tlsChallenge=true"
- "--certificatesresolvers.stepca.acme.certificatesduration=24"
globalArguments: []
ingressRoute:
dashboard:
enabled: false
ports:
ssh:
port: 8022
protocol: TCP
web:
redirectTo: websecure
websecure:
tls:
certResolver: stepca
helm_repositories:
- name: longhorn
url: https://charts.longhorn.io
- name: harbor
url: https://helm.goharbor.io
- name: gitea-charts
url: https://dl.gitea.io/charts/
- name: argo
url: https://argoproj.github.io/argo-helm
- name: sealed-secrets
url: https://bitnami-labs.github.io/sealed-secrets
- name: smallstep
url: https://smallstep.github.io/helm-charts/
components:
longhorn:
helm:
version: 1.3.0
chart: longhorn/longhorn
parse_logic: cat values.yaml | yq eval '.. | select(has("repository")) | .repository + ":" + .tag'
chart_values: !unsafe |
defaultSettings:
defaultDataPath: /mnt/blockstorage
defaultReplicaCount: 1
ingress:
enabled: true
host: storage.{{ vapp['metacluster.fqdn'] }}
persistence:
defaultClassReplicaCount: 1
step-certificates:
helm:
version: 1.18.2+20220324
chart: smallstep/step-certificates
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sed '/:/!s/$/:latest/' | sort -u
chart_values: !unsafe |
ca:
bootstrap:
postInitHook: |
echo '{{ vapp["guestinfo.rootpw"] }}' > ~/pwfile
step ca provisioner add acme \
--type ACME \
--password-file=~/pwfile \
--force-cn
rm ~/pwfile
dns: ca.{{ vapp['metacluster.fqdn'] }},step-certificates.step-ca.svc.cluster.local,127.0.0.1
password: "{{ vapp['guestinfo.rootpw'] }}"
provisioner:
name: admin
password: "{{ vapp['guestinfo.rootpw'] }}"
inject:
secrets:
ca_password: "{{ vapp['guestinfo.rootpw'] | b64encode }}"
provisioner_password: "{{ vapp['guestinfo.rootpw'] | b64encode }}"
service:
targetPort: 9000
harbor:
helm:
version: 1.9.1 # (= Harbor v2.5.1)
chart: harbor/harbor
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | awk '!/ /'
chart_values: !unsafe |
expose:
ingress:
annotations: {}
hosts:
core: registry.{{ vapp['metacluster.fqdn'] }}
tls:
certSource: none
enabled: false
externalURL: https://registry.{{ vapp['metacluster.fqdn'] }}
harborAdminPassword: "{{ vapp['guestinfo.rootpw'] }}"
notary:
enabled: false
gitea:
helm:
version: v5.0.9 # (= Gitea v1.16.8)
chart: gitea-charts/gitea
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | sed '/:/!s/$/:latest/'
chart_values: !unsafe |
config:
offlineMode: true
gitea:
admin:
username: administrator
password: "{{ vapp['guestinfo.rootpw'] }}"
email: admin@{{ vapp['metacluster.fqdn'] }}
image:
pullPolicy: IfNotPresent
ingress:
enabled: true
hosts:
- host: git.{{ vapp['metacluster.fqdn'] }}
paths:
- path: /
pathType: Prefix
service:
ssh:
type: ClusterIP
port: 22
clusterIP:
argo-cd:
helm:
version: 4.9.7 # (= ArgoCD v2.4.2)
chart: argo/argo-cd
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | awk '!/ /'
chart_values: !unsafe |
configs:
secret:
argocdServerAdminPassword: "{{ vapp['guestinfo.rootpw'] | password_hash('bcrypt') }}"
controller:
volumeMounts:
- name: custom-ca-certificates
mountPath: /etc/ssl/certs/root_ca.crt
subPath: root_ca.crt
volumes:
- name: custom-ca-certificates
secret:
defaultMode: 420
secretName: step-certificates-certs
repoServer:
volumeMounts:
- name: custom-ca-certificates
mountPath: /etc/ssl/certs/root_ca.crt
subPath: root_ca.crt
volumes:
- name: custom-ca-certificates
secret:
defaultMode: 420
secretName: step-certificates-certs
server:
extraArgs:
- --insecure
ingress:
enabled: true
hosts:
- gitops.{{ vapp['metacluster.fqdn'] }}
volumeMounts:
- name: custom-ca-certificates
mountPath: /etc/ssl/certs/root_ca.crt
subPath: root_ca.crt
volumes:
- name: custom-ca-certificates
secret:
defaultMode: 420
secretName: step-certificates-certs
sealed-secrets:
helm:
version: 2.4.0 # (= SealedSecrets v0.18.1)
chart: sealed-secrets/sealed-secrets
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | awk '!/ /'
dependencies:
ansible_galaxy_collections:
- ansible.posix
- ansible.utils
- community.crypto
- community.general
- community.vmware
- kubernetes.core
container_images:
- vmware/powerclicore:12.7
static_binaries:
- filename: govc
url: https://github.com/vmware/govmomi/releases/download/v0.29.0/govc_Linux_x86_64.tar.gz
archive: compressed
- filename: helm
url: https://get.helm.sh/helm-v3.9.0-linux-amd64.tar.gz
archive: compressed
extra_opts: --strip-components=1
- filename: skopeo
url: https://code.spamasaurus.com/api/packages/djpbessems/generic/skopeo/v1.9.1/skopeo
- filename: step
url: https://dl.step.sm/gh-release/cli/gh-release-header/v0.21.0/step_linux_0.21.0_amd64.tar.gz
archive: compressed
extra_opts: --strip-components=2
- filename: yq
url: http://github.com/mikefarah/yq/releases/download/v4.25.3/yq_linux_amd64
packages:
apt:
- lvm2
pip:
- jmespath
- kubernetes
- passlib
- pyvmomi

View File

@@ -0,0 +1,7 @@
downstream:
node_templates:
prefix: NodeTmpl_
images:
- url: https://stable.release.flatcar-linux.net/amd64-usr/3227.2.0/flatcar_production_vmware_ova.ova
name: flatcar.ova

View File

@@ -1,4 +1,4 @@
iso_url = "sn.itch.fyi/Repository/iso/Canonical/Ubuntu%20Server%2020.04/ubuntu-20.04.4-live-server-amd64.iso" iso_url = "sn.itch.fyi/Repository/iso/Canonical/Ubuntu%20Server%2022.04/ubuntu-22.04-live-server-amd64.iso"
iso_checksum = "sha256:28CCDB56450E643BAD03BB7BCF7507CE3D8D90E8BF09E38F6BD9AC298A98EAAD" iso_checksum = "sha256:84AEAF7823C8C61BAA0AE862D0A06B03409394800000B3235854A6B38EB4856F"
// iso_url = "sn.itch.fyi/Repository/iso/Canonical/Ubuntu%20Server%2020.04/ubuntu-20.04.2-live-server-amd64.iso" // iso_url = "sn.itch.fyi/Repository/iso/Canonical/Ubuntu%20Server%2020.04/ubuntu-20.04.2-live-server-amd64.iso"
// iso_checksum = "sha256:D1F2BF834BBE9BB43FAF16F9BE992A6F3935E65BE0EDECE1DEE2AA6EB1767423" // iso_checksum = "sha256:D1F2BF834BBE9BB43FAF16F9BE992A6F3935E65BE0EDECE1DEE2AA6EB1767423"

View File

@@ -3,7 +3,7 @@ packer {
} }
} }
source "vsphere-iso" "ubuntuserver" { source "vsphere-iso" "k8sbootstrap" {
vcenter_server = var.vcenter_server vcenter_server = var.vcenter_server
username = var.vsphere_username username = var.vsphere_username
password = var.vsphere_password password = var.vsphere_password
@@ -20,9 +20,9 @@ source "vsphere-iso" "ubuntuserver" {
boot_order = "disk,cdrom" boot_order = "disk,cdrom"
boot_command = [ boot_command = [
"<enter><wait2><enter><wait><f6><esc><wait>", "e<down><down><down><end>",
" autoinstall<wait2> ds=nocloud;", " autoinstall ds=nocloud;",
"<wait><enter>" "<F10>"
] ]
boot_wait = "2s" boot_wait = "2s"
@@ -34,22 +34,22 @@ source "vsphere-iso" "ubuntuserver" {
ssh_pty = true ssh_pty = true
CPUs = 2 CPUs = 2
RAM = 4096 RAM = 8192
network_adapters { network_adapters {
network = var.vsphere_network network = var.vsphere_network
network_card = "vmxnet3" network_card = "vmxnet3"
} }
storage { storage {
disk_size = 20480 disk_size = 76800
disk_thin_provisioned = true disk_thin_provisioned = true
} }
disk_controller_type = ["pvscsi"] disk_controller_type = ["pvscsi"]
usb_controller = ["xhci"] usb_controller = ["xhci"]
cd_files = [ cd_files = [
"packer/preseed/UbuntuServer20.04/user-data", "packer/preseed/UbuntuServer22.04/user-data",
"packer/preseed/UbuntuServer20.04/meta-data" "packer/preseed/UbuntuServer22.04/meta-data"
] ]
cd_label = "cidata" cd_label = "cidata"
iso_url = local.iso_authenticatedurl iso_url = local.iso_authenticatedurl
@@ -60,18 +60,18 @@ source "vsphere-iso" "ubuntuserver" {
export { export {
images = false images = false
output_directory = "/scratch/ubuntuserver" output_directory = "/scratch/k8sbootstrap"
} }
remove_cdrom = true remove_cdrom = true
} }
build { build {
sources = [ sources = [
"source.vsphere-iso.ubuntuserver" "source.vsphere-iso.k8sbootstrap"
] ]
provisioner "ansible" { provisioner "ansible" {
only = ["vsphere-iso.ubuntuserver"] pause_before = "2m30s"
playbook_file = "ansible/playbook.yml" playbook_file = "ansible/playbook.yml"
user = "ubuntu" user = "ubuntu"
@@ -80,21 +80,22 @@ build {
] ]
use_proxy = "false" use_proxy = "false"
extra_arguments = [ extra_arguments = [
"--extra-vars", "ansible_ssh_pass=${var.ssh_password}" "--extra-vars", "ansible_ssh_pass=${var.ssh_password}",
"--extra-vars", "repo_username=${var.repo_username}",
"--extra-vars", "repo_password=${var.repo_password}"
] ]
} }
post-processor "shell-local" { post-processor "shell-local" {
only = ["vsphere-iso.ubuntuserver"]
inline = [ inline = [
"pwsh -command \"& scripts/Update-OvfConfiguration.ps1 \\", "pwsh -command \"& scripts/Update-OvfConfiguration.ps1 \\",
" -OVFFile '/scratch/ubuntuserver/${var.vm_guestos}-${var.vm_name}.ovf' \\", " -OVFFile '/scratch/k8sbootstrap/${var.vm_guestos}-${var.vm_name}.ovf' \\",
" -Parameter @{'appliance.name'='${var.vm_guestos}';'appliance.version'='${var.vm_name}'}\"", " -Parameter @{'appliance.name'='${var.vm_guestos}';'appliance.version'='${var.vm_name}'}\"",
"pwsh -file scripts/Update-Manifest.ps1 \\", "pwsh -file scripts/Update-Manifest.ps1 \\",
" -ManifestFileName '/scratch/ubuntuserver/${var.vm_guestos}-${var.vm_name}.mf'", " -ManifestFileName '/scratch/k8sbootstrap/${var.vm_guestos}-${var.vm_name}.mf'",
"ovftool --acceptAllEulas --allowExtraConfig --overwrite \\", "ovftool --acceptAllEulas --allowExtraConfig --overwrite \\",
" '/scratch/ubuntuserver/${var.vm_guestos}-${var.vm_name}.ovf' \\", " '/scratch/k8sbootstrap/${var.vm_guestos}-${var.vm_name}.ovf' \\",
" /output/Ubuntu-Server-20.04.ova" " /output/Kubernetes.Bootstrap.Appliance.ova"
] ]
} }
} }

View File

@@ -1,9 +1,9 @@
vcenter_server = "bv11-vc.bessems.lan" vcenter_server = "bv11-vc.bessems.lan"
vsphere_username = "administrator@vsphere.local" vsphere_username = "administrator@vsphere.local"
vsphere_datacenter = "DeSchakel" vsphere_datacenter = "DeSchakel"
vsphere_cluster = "Cluster.Legacy" vsphere_cluster = "Cluster.01"
vsphere_host = "bv11-esx.bessems.lan" vsphere_host = "bv11-esx02.bessems.lan"
vsphere_datastore = "ESX00.SSD01" vsphere_datastore = "NAS01.RAID5"
vsphere_folder = "/Packer" vsphere_folder = "/Packer"
vsphere_templatefolder = "/Templates" vsphere_templatefolder = "/Templates"
vsphere_network = "LAN" vsphere_network = "LAN"

View File

@@ -1,35 +1,60 @@
DeploymentConfigurations: DeploymentConfigurations:
- Id: small - Id: small
Label: 'Ubuntu Server 20.04 [SMALL: 1 vCPU/2GB RAM]' Label: 'Ubuntu Server 22.04 [SMALL: 2 vCPU/4GB RAM]'
Description: Ubuntu Server 20.04.x Description: Ubuntu Server 22.04.x
Size: Size:
CPU: 1 CPU: 2
Memory: 2048 Memory: 4096
- Id: large
Label: 'Ubuntu Server 20.04 [LARGE: 4 vCPU/8GB RAM]' - Id: medium
Description: Ubuntu Server 20.04.x Label: 'Ubuntu Server 22.04 [MEDIUM: 4 vCPU/8GB RAM]'
Description: Ubuntu Server 22.04.x
Size: Size:
CPU: 4 CPU: 4
Memory: 8192 Memory: 8192
DynamicDisks: []
DynamicDisks:
- Description: Longhorn persistent storage
UnitSize: GB
Constraints:
Minimum: 100
Maximum: ''
PropertyCategories: PropertyCategories:
# - Name: 0) Deployment information # - Name: 0) Deployment information
# ProductProperties: # ProductProperties:
# - Key: deployment.type # - Key: deployment.type
# Type: string # Type: string
# Value: # Value:
# - small # - small
# - large # - medium
# UserConfigurable: false # UserConfigurable: false
- Name: 1) Operating System
- Name: 1) Kubernetes
ProductProperties: ProductProperties:
- Key: metacluster.fqdn
Type: string(1..)
Label: Appliance FQDN*
Description: 'Respective subdomains will be available for each component (e.g. storage.example.org); this address should already be configured as a wildcard record within your DNS zone.'
DefaultValue: 'meta.k8s.cluster'
Configurations: '*'
UserConfigurable: true
- Name: 2) Operating System
ProductProperties:
- Key: guestinfo.hostname - Key: guestinfo.hostname
Type: string(1..15) Type: string(1..15)
Label: Hostname* Label: Hostname*
Description: '(max length: 15 characters)' Description: ''
DefaultValue: '' DefaultValue: 'META-NODE-{{ hostname.suffix }}'
Configurations: '*' Configurations: '*'
UserConfigurable: true UserConfigurable: true
- Key: guestinfo.rootpw - Key: guestinfo.rootpw
Type: password(7..) Type: password(7..)
Label: Local root password* Label: Local root password*
@@ -37,6 +62,7 @@ PropertyCategories:
DefaultValue: '' DefaultValue: ''
Configurations: '*' Configurations: '*'
UserConfigurable: true UserConfigurable: true
- Key: guestinfo.rootsshkey - Key: guestinfo.rootsshkey
Type: password(1..) Type: password(1..)
Label: Local root SSH public key* Label: Local root SSH public key*
@@ -44,15 +70,10 @@ PropertyCategories:
DefaultValue: '' DefaultValue: ''
Configurations: '*' Configurations: '*'
UserConfigurable: true UserConfigurable: true
- Key: guestinfo.ntpserver
Type: string(1..) - Name: 3) Networking
Label: Time server*
Description: A comma-separated list of timeservers
DefaultValue: 0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org
Configurations: '*'
UserConfigurable: true
- Name: 2) Networking
ProductProperties: ProductProperties:
- Key: guestinfo.ipaddress - Key: guestinfo.ipaddress
Type: ip Type: ip
Label: IP Address* Label: IP Address*
@@ -60,6 +81,7 @@ PropertyCategories:
DefaultValue: '' DefaultValue: ''
Configurations: '*' Configurations: '*'
UserConfigurable: true UserConfigurable: true
- Key: guestinfo.prefixlength - Key: guestinfo.prefixlength
Type: int(8..32) Type: int(8..32)
Label: Subnet prefix length* Label: Subnet prefix length*
@@ -67,6 +89,7 @@ PropertyCategories:
DefaultValue: '24' DefaultValue: '24'
Configurations: '*' Configurations: '*'
UserConfigurable: true UserConfigurable: true
- Key: guestinfo.dnsserver - Key: guestinfo.dnsserver
Type: ip Type: ip
Label: DNS server* Label: DNS server*
@@ -74,6 +97,7 @@ PropertyCategories:
DefaultValue: '' DefaultValue: ''
Configurations: '*' Configurations: '*'
UserConfigurable: true UserConfigurable: true
- Key: guestinfo.gateway - Key: guestinfo.gateway
Type: ip Type: ip
Label: Gateway* Label: Gateway*
@@ -81,6 +105,42 @@ PropertyCategories:
DefaultValue: '' DefaultValue: ''
Configurations: '*' Configurations: '*'
UserConfigurable: true UserConfigurable: true
- Key: guestinfo.ntpserver
Type: string(1..)
Label: Time server*
Description: A comma-separated list of timeservers
DefaultValue: 0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org
Configurations: '*'
UserConfigurable: true
- Name: 4) Hypervisor
ProductProperties:
- Key: hv.fqdn
Type: string(1..)
Label: vCenter FQDN/IP-address*
Description: The address of the vCenter instance which this bootstrap appliance will interact with for provisioning new VM's.
DefaultValue: ''
Configurations: '*'
UserConfigurable: true
- Key: hv.username
Type: string(1..)
Label: vCenter username*
Description: The username which this bootstrap appliance will authenticate with to the vCenter instance.
DefaultValue: 'administrator@vsphere.local'
Configurations: '*'
UserConfigurable: true
- Key: hv.password
Type: password(1..)
Label: vCenter password ...*
Description: The password which this bootstrap appliance will authenticate with to the vCenter instance.
DefaultValue: ''
Configurations: '*'
UserConfigurable: true
AdvancedOptions: AdvancedOptions:
- Key: appliance.name - Key: appliance.name
Value: "{{ appliance.name }}" Value: "{{ appliance.name }}"
@@ -91,6 +151,9 @@ AdvancedOptions:
--- ---
Variables: Variables:
- Name: hostname.suffix
Expression: |
(-join ((48..57) + (97..122) | Get-Random -Count 5 | % {[char]$_})).ToUpper()
- Name: appliance.name - Name: appliance.name
Expression: | Expression: |
$Parameter['appliance.name'] $Parameter['appliance.name']