-
Notifications
You must be signed in to change notification settings - Fork 1
/
00-core.bu
2679 lines (2477 loc) · 101 KB
/
00-core.bu
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
variant: fcos
version: 1.0.0
passwd:
groups:
- name: libvirtd
users:
- name: core
gecos: CoreOS Admin
groups:
- sudo
- wheel
- adm
- systemd-journal
- name: onp
gecos: OpenShift Network Playground User
groups:
- sudo
- wheel
- adm
- systemd-journal
- libvirtd
password_hash: $y$j9T$PNaoSZJskJ6WwR/2iS78a0$/6.dOJ1S2UWLMz0F/1mJvNN4dH3EZ1Y68hLfBsODgi0
systemd:
units:
- name: systemd-resolved.service
enabled: false
mask: true
- name: zincati.service
enabled: false
- name: libvirtd.socket
enabled: true
- name: host-configure.service
enabled: true
contents: |
[Unit]
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
ExecStart=/opt/openshift-network-playground/host/configure.sh
RemainAfterExit=yes
[Install]
WantedBy=basic.target
- name: master0.service
enabled: true
contents: |
[Unit]
Wants=libvirtd.socket
After=libvirtd.socket
Requires=libvirtd.socket
ConditionPathExists=!/opt/openshift-network-playground/master0.done
[Service]
Timeout=0
Type=oneshot
ExecStart=/opt/openshift-network-playground/libvirt/create-vm.sh master0 52:54:00:11:22:b1 52:54:00:11:22:a1
ExecStartPost=/usr/bin/touch /opt/openshift-network-playground/master0.done
RemainAfterExit=yes
[Install]
WantedBy=basic.target
- name: master1.service
enabled: true
contents: |
[Unit]
Wants=libvirtd.socket
After=libvirtd.socket
Requires=libvirtd.socket
ConditionPathExists=!/opt/openshift-network-playground/master1.done
[Service]
Timeout=0
Type=oneshot
ExecStart=/opt/openshift-network-playground/libvirt/create-vm.sh master1 52:54:00:11:22:b2 52:54:00:11:22:a2
ExecStartPost=/usr/bin/touch /opt/openshift-network-playground/master1.done
RemainAfterExit=yes
[Install]
WantedBy=basic.target
- name: master2.service
enabled: true
contents: |
[Unit]
Wants=libvirtd.socket
After=libvirtd.socket
Requires=libvirtd.socket
ConditionPathExists=!/opt/openshift-network-playground/master2.done
[Service]
Timeout=0
Type=oneshot
ExecStart=/opt/openshift-network-playground/libvirt/create-vm.sh master2 52:54:00:11:22:b3 52:54:00:11:22:a3
ExecStartPost=/usr/bin/touch /opt/openshift-network-playground/master2.done
RemainAfterExit=yes
[Install]
WantedBy=basic.target
- name: worker0.service
enabled: true
contents: |
[Unit]
Wants=libvirtd.socket
After=libvirtd.socket
Requires=libvirtd.socket
ConditionPathExists=!/opt/openshift-network-playground/worker0.done
[Service]
Timeout=0
Type=oneshot
ExecStart=/opt/openshift-network-playground/libvirt/create-vm.sh worker0 52:54:00:11:22:b4 52:54:00:11:22:a4 2 8192
ExecStartPost=/usr/bin/touch /opt/openshift-network-playground/worker0.done
RemainAfterExit=yes
[Install]
WantedBy=basic.target
- name: worker1.service
enabled: true
contents: |
[Unit]
Wants=libvirtd.socket
After=libvirtd.socket
Requires=libvirtd.socket
ConditionPathExists=!/opt/openshift-network-playground/worker1.done
[Service]
Timeout=0
Type=oneshot
ExecStart=/opt/openshift-network-playground/libvirt/create-vm.sh worker1 52:54:00:11:22:b5 52:54:00:11:22:a5 2 8192
ExecStartPost=/usr/bin/touch /opt/openshift-network-playground/worker1.done
RemainAfterExit=yes
[Install]
WantedBy=basic.target
- name: webserver.service
enabled: true
contents: |
[Unit]
Description=Webserver for openshift-network-playground
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStartPre=/bin/rm -f %t/%n.ctr-id
ExecStart=/usr/bin/podman run \
--cidfile=%t/%n.ctr-id \
--cgroups=no-conmon \
--rm \
--sdnotify=conmon \
--replace \
--detach \
--net host \
--name webserver \
-v /home/onp/openshift-network-playground/rhcos_image_cache:/var/www/html quay.io/centos7/httpd-24-centos7:latest
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all
[Install]
WantedBy=default.target
- name: vbmc.service
enabled: true
contents: |
[Unit]
Description=vbmc for openshift-network-playground
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=70
TimeoutStartSec=600
ExecStartPre=/usr/bin/rm -f %t/%n.ctr-id
ExecStartPre=/usr/bin/rm -vf /opt/openshift-network-playground/vbmc/config/master.pid
ExecStart=/usr/bin/podman run \
--cidfile=%t/%n.ctr-id \
--cgroups=no-conmon \
--rm \
--sdnotify=conmon \
--replace \
-d \
-ti \
--name vbmc \
--net host \
--volume "/opt/openshift-network-playground/vbmc/config:/root/.vbmc" \
--volume "/opt/openshift-network-playground/vbmc/ssh:/root/.ssh" \
quay.io/metal3-io/vbmc
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all
[Install]
WantedBy=default.target
- name: dhcp.service
enabled: true
contents: |
[Unit]
Description=DHCP for openshift-network-playground
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStartSec=180
TimeoutStopSec=70
ExecStartPre=-/usr/bin/rm -f %t/%n.ctr-id
ExecStartPre=/usr/bin/podman build --net host --tag localhost/dhcp /opt/openshift-network-playground/dhcp
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon --name dhcp -d --net host --cap-add NET_ADMIN,NET_RAW localhost/dhcp
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all
[Install]
WantedBy=default.target
- name: onp1-dhcp.service
enabled: false
contents: |
[Unit]
Description=DHCP for openshift-network-playground
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStartSec=180
TimeoutStopSec=70
ExecStartPre=-/usr/bin/rm -f %t/%n.ctr-id
ExecStartPre=/usr/bin/podman build --net host --tag localhost/onp1-dhcp /opt/openshift-network-playground/onp1-dhcp
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon --name onp1-dhcp -d --net host --cap-add NET_ADMIN,NET_RAW localhost/onp1-dhcp
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all
[Install]
WantedBy=default.target
- name: onp2-dhcp.service
enabled: false
contents: |
[Unit]
Description=DHCP for openshift-network-playground
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStartSec=180
TimeoutStopSec=70
ExecStartPre=-/usr/bin/rm -f %t/%n.ctr-id
ExecStartPre=/usr/bin/podman build --net host --tag localhost/onp2-dhcp /opt/openshift-network-playground/onp2-dhcp
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon --name onp2-dhcp -d --net host --cap-add NET_ADMIN,NET_RAW localhost/onp2-dhcp
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all
[Install]
WantedBy=default.target
- name: pxe.service
enabled: false
contents: |
[Unit]
Description=PXE for openshift-network-playground
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStartSec=180
TimeoutStopSec=70
ExecStartPre=-/usr/bin/rm -f %t/%n.ctr-id
ExecStartPre=/usr/bin/podman build --net host --tag localhost/pxe /opt/openshift-network-playground/pxe
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon --name pxe -d --net host --cap-add NET_ADMIN,NET_RAW localhost/pxe
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all
[Install]
WantedBy=default.target
- name: broadcast.service
enabled: true
contents: |
[Unit]
Description=Check containers status
After=selinux-configure.service
[Service]
Timeout=0
Type=oneshot
ExecStart=/opt/openshift-network-playground/host/broadcast.sh
RemainAfterExit=yes
[Install]
WantedBy=basic.target
- name: nat64.service
enabled: true
contents: |
[Unit]
Description=NAT64 for openshift-network-playground
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStartSec=180
TimeoutStopSec=70
ExecStartPre=-/usr/bin/rm -f %t/%n.ctr-id
ExecStartPre=/usr/bin/podman build --net host --tag localhost/nat64 /opt/openshift-network-playground/nat64
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon --name nat64 --detach --net host --privileged localhost/nat64
ExecStartPost=/opt/openshift-network-playground/nat64/host.sh
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all
[Install]
WantedBy=default.target
- name: dns64.service
enabled: true
contents: |
[Unit]
Description=DNS64 for openshift-network-playground
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStartSec=180
TimeoutStopSec=70
ExecStartPre=-/usr/bin/rm -f %t/%n.ctr-id
ExecStartPre=/usr/bin/podman build --net host --tag localhost/dns64 /opt/openshift-network-playground/dns64
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon --name dns64 -d --net host --cap-add NET_ADMIN,NET_RAW localhost/dns64
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all
[Install]
WantedBy=default.target
- name: proxy.service
enabled: true
contents: |
[Unit]
Description=Proxy for openshift-network-playground
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStartSec=180
TimeoutStopSec=70
ExecStartPre=-/usr/bin/rm -f %t/%n.ctr-id
ExecStartPre=/usr/bin/podman build --net host --tag localhost/proxy /opt/openshift-network-playground/proxy
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon --name proxy -d --net host --volume /opt/openshift-network-playground/proxy/certs:/etc/squid-cert --cap-add NET_ADMIN,NET_RAW localhost/proxy
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all
[Install]
WantedBy=default.target
storage:
directories:
- path: /home/onp/openshift-network-playground
mode: 0755
overwrite: true
user:
name: onp
group:
name: onp
- path: /home/onp/openshift-network-playground/rhcos_image_cache
mode: 0755
overwrite: true
user:
name: onp
group:
name: onp
- path: /home/onp/.local/bin
mode: 0755
overwrite: true
user:
name: onp
group:
name: onp
files:
- path: /opt/openshift-network-playground/vbmc/ssh/config
mode: 0644
overwrite: true
contents:
inline: |
StrictHostKeyChecking no
- path: /opt/openshift-network-playground/vbmc/config/master0/config
mode: 0644
user:
id: 1001
group:
id: 1001
overwrite: true
contents:
inline: |
[VirtualBMC]
username = admin
password = password
address = 192.168.123.1
port = 6230
domain_name = master0
libvirt_uri = qemu+ssh://onp@192.168.123.1/system
active = True
- path: /opt/openshift-network-playground/vbmc/config/master1/config
mode: 0644
user:
id: 1001
group:
id: 1001
overwrite: true
contents:
inline: |
[VirtualBMC]
username = admin
password = password
address = 192.168.123.1
port = 6231
domain_name = master1
libvirt_uri = qemu+ssh://onp@192.168.123.1/system
active = True
- path: /opt/openshift-network-playground/vbmc/config/master2/config
mode: 0644
user:
id: 1001
group:
id: 1001
overwrite: true
contents:
inline: |
[VirtualBMC]
username = admin
password = password
address = 192.168.123.1
port = 6232
domain_name = master2
libvirt_uri = qemu+ssh://onp@192.168.123.1/system
active = True
- path: /opt/openshift-network-playground/vbmc/config/worker0/config
mode: 0644
user:
id: 1001
group:
id: 1001
overwrite: true
contents:
inline: |
[VirtualBMC]
username = admin
password = password
address = 192.168.123.1
port = 6233
domain_name = worker0
libvirt_uri = qemu+ssh://onp@192.168.123.1/system
active = True
- path: /opt/openshift-network-playground/vbmc/config/worker1/config
mode: 0644
user:
id: 1001
group:
id: 1001
overwrite: true
contents:
inline: |
[VirtualBMC]
username = admin
password = password
address = 192.168.123.1
port = 6234
domain_name = worker1
libvirt_uri = qemu+ssh://onp@192.168.123.1/system
active = True
- path: /etc/resolv.conf
mode: 0644
overwrite: true
contents:
inline: ""
- path: /etc/sudoers.d/onp
mode: 0644
overwrite: true
contents:
inline: |
onp ALL=(ALL) NOPASSWD: ALL
- path: /etc/polkit-1/localauthority/50-local.d/50-onp-libvirt-remote-access.pkla
mode: 0644
overwrite: true
contents:
inline: |
[Remote libvirt SSH access]
Identity=unix-user:onp
Action=org.libvirt.unix.manage
ResultAny=yes
ResultInactive=yes
ResultActive=yes
- path: /etc/libvirt/libvirt.conf
mode: 0644
overwrite: true
contents:
inline: |
uri_default = "qemu:///system"
- path: /etc/sysctl.d/99-sysctl.conf
mode: 0644
overwrite: true
contents:
inline: |
net.ipv4.ip_forward = 1
- path: /etc/ssh/sshd_config.d/20-enable-passwords.conf
mode: 0644
overwrite: true
contents:
inline: |
PasswordAuthentication yes
- path: /opt/openshift-network-playground/host/configure.sh
mode: 0755
contents:
inline: |
#!/bin/sh
/usr/sbin/iptables -t nat -I POSTROUTING -s 192.168.123.0/24 ! -d 192.168.123.0/24 -j MASQUERADE
/usr/sbin/iptables -t nat -I POSTROUTING -s 192.168.124.0/24 ! -d 192.168.124.0/24 -j MASQUERADE
/usr/sbin/iptables -t nat -I POSTROUTING -s 192.168.125.0/24 ! -d 192.168.125.0/24 -j MASQUERADE
/usr/bin/echo 1 > /proc/sys/net/ipv6/conf/$(ip -o -4 route show default | awk '{print $5}')/disable_ipv6
/usr/sbin/iptables -t nat -I PREROUTING -p tcp -i $(/usr/sbin/ip r | grep default | awk '{print $5}' | head -n 1) --dport 443 -j DNAT --to-destination 192.168.123.89:443
/usr/sbin/iptables -t nat -I PREROUTING -p tcp -i $(/usr/sbin/ip r | grep default | awk '{print $5}' | head -n 1) --dport 80 -j DNAT --to-destination 192.168.123.89:80
/usr/sbin/iptables -t nat -I PREROUTING -p tcp -i $(/usr/sbin/ip r | grep default | awk '{print $5}' | head -n 1) --dport 6443 -j DNAT --to-destination 192.168.123.88:6443
/usr/bin/test -f /opt/openshift-network-playground/vbmc/ssh/id_rsa || (ssh-keygen -N '' -f /opt/openshift-network-playground/vbmc/ssh/id_rsa && mkdir -p /home/onp/.ssh && cp /opt/openshift-network-playground/vbmc/ssh/id_rsa.pub /home/onp/.ssh/authorized_keys && chown onp:onp -R /home/onp/.ssh)
/usr/bin/test -f /opt/openshift-network-playground/cockpit-ws.done || (/usr/bin/test -d /usr/share/cockpit && podman container runlabel --name cockpit-ws RUN quay.io/cockpit/ws && podman container runlabel INSTALL quay.io/cockpit/ws && systemctl enable --now cockpit.service && touch /opt/openshift-network-playground/cockpit-ws.done)
/usr/bin/chown -R onp:onp /home/onp/.local
- path: /etc/NetworkManager/system-connections/ens3.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=ens3
type=ethernet
autoconnect=yes
interface-name=ens3
[ipv4]
method=auto
[ipv6]
method=disabled
- path: /etc/NetworkManager/system-connections/baremetal-dummy.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=baremetal-dummy
type=dummy
interface-name=baremetal-dummy
autoconnect=yes
master=baremetal
slave-type=bridge
[ipv4]
method=link-local
[ipv6]
method=disabled
- path: /etc/NetworkManager/system-connections/baremetal.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=baremetal
type=bridge
autoconnect=yes
interface-name=baremetal
[ipv4]
method=manual
addresses=192.168.123.1
[ipv6]
method=disabled
[bridge]
mac-address=52:54:00:11:22:a0
interface-name=baremetal
- path: /etc/NetworkManager/system-connections/baremetal-slave.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=baremetal-slave
type=ethernet
interface-name=baremetal-dummy
master=baremetal
autoconnect=yes
slave-type=bridge
- path: /etc/NetworkManager/system-connections/provision-dummy.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=provision-dummy
type=dummy
interface-name=provision-dummy
autoconnect=yes
master=provisioning
slave-type=bridge
[ipv4]
method=link-local
[ipv6]
method=disabled
- path: /etc/NetworkManager/system-connections/provisioning.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=provisioning
type=bridge
interface-name=provisioning
autoconnect=yes
[ipv4]
method=manual
addresses=172.22.0.254/24
[ipv6]
method=disabled
[bridge]
mac-address=52:54:00:11:22:b0
interface-name=provisioning
- path: /etc/NetworkManager/system-connections/provisioning-slave.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=provisioning-slave
type=ethernet
interface-name=provision-dummy
master=provisioning
autoconnect=yes
slave-type=bridge
- path: /etc/NetworkManager/system-connections/onp1-dummy.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=onp1-dummy
type=dummy
interface-name=onp1-dummy
autoconnect=yes
master=onp1
slave-type=bridge
[ipv4]
method=link-local
[ipv6]
method=disabled
- path: /etc/NetworkManager/system-connections/onp1.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=onp1
type=bridge
autoconnect=yes
interface-name=onp1
[ipv4]
method=manual
addresses=192.168.124.1
[ipv6]
method=disabled
[bridge]
mac-address=52:54:00:11:22:c0
interface-name=onp1
- path: /etc/NetworkManager/system-connections/onp1-slave.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=onp1-slave
type=ethernet
interface-name=onp1-dummy
master=onp1
autoconnect=yes
slave-type=bridge
- path: /etc/NetworkManager/system-connections/onp2-dummy.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=onp2-dummy
type=dummy
interface-name=onp2-dummy
autoconnect=yes
master=onp2
slave-type=bridge
[ipv4]
method=link-local
[ipv6]
method=disabled
- path: /etc/NetworkManager/system-connections/onp2.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=onp2
type=bridge
autoconnect=yes
interface-name=onp2
[ipv4]
method=manual
addresses=192.168.125.1
[ipv6]
method=disabled
[bridge]
mac-address=52:54:00:11:22:d0
interface-name=onp2
- path: /etc/NetworkManager/system-connections/onp2-slave.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=onp2-slave
type=ethernet
interface-name=onp2-dummy
master=onp2
autoconnect=yes
slave-type=bridge
- path: /etc/NetworkManager/system-connections/sno0-dummy.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=sno0-dummy
type=dummy
interface-name=sno0-dummy
autoconnect=yes
master=sno0
slave-type=bridge
[ipv4]
method=link-local
[ipv6]
method=disabled
- path: /etc/NetworkManager/system-connections/sno0-slave.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=sno0-slave
type=ethernet
interface-name=sno0-dummy
master=sno0
autoconnect=yes
slave-type=bridge
- path: /etc/NetworkManager/system-connections/sno0.nmconnection
mode: 0600
overwrite: true
user:
name: root
contents:
inline: |
[connection]
id=sno0
type=bridge
autoconnect=yes
interface-name=sno0
[ipv4]
method=manual
addresses=192.168.126.1
[ipv6]
method=manual
addresses=fd00:dead:beef::1/96
[bridge]
mac-address=52:54:00:11:22:e0
interface-name=sno0
- path: /etc/NetworkManager/conf.d/openshift-network-playground.conf
mode: 0644
overwrite: true
user:
name: root
contents:
inline: |
[main]
plugins=keyfile
dns=dnsmasq
- path: /etc/NetworkManager/dnsmasq.d/openshift-network-playground.conf
mode: 0644
overwrite: true
user:
name: root
contents:
inline: |
address=/.apps.ocp.example.local/192.168.123.89
address=/.apps.sno.example.local/192.168.124.2
address=/.apps.sno.example.local/fd00:dead:beef::2
addn-hosts=/etc/hosts
- path: /etc/hosts
mode: 0644
overwrite: true
user:
name: root
contents:
inline: |
127.0.0.1 localhost localhost.localdomain openshift-network-playground.ocp.example.local
192.168.123.88 api.ocp.example.local
192.168.123.90 bootstrap.ocp.example.local
192.168.123.91 master0.ocp.example.local
192.168.123.92 master1.ocp.example.local
192.168.123.93 master2.ocp.example.local
192.168.123.94 worker0.ocp.example.local
192.168.123.95 worker1.ocp.example.local
192.168.123.1 openshift-network-playground.ocp.example.local lb.ocp.example.local mirror.ocp.example.local proxy.ocp.example.local
192.168.126.2 api.sno.example.local api-int.sno.example.local node.sno.example.local
fd00:dead:beef::2 api.sno.example.local api-int.sno.example.local node.sno.example.local
- path: /etc/zincati/config.d/90-disable-auto-updates.toml
contents:
inline: |
[updates]
enabled = false
- path: /opt/openshift-network-playground/libvirt/create-vm.sh
mode: 0755
overwrite: true
user:
name: onp
group:
name: onp
contents:
inline: |
#!/bin/bash
# Create node for openshift-network-playground
set -euxo pipefail
VM_NAME=$1
MAC1=$2
MAC2=$3
VM_DIR=/opt/openshift-network-playground/libvirt
VM_DISK=$VM_DIR/$VM_NAME/$VM_NAME.img
VCPU=${4:-4}
MEMORY=${5:-16384}
NETWORK1=bridge=provisioning,mac=$MAC1
NETWORK2=bridge=baremetal,mac=$MAC2
if virsh list | grep $VM_NAME 2>&1>/dev/null; then virsh destroy $VM_NAME 2>/dev/null; virsh undefine $VM_NAME 2>/dev/null; fi
if virsh list --all | grep $VM_NAME 2>&1>/dev/null; then virsh undefine $VM_NAME 2>/dev/null; fi
if [ ! -f $VM_DISK ] ; then mkdir -p $VM_DIR/$VM_NAME; qemu-img create $VM_DISK 120G; fi
virsh define <(virt-install --name $VM_NAME \
--os-variant fedora-coreos-stable \
--vcpus $VCPU \
--memory $MEMORY \
--disk $VM_DISK \
--network $NETWORK1 \
--network $NETWORK2 \
--pxe \
--boot network,hd \
--graphics spice,listen=0.0.0.0 \
--video virtio \
--channel spicevmc \
--console pty,target.type=virtio \
--serial pty \
--noautoconsole \
--print-xml 2)
touch /opt/openshift-network-playground/$VM_NAME.done
- path: /opt/openshift-network-playground/dhcp/Containerfile
mode: 0644
overwrite: true
contents:
inline: |
FROM fedora
MAINTAINER "Vinu K" <vkochuku@redhat.com>
RUN yum install -y dnsmasq
ADD dnsmasq.conf /dnsmasq.conf
ENTRYPOINT ["dnsmasq"]
CMD ["-C", "/dnsmasq.conf"]
- path: /opt/openshift-network-playground/dhcp/dnsmasq.conf
mode: 0644
overwrite: true
contents:
inline: |
no-daemon
interface=baremetal
dhcp-range=192.168.123.2,192.168.123.254,255.255.255.0
except-interface=lo
bind-interfaces
log-dhcp
dhcp-authoritative
log-async
dhcp-host=52:54:00:11:22:a1,master0.ocp.example.local,192.168.123.91
dhcp-host=52:54:00:11:22:a2,master1.ocp.example.local,192.168.123.92
dhcp-host=52:54:00:11:22:a3,master2.ocp.example.local,192.168.123.93
dhcp-host=52:54:00:11:22:a4,worker0.ocp.example.local,192.168.123.94
dhcp-host=52:54:00:11:22:a5,worker1.ocp.example.local,192.168.123.95
- path: /opt/openshift-network-playground/pxe/Containerfile
mode: 0644
overwrite: true
contents:
inline: |
FROM fedora
MAINTAINER "Vinu K" <vkochuku@redhat.com>
RUN yum install -y dnsmasq
ADD dnsmasq.conf /dnsmasq.conf
ENTRYPOINT ["dnsmasq"]
CMD ["-C", "/dnsmasq.conf"]
- path: /opt/openshift-network-playground/pxe/dnsmasq.conf
mode: 0644
overwrite: true
contents:
inline: |
no-daemon
interface=provisioning
dhcp-range=172.22.0.3,172.22.0.253,255.255.255.0
except-interface=lo
bind-interfaces
log-dhcp
log-queries
dhcp-authoritative
log-async
enable-tftp
dhcp-userclass=set:ipxe,iPXE
dhcp-boot=tag:ipxe,http://172.22.0.2/boot.ipxe
- path: /opt/openshift-network-playground/onp1-dhcp/Containerfile
mode: 0644
overwrite: true
contents:
inline: |
FROM fedora
MAINTAINER "Vinu K" <vkochuku@redhat.com>
RUN yum install -y dnsmasq
ADD dnsmasq.conf /dnsmasq.conf
ENTRYPOINT ["dnsmasq"]
CMD ["-C", "/dnsmasq.conf"]
- path: /opt/openshift-network-playground/onp1-dhcp/dnsmasq.conf
mode: 0644
overwrite: true
contents:
inline: |
no-daemon
interface=onp1
dhcp-range=192.168.124.2,192.168.124.254,255.255.255.0
except-interface=lo
bind-interfaces