-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudinit.html
More file actions
1691 lines (1582 loc) · 88.9 KB
/
Copy pathcloudinit.html
File metadata and controls
1691 lines (1582 loc) · 88.9 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50,6 L87,27 L87,73 L50,94 L13,73 L13,27 Z' fill='%231c2340'/%3E%3Crect x='21' y='46' width='58' height='9' rx='4.5' fill='%234f7cff'/%3E%3Ccircle cx='26' cy='24' r='4.5' fill='%234f7cff'/%3E%3Ccircle cx='74' cy='76' r='4.5' fill='%234f7cff'/%3E%3C/svg%3E">
<title>Hatch — Cloud-Init Config Generator (user-data & network-config)</title>
<meta name="description" content="Generate cloud-init user-data and network-config for automated Linux cloud instance setup. Configure users, SSH keys, networking, packages, storage mounts, and run commands. Supports Ubuntu, Debian, RHEL, Rocky, Amazon Linux, and SUSE. Free, runs entirely in your browser.">
<meta name="keywords" content="cloud-init generator, user-data generator, cloud-init config, network-config, cloud-init yaml, ubuntu cloud-init, ec2 user-data, OpenShift cloud-init">
<link rel="canonical" href="https://bootsha.net/hatch/cloudinit.html">
<meta property="og:title" content="Hatch — Cloud-Init Config Generator">
<meta property="og:description" content="Generate cloud-init user-data and network-config for Linux cloud instances. Supports Ubuntu, RHEL, Amazon Linux, and more. Free, runs entirely in your browser.">
<meta property="og:url" content="https://bootsha.net/hatch/cloudinit.html">
<meta property="og:image" content="https://bootsha.net/hatch/og-image.png">
<meta property="og:type" content="website">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Hatch — Cloud-Init Config Generator">
<meta name="twitter:description" content="Generate cloud-init user-data and network-config for Linux cloud instances. Free, runs entirely in your browser.">
<meta name="twitter:image" content="https://bootsha.net/hatch/og-image.png">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": "Hatch Cloud-Init Config Generator",
"url": "https://bootsha.net/hatch/cloudinit.html",
"applicationCategory": "DeveloperApplication",
"operatingSystem": "Any (runs in browser)",
"description": "Generate cloud-init user-data and network-config YAML for Ubuntu, Debian, RHEL, Rocky, Amazon Linux, and SUSE cloud instances.",
"offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" },
"isPartOf": { "@type": "WebSite", "name": "Hatch", "url": "https://bootsha.net/hatch/" }
}
</script>
<style>
:root {
--bg: #0d1015;
--surface: #151920;
--surface2: #12151c;
--accent: #4f7cff;
--accent-hover: #3d68f0;
--text: #e6e9ef;
--text-muted: #8b93a3;
--border: #262c38;
--success: #22c55e;
--error: #ef4444;
--radius: 10px;
--shadow: 0 2px 8px rgba(0,0,0,0.25);
--shadow-lg: 0 6px 20px rgba(0,0,0,0.35);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
line-height: 1.5;
}
header {
background: var(--surface2);
border-bottom: 1px solid var(--border);
padding: 16px 24px;
display: flex;
align-items: center;
gap: 12px;
position: sticky;
top: 0;
z-index: 100;
}
header h1 { font-size: 1.2rem; font-weight: 600; }
header p { font-size: 0.8rem; color: var(--text-muted); }
.privacy-badge {
margin-left: auto;
background: #0a3020;
border: 1px solid #107c10;
color: #4caf50;
padding: 4px 10px;
border-radius: 20px;
font-size: 0.75rem;
white-space: nowrap;
}
.home-link {
display: inline-flex;
align-items: center;
gap: 6px;
color: var(--text-muted);
text-decoration: none;
font-size: 0.8rem;
padding: 5px 10px;
border: 1px solid var(--border);
border-radius: var(--radius);
white-space: nowrap;
transition: color 0.2s, border-color 0.2s;
}
.home-link:hover { color: var(--text); border-color: var(--accent); }
.hatch-wordmark { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #4f7cff; margin-bottom: 1px; }
.container { max-width: 960px; margin: 0 auto; padding: 24px 16px 80px; }
.progress-bar { background: var(--surface); border: 1px solid var(--border); border-radius: 30px; height: 8px; margin-bottom: 24px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--accent); border-radius: 30px; transition: width 0.3s ease; }
.step-indicator { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.step-pill {
padding: 4px 10px; border-radius: 20px; font-size: 0.72rem; cursor: pointer;
border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); transition: all 0.2s;
}
.step-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(79,124,255,0.4); }
.step-pill.done { background: #0a3020; border-color: #107c10; color: #4caf50; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card h2 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.card .subtitle { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 0.82rem; font-weight: 500; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
label .hint { font-weight: 400; font-size: 0.75rem; color: var(--text-muted); margin-left: auto; }
label .req { color: var(--error); }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
color: var(--text); padding: 9px 12px; font-size: 0.88rem; font-family: inherit; width: 100%;
transition: border-color 0.2s; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,124,255,0.15); }
select option { background: #1a1a2e; }
textarea { resize: vertical; min-height: 80px; }
.mono { font-family: 'Cascadia Code','Consolas','Courier New',monospace; font-size: 0.82rem; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 0.88rem; }
.toggle-desc { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }
.toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; margin-left: 12px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top:0;left:0;right:0;bottom:0; background: var(--border); border-radius: 24px; transition: 0.2s; }
.slider:before { content:''; position:absolute; height:18px;width:18px;left:3px;bottom:3px; background:#fff; border-radius:50%; transition:0.2s; }
input:checked + .slider { background: var(--accent); }
input:checked + .slider:before { transform: translateX(20px); }
.tag-input-container {
background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
padding: 6px 8px; display: flex; flex-wrap: wrap; gap: 6px; cursor: text;
min-height: 42px; align-items: center; transition: border-color 0.2s;
}
.tag-input-container:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,124,255,0.15); }
.ci-tag { background: var(--surface2); border: 1px solid var(--accent); border-radius: 4px; padding: 2px 8px; font-size: 0.8rem; display: flex; align-items: center; gap: 6px; }
.tag-remove { cursor: pointer; color: var(--text-muted); font-size: 1rem; line-height: 1; }
.tag-remove:hover { color: var(--error); }
.tag-input { border: none; background: transparent; color: var(--text); font-size: 0.88rem; outline: none; flex: 1; min-width: 100px; padding: 2px 4px; }
.btn { padding: 10px 20px; border-radius: var(--radius); border: 1px solid transparent; font-size: 0.88rem; font-weight: 500; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, background 0.15s, border-color 0.15s; display: inline-flex; align-items: center; gap: 8px; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(79,124,255,0.35); }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(79,124,255,0.45); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn-ocp { background: #000; color: #fff; border: 1px solid #fff; }
.btn-ocp:hover { background: #222; transform: translateY(-1px); }
.btn-lg { padding: 13px 28px; font-size: 0.95rem; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.nav-buttons { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; gap: 12px; flex-wrap: wrap; }
.nav-buttons-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (max-width: 600px) {
.nav-buttons { flex-direction: column; align-items: stretch; }
.nav-buttons-group { flex-direction: column; align-items: stretch; }
.nav-buttons .btn, .nav-buttons-group .btn { width: 100%; justify-content: center; }
}
.section-hidden { display: none; }
.section-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); font-weight: 600; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.info-box { background: rgba(79,124,255,0.07); border: 1px solid rgba(79,124,255,0.3); border-radius: var(--radius); padding: 12px 16px; font-size: 0.82rem; color: #9db4ff; margin-bottom: 16px; }
.warn-box { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.3); border-radius: var(--radius); padding: 12px 16px; font-size: 0.82rem; color: #f5989a; margin-bottom: 16px; }
.blue-box { background: rgba(79,124,255,0.08); border: 1px solid rgba(79,124,255,0.3); border-radius: var(--radius); padding: 12px 16px; font-size: 0.82rem; color: #9db4ff; margin-bottom: 16px; }
.dynamic-list { display: flex; flex-direction: column; gap: 10px; }
.dynamic-row {
background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
padding: 14px; position: relative; transition: border-color 0.2s;
}
.dynamic-row:hover { border-color: rgba(79,124,255,0.35); }
.dynamic-row-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dynamic-row-title { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.yaml-output {
background: #0d1117; border: 1px solid var(--border); border-radius: var(--radius);
padding: 20px; font-family: 'Cascadia Code','Consolas','Courier New',monospace; font-size: 0.8rem;
line-height: 1.6; white-space: pre; overflow-x: auto; max-height: 600px; overflow-y: auto;
color: #e6edf3; tab-size: 2;
}
.output-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.copy-feedback { position: fixed; bottom: 24px; right: 24px; background: #107c10; color: #fff; padding: 10px 20px; border-radius: var(--radius); font-size: 0.88rem; opacity: 0; transition: opacity 0.3s; pointer-events: none; z-index: 1000; }
.copy-feedback.show { opacity: 1; }
.user-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.user-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.user-card-name { font-weight: 600; font-size: 0.9rem; color: var(--accent); }
.badge { display: inline-block; font-size: 0.7rem; padding: 2px 8px; border-radius: 12px; font-weight: 600; margin-left: 8px; }
.badge-admin { background: rgba(79,124,255,0.15); color: var(--accent); border: 1px solid rgba(79,124,255,0.3); }
.badge-user { background: rgba(139,147,163,0.12); color: var(--text-muted); border: 1px solid var(--border); }
.iface-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.quick-pkg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.review-section { margin-bottom: 22px; }
.review-section:last-child { margin-bottom: 0; }
.review-section-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); font-weight: 600; margin-bottom: 10px; }
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.review-item { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.review-item-key { font-size: 0.7rem; color: var(--text-muted); }
.review-item-val { font-size: 0.86rem; margin-top: 3px; word-break: break-all; font-weight: 500; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
</style>
</head>
<body>
<header>
<svg width="40" height="40" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<path d="M50,6 L87,27 L87,73 L50,94 L13,73 L13,27 Z" fill="#1c2340" stroke="#3d3d62" stroke-width="1.5"/>
<rect x="21" y="46" width="58" height="9" rx="4.5" fill="#4f7cff"/>
<circle cx="26" cy="24" r="4.5" fill="#4f7cff"/>
<circle cx="74" cy="76" r="4.5" fill="#4f7cff"/>
</svg>
<div>
<div class="hatch-wordmark">Hatch</div>
<h1>Cloud-Init Config Generator</h1>
<p>Generate user-data and network-config for automated Linux cloud instance setup</p>
</div>
<a href="index.html" class="home-link">← Home</a>
<div class="privacy-badge">🔒 100% Local — No Data Transmitted</div>
</header>
<div class="container">
<div class="progress-bar"><div class="progress-bar-fill" id="progressFill" style="width:0%"></div></div>
<div class="step-indicator" id="stepIndicator"></div>
<!-- ═══ STEP 1: System Basics ═══ -->
<div class="step-section" id="step-0">
<div class="card">
<h2>System Basics</h2>
<p class="subtitle">Core identity and locale settings written to the instance on first boot.</p>
<div class="form-grid">
<div class="form-group">
<label>Distro / OS Family <span class="req">*</span></label>
<select id="distroFamily" onchange="onDistroChange()">
<option value="apt">Ubuntu / Debian (apt)</option>
<option value="yum">RHEL / CentOS / Rocky / AlmaLinux (yum/dnf)</option>
<option value="amazon">Amazon Linux 2 / 2023 (dnf)</option>
<option value="suse">SUSE / openSUSE (zypper)</option>
<option value="arch">Arch Linux (pacman)</option>
<option value="other">Other / Generic</option>
</select>
</div>
<div class="form-group">
<label>Hostname <span class="hint">Short hostname, no dots</span></label>
<input type="text" id="hostname" placeholder="myserver" maxlength="63">
</div>
<div class="form-group">
<label>FQDN <span class="hint">Optional — overrides hostname</span></label>
<input type="text" id="fqdn" placeholder="myserver.example.com">
</div>
<div class="form-group">
<label>Manage /etc/hosts</label>
<select id="manageEtcHosts">
<option value="true">true — cloud-init manages it</option>
<option value="false">false — leave as-is</option>
<option value="localhost">localhost — add hostname to loopback only</option>
</select>
</div>
<div class="form-group">
<label>Timezone <span class="hint">IANA format</span></label>
<select id="timezone">
<option value="UTC">UTC</option>
<option value="America/New_York">America/New_York (ET)</option>
<option value="America/Chicago">America/Chicago (CT)</option>
<option value="America/Denver">America/Denver (MT)</option>
<option value="America/Los_Angeles">America/Los_Angeles (PT)</option>
<option value="America/Anchorage">America/Anchorage (AK)</option>
<option value="America/Honolulu">America/Honolulu (HI)</option>
<option value="America/Halifax">America/Halifax (AT)</option>
<option value="America/Toronto">America/Toronto (ET)</option>
<option value="America/Vancouver">America/Vancouver (PT)</option>
<option value="America/Sao_Paulo">America/Sao_Paulo (BRT)</option>
<option value="Europe/London">Europe/London (GMT/BST)</option>
<option value="Europe/Paris">Europe/Paris (CET/CEST)</option>
<option value="Europe/Berlin">Europe/Berlin (CET/CEST)</option>
<option value="Europe/Amsterdam">Europe/Amsterdam</option>
<option value="Europe/Stockholm">Europe/Stockholm</option>
<option value="Europe/Oslo">Europe/Oslo</option>
<option value="Europe/Copenhagen">Europe/Copenhagen</option>
<option value="Europe/Helsinki">Europe/Helsinki</option>
<option value="Europe/Warsaw">Europe/Warsaw</option>
<option value="Europe/Prague">Europe/Prague</option>
<option value="Europe/Vienna">Europe/Vienna</option>
<option value="Europe/Rome">Europe/Rome</option>
<option value="Europe/Madrid">Europe/Madrid</option>
<option value="Europe/Lisbon">Europe/Lisbon</option>
<option value="Europe/Athens">Europe/Athens</option>
<option value="Europe/Bucharest">Europe/Bucharest</option>
<option value="Europe/Istanbul">Europe/Istanbul</option>
<option value="Europe/Moscow">Europe/Moscow</option>
<option value="Asia/Dubai">Asia/Dubai (GST)</option>
<option value="Asia/Karachi">Asia/Karachi (PKT)</option>
<option value="Asia/Kolkata">Asia/Kolkata (IST)</option>
<option value="Asia/Dhaka">Asia/Dhaka (BST)</option>
<option value="Asia/Bangkok">Asia/Bangkok (ICT)</option>
<option value="Asia/Singapore">Asia/Singapore (SGT)</option>
<option value="Asia/Shanghai">Asia/Shanghai (CST)</option>
<option value="Asia/Tokyo">Asia/Tokyo (JST)</option>
<option value="Asia/Seoul">Asia/Seoul (KST)</option>
<option value="Australia/Sydney">Australia/Sydney (AEST)</option>
<option value="Australia/Melbourne">Australia/Melbourne</option>
<option value="Australia/Perth">Australia/Perth (AWST)</option>
<option value="Pacific/Auckland">Pacific/Auckland (NZST)</option>
</select>
</div>
<div class="form-group">
<label>Locale</label>
<input type="text" id="locale" value="en_US.UTF-8" placeholder="en_US.UTF-8" list="locale-suggestions">
<datalist id="locale-suggestions">
<option value="en_US.UTF-8"><option value="en_GB.UTF-8"><option value="en_AU.UTF-8">
<option value="de_DE.UTF-8"><option value="fr_FR.UTF-8"><option value="es_ES.UTF-8">
<option value="it_IT.UTF-8"><option value="pt_BR.UTF-8"><option value="ja_JP.UTF-8">
<option value="zh_CN.UTF-8"><option value="ko_KR.UTF-8"><option value="ru_RU.UTF-8">
<option value="ar_SA.UTF-8"><option value="tr_TR.UTF-8"><option value="nl_NL.UTF-8">
<option value="pl_PL.UTF-8"><option value="sv_SE.UTF-8">
</datalist>
</div>
</div>
</div>
</div>
<!-- ═══ STEP 2: Users & Authentication ═══ -->
<div class="step-section section-hidden" id="step-1">
<div class="card">
<h2>Users & Authentication</h2>
<p class="subtitle">Configure user accounts, SSH keys, and authentication settings.</p>
<div class="form-grid" style="margin-bottom:16px">
<div class="form-group">
<label>Disable root SSH login</label>
<select id="disableRoot">
<option value="true">true — disable root (recommended)</option>
<option value="false">false — allow root login</option>
</select>
</div>
<div class="form-group">
<label>SSH Password Authentication</label>
<select id="sshPwauth">
<option value="false">false — key-based only (recommended)</option>
<option value="true">true — allow passwords</option>
</select>
</div>
</div>
<div class="section-title">User Accounts</div>
<div class="blue-box">ℹ️ cloud-init does not accept plain text passwords. Each user's password field expects a SHA-512 crypt hash. Generate one with: <code class="mono">openssl passwd -6</code> (prompts you to type the password, outputs the hash).</div>
<div class="dynamic-list" id="userList"></div>
<button class="btn btn-secondary" style="margin-top:10px" onclick="addUser()">+ Add User</button>
<div style="margin-top:20px">
<div class="section-title">Global SSH Authorized Keys</div>
<p style="font-size:0.82rem;color:var(--text-muted);margin-bottom:10px">Keys added here are injected into the default cloud user (e.g. ubuntu, ec2-user). One key per line.</p>
<textarea id="globalSshKeys" class="mono" rows="4" placeholder="ssh-ed25519 AAAA... user@host ssh-rsa AAAA... another@host"></textarea>
</div>
<div style="margin-top:20px">
<div class="section-title">Force Password Change (chpasswd)</div>
<div class="form-grid">
<div class="form-group">
<label>Expire passwords on first login</label>
<select id="chpasswdExpire">
<option value="">— not configured —</option>
<option value="true">true — force change on first login</option>
<option value="false">false — passwords do not expire</option>
</select>
</div>
<div class="form-group full">
<label>Password list <span class="hint">format: username:hashed_password, one per line</span></label>
<textarea id="chpasswdList" class="mono" rows="3" placeholder="admin:$6$rounds=4096$salt$hash... user2:$6$rounds=4096$salt$hash..."></textarea>
</div>
</div>
</div>
</div>
</div>
<!-- ═══ STEP 3: Network ═══ -->
<div class="step-section section-hidden" id="step-2">
<div class="card">
<h2>Network Configuration</h2>
<p class="subtitle">Configure network interfaces. Generates a separate <code>network-config</code> file (cloud-init network v2 / Netplan format).</p>
<div class="form-grid" style="margin-bottom:16px">
<div class="form-group">
<label>Network Config Mode</label>
<select id="netConfigMode" onchange="onNetConfigModeChange()">
<option value="skip">Skip — use cloud provider defaults (DHCP)</option>
<option value="v2">Generate network-config v2 (Netplan)</option>
</select>
</div>
<div class="form-group" id="netRendererGroup" style="display:none">
<label>Renderer</label>
<select id="netRenderer">
<option value="networkd">networkd (servers, Ubuntu minimal)</option>
<option value="NetworkManager">NetworkManager (desktop, RHEL)</option>
</select>
</div>
</div>
<div id="netInterfaceArea" style="display:none">
<div class="section-title">Network Interfaces</div>
<div class="dynamic-list" id="ifaceList"></div>
<button class="btn btn-secondary" style="margin-top:10px" onclick="addInterface()">+ Add Interface</button>
<div style="margin-top:20px">
<div class="section-title">Global DNS</div>
<div class="form-grid">
<div class="form-group">
<label>DNS Nameservers <span class="hint">Enter, press comma or Enter</span></label>
<div class="tag-input-container" onclick="this.querySelector('input').focus()">
<div id="globalDnsTags"></div>
<input class="tag-input" id="globalDnsInput" placeholder="8.8.8.8" onkeydown="addTagFromInput(event,'globalDns')">
</div>
</div>
<div class="form-group">
<label>DNS Search Domains</label>
<div class="tag-input-container" onclick="this.querySelector('input').focus()">
<div id="globalDnsSearchTags"></div>
<input class="tag-input" id="globalDnsSearchInput" placeholder="example.com" onkeydown="addTagFromInput(event,'globalDnsSearch')">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- ═══ STEP 4: Packages ═══ -->
<div class="step-section section-hidden" id="step-3">
<div class="card">
<h2>Package Management</h2>
<p class="subtitle">Install packages and configure repositories on first boot.</p>
<div class="toggle-row">
<div><div class="toggle-label">Update package cache on boot</div><div class="toggle-desc">Equivalent to apt-get update / yum makecache</div></div>
<label class="toggle"><input type="checkbox" id="pkgUpdate" checked><span class="slider"></span></label>
</div>
<div class="toggle-row">
<div><div class="toggle-label">Upgrade all packages on boot</div><div class="toggle-desc">Equivalent to apt-get upgrade / yum upgrade</div></div>
<label class="toggle"><input type="checkbox" id="pkgUpgrade"><span class="slider"></span></label>
</div>
<div class="toggle-row" style="margin-bottom:16px">
<div><div class="toggle-label">Reboot if required after upgrade</div><div class="toggle-desc">Reboots automatically if a kernel or libc upgrade requires it</div></div>
<label class="toggle"><input type="checkbox" id="pkgReboot"><span class="slider"></span></label>
</div>
<div class="section-title" style="margin-top:8px">Packages to Install</div>
<div class="tag-input-container" onclick="this.querySelector('input').focus()" style="margin-bottom:8px">
<div id="packageTags"></div>
<input class="tag-input" id="packageInput" placeholder="curl — press Enter or comma to add" onkeydown="addTagFromInput(event,'package')">
</div>
<div class="quick-pkg" id="quickPkgButtons"></div>
<!-- APT repos -->
<div id="aptRepoArea" style="margin-top:20px">
<div class="section-title">Additional APT Sources</div>
<div class="dynamic-list" id="aptSourceList"></div>
<button class="btn btn-secondary" style="margin-top:8px" onclick="addAptSource()">+ Add APT Source</button>
<div style="margin-top:12px">
<label style="margin-bottom:6px;display:block">APT Proxy <span class="hint">Optional HTTP proxy for apt</span></label>
<input type="text" id="aptProxy" placeholder="http://proxy.example.com:3128/">
</div>
</div>
<!-- YUM repos -->
<div id="yumRepoArea" style="margin-top:20px;display:none">
<div class="section-title">Additional YUM/DNF Repositories</div>
<div class="dynamic-list" id="yumRepoList"></div>
<button class="btn btn-secondary" style="margin-top:8px" onclick="addYumRepo()">+ Add Repository</button>
</div>
</div>
</div>
<!-- ═══ STEP 5: Storage ═══ -->
<div class="step-section section-hidden" id="step-4">
<div class="card">
<h2>Storage — Mounts & Swap</h2>
<p class="subtitle">Configure additional disk mounts and swap space. The root filesystem is handled automatically.</p>
<div class="section-title">Mounts</div>
<div class="blue-box">ℹ️ Entries map to <code>/etc/fstab</code>. Use <code>nofail</code> for non-critical mounts to prevent boot failures if the device is absent. NFS/CIFS mounts automatically get <code>_netdev</code> so they wait for the network before mounting.</div>
<div class="dynamic-list" id="mountList"></div>
<button class="btn btn-secondary" style="margin-top:8px" onclick="addMount()">+ Add Mount</button>
<div style="margin-top:24px">
<div class="section-title">Swap</div>
<div class="form-grid">
<div class="form-group">
<label>Swap File Path <span class="hint">Leave blank to skip swap config</span></label>
<input type="text" id="swapFile" placeholder="/swap" value="">
</div>
<div class="form-group">
<label>Swap Size</label>
<select id="swapSize">
<option value="auto">auto (cloud-init decides)</option>
<option value="1073741824">1 GB</option>
<option value="2147483648">2 GB</option>
<option value="4294967296">4 GB</option>
<option value="8589934592">8 GB</option>
</select>
</div>
<div class="form-group">
<label>Max Swap Size <span class="hint">Bytes — caps auto-size</span></label>
<input type="text" id="swapMaxsize" placeholder="2147483648">
</div>
</div>
</div>
</div>
</div>
<!-- ═══ STEP 6: Files & Early Commands ═══ -->
<div class="step-section section-hidden" id="step-5">
<div class="card">
<h2>Write Files</h2>
<p class="subtitle">Create or overwrite files on the instance during cloud-init. Runs before runcmd.</p>
<div class="dynamic-list" id="writeFileList"></div>
<button class="btn btn-secondary" style="margin-top:8px" onclick="addWriteFile()">+ Add File</button>
</div>
<div class="card">
<h2>Boot Commands (bootcmd)</h2>
<p class="subtitle">Commands that run on <strong>every boot</strong> very early, before cloud-init modules. Must be idempotent.</p>
<div class="warn-box">⚠️ bootcmd runs on EVERY boot — not just the first. Use only for idempotent operations like sysctl settings.</div>
<div class="dynamic-list" id="bootcmdList"></div>
<button class="btn btn-secondary" style="margin-top:8px" onclick="addBootCmd()">+ Add Boot Command</button>
<div style="display:flex;flex-wrap:wrap;gap:8px;margin-top:12px">
<button class="btn btn-secondary btn-sm" onclick="quickBootCmd('sysctl -w vm.max_map_count=262144')">vm.max_map_count</button>
<button class="btn btn-secondary btn-sm" onclick="quickBootCmd('sysctl -w net.ipv4.ip_forward=1')">Enable IP Forward</button>
<button class="btn btn-secondary btn-sm" onclick="quickBootCmd('echo never > /sys/kernel/mm/transparent_hugepage/enabled')">Disable THP</button>
<button class="btn btn-secondary btn-sm" onclick="quickBootCmd('sysctl -w net.core.somaxconn=65535')">Max Connections</button>
</div>
</div>
</div>
<!-- ═══ STEP 7: Run Commands & Services ═══ -->
<div class="step-section section-hidden" id="step-6">
<div class="card">
<h2>Run Commands (runcmd)</h2>
<p class="subtitle">Commands that run <strong>once</strong> on first boot after all cloud-init modules complete. Use for application setup.</p>
<div class="blue-box">ℹ️ runcmd runs as root. Commands run with <code>/bin/sh -c</code> so shell features like pipes and redirects work.</div>
<div class="dynamic-list" id="runcmdList"></div>
<button class="btn btn-secondary" style="margin-top:8px" onclick="addRunCmd()">+ Add Command</button>
<div style="display:flex;flex-wrap:wrap;gap:8px;margin-top:12px">
<button class="btn btn-secondary btn-sm" onclick="quickRunCmd('systemctl daemon-reload')">daemon-reload</button>
<button class="btn btn-secondary btn-sm" onclick="quickRunCmd('systemctl enable --now docker')">Enable Docker</button>
<button class="btn btn-secondary btn-sm" onclick="quickRunCmd('ufw allow 22/tcp && ufw --force enable')">Enable UFW</button>
<button class="btn btn-secondary btn-sm" onclick="quickRunCmd('timedatectl set-ntp true')">Enable NTP</button>
<button class="btn btn-secondary btn-sm" onclick="quickRunCmd('curl -fsSL https://get.docker.com | sh')">Install Docker</button>
<button class="btn btn-secondary btn-sm" onclick="quickRunCmd('setenforce 0 && sed -i s/^SELINUX=.*/SELINUX=permissive/ /etc/selinux/config')">SELinux Permissive</button>
<button class="btn btn-secondary btn-sm" onclick="quickRunCmd('dnf install -y epel-release')">Install EPEL</button>
<button class="btn btn-secondary btn-sm" onclick="quickRunCmd('apt-get install -y --no-install-recommends nfs-common')">NFS Client</button>
</div>
</div>
<div class="card">
<h2>Systemd Units</h2>
<p class="subtitle">Create custom systemd unit files (services, timers, sockets, etc). Cloud-init writes the unit file and runs <code>daemon-reload</code> plus enable/start via runcmd automatically. Service units can be built with a guided form or pasted as raw text — switching back to Guided regenerates the file from the form fields, discarding manual edits.</p>
<div class="dynamic-list" id="systemdUnitList"></div>
<button class="btn btn-secondary" style="margin-top:8px" onclick="addSystemdUnit()">+ Add Systemd Unit</button>
</div>
<div class="card">
<h2>NTP Configuration</h2>
<p class="subtitle">Configure Network Time Protocol servers.</p>
<div class="toggle-row">
<div><div class="toggle-label">Enable NTP configuration</div><div class="toggle-desc">Let cloud-init configure NTP client</div></div>
<label class="toggle"><input type="checkbox" id="ntpEnabled" onchange="onNtpToggle()"><span class="slider"></span></label>
</div>
<div id="ntpOptions" style="display:none;margin-top:16px">
<div class="form-grid">
<div class="form-group">
<label>NTP Client</label>
<select id="ntpClient">
<option value="auto">auto (cloud-init selects)</option>
<option value="chrony">chrony</option>
<option value="systemd-timesyncd">systemd-timesyncd</option>
<option value="ntp">ntp (ntpd)</option>
<option value="openntpd">openntpd</option>
</select>
</div>
</div>
<div class="form-grid" style="margin-top:12px">
<div class="form-group">
<label>NTP Servers</label>
<div class="tag-input-container" onclick="this.querySelector('input').focus()">
<div id="ntpServerTags"></div>
<input class="tag-input" id="ntpServerInput" placeholder="0.pool.ntp.org" onkeydown="addTagFromInput(event,'ntpServer')">
</div>
</div>
<div class="form-group">
<label>NTP Pools</label>
<div class="tag-input-container" onclick="this.querySelector('input').focus()">
<div id="ntpPoolTags"></div>
<input class="tag-input" id="ntpPoolInput" placeholder="pool.ntp.org" onkeydown="addTagFromInput(event,'ntpPool')">
</div>
</div>
</div>
</div>
</div>
<div class="card">
<h2>Final Settings</h2>
<p class="subtitle">Post-init message and power state action.</p>
<div class="form-grid">
<div class="form-group">
<label>Power State After Init</label>
<select id="powerState">
<option value="">None — do nothing</option>
<option value="reboot">reboot</option>
<option value="halt">halt</option>
<option value="poweroff">poweroff</option>
</select>
</div>
<div class="form-group" id="powerDelayGroup">
<label>Power State Delay <span class="hint">e.g. now, +1, +5</span></label>
<input type="text" id="powerDelay" value="now" placeholder="now">
</div>
<div class="form-group full">
<label>Final Message <span class="hint">Written to cloud-init log when complete</span></label>
<textarea id="finalMessage" rows="2" placeholder="Cloud-init complete on $HOSTNAME"></textarea>
</div>
</div>
</div>
</div>
<!-- ═══ STEP 8: Review & Generate ═══ -->
<div class="step-section section-hidden" id="step-7">
<div class="card">
<h2>Review & Generate</h2>
<p class="subtitle">Review your configuration, then generate the cloud-init files.</p>
<div id="reviewSummary"></div>
</div>
<div id="outputArea" style="display:none">
<div class="card">
<h2>user-data</h2>
<p class="subtitle">Place this file in your datasource as <code>user-data</code>. The first line must be exactly <code>#cloud-config</code>.</p>
<pre class="yaml-output" id="userDataOutput"></pre>
<div class="output-actions">
<button class="btn btn-primary btn-lg" onclick="downloadFile('userDataOutput','user-data')">⬇ Download user-data</button>
<button class="btn btn-secondary" onclick="copyOutput('userDataOutput')">📋 Copy</button>
</div>
</div>
<div class="card" id="networkOutputCard" style="display:none">
<h2>network-config</h2>
<p class="subtitle">Place this file alongside user-data in your datasource as <code>network-config</code>.</p>
<pre class="yaml-output" id="networkOutput"></pre>
<div class="output-actions">
<button class="btn btn-primary" onclick="downloadFile('networkOutput','network-config')">⬇ Download network-config</button>
<button class="btn btn-secondary" onclick="copyOutput('networkOutput')">📋 Copy</button>
</div>
</div>
</div>
<div class="card" id="ocpOutputCard" style="display:none">
<h2>OCP Console YAML</h2>
<p class="subtitle">In the OpenShift console VM wizard: <strong>Customize VirtualMachine → Scripts tab → Cloud-init → Script</strong> — select <strong>Script</strong> view (not Form), then paste below.</p>
<pre class="yaml-output" id="ocpOutput"></pre>
<div class="output-actions">
<button class="btn btn-ocp btn-lg" onclick="copyOutput('ocpOutput')">📋 Copy for OCP Console</button>
</div>
</div>
<div class="nav-buttons">
<button class="btn btn-secondary btn-lg" onclick="prevStep()">← Back</button>
<div class="nav-buttons-group">
<button class="btn btn-ocp btn-lg" onclick="generateForOCP()">Generate for OCP Console</button>
<button class="btn btn-primary btn-lg" onclick="generateAll()">⚡ Generate Config</button>
</div>
</div>
</div>
<!-- Nav buttons -->
<div id="navButtons" class="nav-buttons">
<button class="btn btn-secondary" onclick="prevStep()" id="prevBtn" style="visibility:hidden">← Back</button>
<button class="btn btn-primary" onclick="nextStep()" id="nextBtn">Next →</button>
</div>
</div>
<div class="copy-feedback" id="copyFeedback">Copied!</div>
<script>
// ─── Step definitions ─────────────────────────────────────────────────────────
const STEPS = ['System', 'Users & Auth', 'Network', 'Packages', 'Storage', 'Files & Boot', 'Commands', 'Generate'];
let currentStep = 0;
// ─── State arrays ─────────────────────────────────────────────────────────────
let users = [];
let interfaces = [];
let packages = [];
let globalDns = [];
let globalDnsSearch = [];
let aptSources = [];
let yumRepos = [];
let mounts = [];
let writeFiles = [];
let bootCmds = [];
let runCmds = [];
let ntpServers = [];
let ntpPools = [];
let systemdUnits = [];
// ─── Tag stores ───────────────────────────────────────────────────────────────
const tagStores = { package: packages, globalDns, globalDnsSearch, ntpServer: ntpServers, ntpPool: ntpPools };
// ─── Navigation ───────────────────────────────────────────────────────────────
function init() {
renderStepIndicator();
renderStep();
onDistroChange();
}
function renderStep() {
document.querySelectorAll('.step-section').forEach((el,i) => el.classList.toggle('section-hidden', i !== currentStep));
const isLast = currentStep === STEPS.length - 1;
document.getElementById('navButtons').style.display = isLast ? 'none' : 'flex';
document.getElementById('prevBtn').style.visibility = currentStep === 0 ? 'hidden' : 'visible';
document.getElementById('progressFill').style.width = Math.round((currentStep/(STEPS.length-1))*100) + '%';
renderStepIndicator();
if (isLast) renderReview();
}
function renderStepIndicator() {
const c = document.getElementById('stepIndicator');
c.innerHTML = '';
STEPS.forEach((name,i) => {
const p = document.createElement('button');
p.className = 'step-pill' + (i===currentStep?' active':i<currentStep?' done':'');
p.textContent = (i<currentStep?'✓ ':'')+name;
p.onclick = () => {
if(i<=currentStep){
if(currentStep===STEPS.length-1&&i<currentStep){
document.getElementById('outputArea').style.display='none';
document.getElementById('ocpOutputCard').style.display='none';
}
currentStep=i;renderStep();window.scrollTo(0,0);
}
};
c.appendChild(p);
});
}
function nextStep() { if(currentStep<STEPS.length-1){currentStep++;renderStep();window.scrollTo(0,0);} }
function prevStep() {
if (currentStep === STEPS.length - 1) {
document.getElementById('outputArea').style.display = 'none';
document.getElementById('ocpOutputCard').style.display = 'none';
}
if(currentStep>0){currentStep--;renderStep();window.scrollTo(0,0);}
}
// ─── Distro change ────────────────────────────────────────────────────────────
function onDistroChange() {
const d = document.getElementById('distroFamily').value;
document.getElementById('aptRepoArea').style.display = d === 'apt' ? '' : 'none';
document.getElementById('yumRepoArea').style.display = (d === 'yum' || d === 'amazon') ? '' : 'none';
renderQuickPkgs(d);
}
function renderQuickPkgs(distro) {
const pkgs = ['curl','wget','vim','git','htop','unzip','jq','net-tools','rsync','tree','tmux','bash-completion'];
const el = document.getElementById('quickPkgButtons');
el.innerHTML = '';
pkgs.forEach(p => {
const b = document.createElement('button');
b.className = 'btn btn-secondary btn-sm';
b.textContent = p;
b.onclick = () => { if (!packages.includes(p)) { packages.push(p); renderTags('package'); } };
el.appendChild(b);
});
}
// ─── Tag input generic ────────────────────────────────────────────────────────
function addTagFromInput(e, storeName) {
if (e.key !== 'Enter' && e.key !== ',') return;
e.preventDefault();
const val = e.target.value.trim().replace(/,$/, '');
if (!val) return;
const store = tagStores[storeName];
if (!store.includes(val)) { store.push(val); renderTags(storeName); }
e.target.value = '';
}
function renderTags(storeName) {
const store = tagStores[storeName];
const suffix = { package:'Tags', globalDns:'Tags', globalDnsSearch:'Tags', ntpServer:'Tags', ntpPool:'Tags' };
const container = document.getElementById(storeName + (suffix[storeName]||'Tags'));
if (!container) return;
container.innerHTML = '';
store.forEach((v,i) => {
const t = document.createElement('span');
t.className = 'ci-tag';
t.innerHTML = `${esc(v)} <span class="tag-remove" onclick="removeTag('${storeName}',${i})">×</span>`;
container.appendChild(t);
});
}
function removeTag(storeName, i) {
tagStores[storeName].splice(i,1);
renderTags(storeName);
}
// ─── Network ──────────────────────────────────────────────────────────────────
function onNetConfigModeChange() {
const mode = document.getElementById('netConfigMode').value;
const show = mode === 'v2';
document.getElementById('netRendererGroup').style.display = show ? '' : 'none';
document.getElementById('netInterfaceArea').style.display = show ? '' : 'none';
}
function addInterface() {
interfaces.push({ name: 'eth0', dhcp4: true, dhcp6: false, ip: '', prefix: '24', gw: '', dns: [], search: [] });
renderInterfaces();
}
function removeInterface(i) { interfaces.splice(i,1); renderInterfaces(); }
function renderInterfaces() {
const list = document.getElementById('ifaceList');
list.innerHTML = '';
interfaces.forEach((iface, i) => {
const card = document.createElement('div');
card.className = 'iface-card';
card.style.marginBottom = '10px';
card.innerHTML = `
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:12px">
<span style="font-weight:600;color:var(--accent)">Interface ${i+1}</span>
<button class="btn btn-secondary btn-sm" onclick="removeInterface(${i})">Remove</button>
</div>
<div class="form-grid">
<div class="form-group">
<label>Interface Name</label>
<input type="text" value="${escA(iface.name)}" placeholder="eth0" oninput="interfaces[${i}].name=this.value">
</div>
<div class="form-group">
<label>Configuration</label>
<select onchange="interfaces[${i}].dhcp4=this.value==='dhcp';renderInterfaces()">
<option value="dhcp" ${iface.dhcp4?'selected':''}>DHCP</option>
<option value="static" ${!iface.dhcp4?'selected':''}>Static</option>
</select>
</div>
${!iface.dhcp4 ? `
<div class="form-group">
<label>IP Address / Prefix Length</label>
<input type="text" value="${escA(iface.ip)}" placeholder="192.168.1.10/24" oninput="interfaces[${i}].ip=this.value">
</div>
<div class="form-group">
<label>Default Gateway</label>
<input type="text" value="${escA(iface.gw)}" placeholder="192.168.1.1" oninput="interfaces[${i}].gw=this.value">
</div>` : ''}
</div>`;
list.appendChild(card);
});
}
// ─── Users ────────────────────────────────────────────────────────────────────
function addUser() {
users.push({ name:'', gecos:'', groups:'sudo', shell:'/bin/bash', sudo:'ALL=(ALL) NOPASSWD:ALL', lockPasswd:true, passwd:'', sshKeys:'', sshImportId:'' });
renderUsers();
}
function removeUser(i) { users.splice(i,1); renderUsers(); }
function renderUsers() {
const list = document.getElementById('userList');
list.innerHTML = '';
users.forEach((u,i) => {
const card = document.createElement('div');
card.className = 'user-card';
card.style.marginBottom = '10px';
card.innerHTML = `
<div class="user-card-header">
<span class="user-card-name">${esc(u.name)||'New User'}</span>
<button class="btn btn-secondary btn-sm" onclick="removeUser(${i})">Remove</button>
</div>
<div class="form-grid">
<div class="form-group">
<label>Username <span class="req">*</span></label>
<input type="text" value="${escA(u.name)}" placeholder="admin" oninput="users[${i}].name=this.value; this.closest('.user-card').querySelector('.user-card-name').textContent=this.value||'New User'">
</div>
<div class="form-group">
<label>Full Name (GECOS)</label>
<input type="text" value="${escA(u.gecos)}" placeholder="Admin User" oninput="users[${i}].gecos=this.value">
</div>
<div class="form-group">
<label>Groups <span class="hint">comma-separated</span></label>
<input type="text" value="${escA(u.groups)}" placeholder="sudo,docker" oninput="users[${i}].groups=this.value">
</div>
<div class="form-group">
<label>Shell</label>
<select onchange="users[${i}].shell=this.value">
<option value="/bin/bash" ${u.shell==='/bin/bash'?'selected':''}>/bin/bash</option>
<option value="/bin/zsh" ${u.shell==='/bin/zsh'?'selected':''}>/bin/zsh</option>
<option value="/bin/sh" ${u.shell==='/bin/sh'?'selected':''}>/bin/sh</option>
<option value="/usr/sbin/nologin" ${u.shell==='/usr/sbin/nologin'?'selected':''}>/usr/sbin/nologin</option>
</select>
</div>
<div class="form-group">
<label>Sudo</label>
<select onchange="users[${i}].sudo=this.value">
<option value="ALL=(ALL) NOPASSWD:ALL" ${u.sudo==='ALL=(ALL) NOPASSWD:ALL'?'selected':''}>NOPASSWD:ALL (no password)</option>
<option value="ALL=(ALL:ALL) ALL" ${u.sudo==='ALL=(ALL:ALL) ALL'?'selected':''}>ALL (password required)</option>
<option value="" ${u.sudo===''?'selected':''}>None</option>
</select>
</div>
<div class="form-group full">
<label>Password <span class="hint">Must be a SHA-512 hash — plain text is not accepted</span></label>
<input type="text" class="mono" value="${escA(u.passwd)}" placeholder="$6$rounds=4096$salt$hash — leave blank for key-only auth" oninput="users[${i}].passwd=this.value">
<div style="font-size:0.74rem;color:var(--text-muted);margin-top:4px">Generate hash: <code style="background:var(--bg);padding:1px 6px;border-radius:4px;font-size:0.78rem">openssl passwd -6</code> then paste the output above</div>
</div>
<div class="form-group">
<label>Allow Password Login</label>
<select onchange="users[${i}].lockPasswd=this.value==='false'">
<option value="false" ${!u.lockPasswd?'selected':''}>No — key-based auth only (recommended)</option>
<option value="true" ${u.lockPasswd?'selected':''}>Yes — allow SSH password login</option>
</select>
</div>
<div class="form-group">
<label>SSH Import IDs <span class="hint">e.g. gh:username lp:username</span></label>
<input type="text" value="${escA(u.sshImportId)}" placeholder="gh:octocat" oninput="users[${i}].sshImportId=this.value">
</div>
<div class="form-group full">
<label>SSH Authorized Keys <span class="hint">one per line</span></label>
<textarea class="mono" rows="3" placeholder="ssh-ed25519 AAAA... user@host" oninput="users[${i}].sshKeys=this.value">${esc(u.sshKeys)}</textarea>
</div>
</div>`;
list.appendChild(card);
});
if (!users.length) list.innerHTML = '<p style="color:var(--text-muted);font-size:0.82rem;padding:8px 0">No users configured. The cloud provider default user (ubuntu, ec2-user, etc.) will still be created.</p>';
}
// ─── APT sources ──────────────────────────────────────────────────────────────
function addAptSource() {
aptSources.push({ name:'', source:'', keyid:'' });
renderAptSources();
}
function removeAptSource(i) { aptSources.splice(i,1); renderAptSources(); }
function renderAptSources() {
const list = document.getElementById('aptSourceList');
list.innerHTML = '';
aptSources.forEach((s,i) => {
const row = document.createElement('div');
row.className = 'dynamic-row';
row.innerHTML = `
<div class="dynamic-row-header"><span class="dynamic-row-title">APT Source ${i+1}</span>
<button class="btn btn-secondary btn-sm" onclick="removeAptSource(${i})">Remove</button></div>
<div class="form-grid">
<div class="form-group">
<label>Source List Name <span class="hint">used as filename in sources.list.d</span></label>
<input type="text" value="${escA(s.name)}" placeholder="docker.list" oninput="aptSources[${i}].name=this.value">
</div>
<div class="form-group">
<label>GPG Key ID</label>
<input type="text" class="mono" value="${escA(s.keyid)}" placeholder="9DC858229FC7DD38854AE2D88D81803C0EBFCD88" oninput="aptSources[${i}].keyid=this.value">
</div>
<div class="form-group full">
<label>Source Line</label>
<input type="text" class="mono" value="${escA(s.source)}" placeholder="deb [arch=amd64] https://download.docker.com/linux/ubuntu $RELEASE stable" oninput="aptSources[${i}].source=this.value">
</div>
</div>`;
list.appendChild(row);
});
}
// ─── YUM repos ────────────────────────────────────────────────────────────────
function addYumRepo() {
yumRepos.push({ id:'', name:'', baseurl:'', gpgcheck:true, gpgkey:'', enabled:true });
renderYumRepos();
}
function removeYumRepo(i) { yumRepos.splice(i,1); renderYumRepos(); }
function renderYumRepos() {
const list = document.getElementById('yumRepoList');
list.innerHTML = '';
yumRepos.forEach((r,i) => {
const row = document.createElement('div');
row.className = 'dynamic-row';
row.innerHTML = `
<div class="dynamic-row-header"><span class="dynamic-row-title">Repository ${i+1}</span>
<button class="btn btn-secondary btn-sm" onclick="removeYumRepo(${i})">Remove</button></div>
<div class="form-grid">
<div class="form-group"><label>Repo ID</label><input type="text" value="${escA(r.id)}" placeholder="epel" oninput="yumRepos[${i}].id=this.value"></div>
<div class="form-group"><label>Name</label><input type="text" value="${escA(r.name)}" placeholder="EPEL" oninput="yumRepos[${i}].name=this.value"></div>
<div class="form-group full"><label>Base URL</label><input type="text" class="mono" value="${escA(r.baseurl)}" placeholder="https://dl.fedoraproject.org/pub/epel/$releasever/$basearch/" oninput="yumRepos[${i}].baseurl=this.value"></div>
<div class="form-group"><label>GPG Key URL</label><input type="text" class="mono" value="${escA(r.gpgkey)}" placeholder="https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL" oninput="yumRepos[${i}].gpgkey=this.value"></div>
<div class="form-group"><label>GPG Check</label>
<select onchange="yumRepos[${i}].gpgcheck=this.value==='true'">
<option value="true" ${r.gpgcheck?'selected':''}>true</option>
<option value="false" ${!r.gpgcheck?'selected':''}>false</option>
</select>
</div>
</div>`;
list.appendChild(row);
});
}
// ─── Mounts ───────────────────────────────────────────────────────────────────
function addMount() {
mounts.push({ device:'', mountpoint:'', fstype:'ext4', options:'defaults,nofail', dump:0, pass:0 });
renderMounts();
}
function removeMount(i) { mounts.splice(i,1); renderMounts(); }
function onMountFstypeChange(i, value) {