-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathsat65-setup.sh
1113 lines (965 loc) · 78.8 KB
/
sat65-setup.sh
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
#!/bin/bash
# vim: ft=sh:sw=2:et
cat <<EOF
Satellite-6.5 Demo/Test/PoC Setup Script
========================================
This script is intended to automate a comprehensive Satellite-6.5 server installation for demo, test or PoC purposes.
The script helps to perform the initial steps to finish the prerequisites, it installs and configures the software,
it fills the Satellite with various types of content, it creates activation keys and content views,
it customizes some smart class parameter overrides and finally installs a couple of new hosts.
With this setup, the script is well suited as a Satellite-6 test.
In an PoC scenario, it allows to emphasize on the actual use cases and requirements from the very first moment.
This demo setup shows some of the features and benefits of Satellite-6.5:
- Satellite is configured to authenticate with an existing IPA server (IPA is prerequisite, out of scope for this demo).
- Satellite is configured to use the existing IPA CA (again, IPA is prerequisite, out of scope for this demo).
- Satellite is configured to register hosts automatically into the IPA REALM.
- The simple baseline host is hardened so that root login is disabled.
Given the appropriate IPA setup (prerequisite, out of scope for this demo) users can log into the host and sudo if IPA authorization permits.
- A GIT server is created with a post-receive hook that automatically syncs new puppet classes from GIT to Satellite into a dedicated puppet only content view.
This GIT setup demonstrates how to create a rapid puppet development workflow with Satellite-6.
- A dockerhost is created with appropriate partitioning and network configuration to demonstrate the value of a stable baseline (packages and configuration) to build and run docker containers.
- A comprehensive buildhost is created to demonstrate the value of the stable baseline (packages and configuration) for development and build environments.
The buildhost puppet profile class demonstrates the adoption of a role-profile model with Satellite-6.
The automation of the buildhost setup is taken so far that a complete jenkins build pipeline is set up and running to show a JBoss TicketMonster development workflow.
This demo is intended to run in a VM on a libvirt/KVM host. The Satellite VM requires least 8GB of RAM and 4 cores. 12GB RAM and 6 cores are recommended.
I recommend using a dedicated server from a hosting provider which is available for less than €50 per month.
The network setup must allow Satellite to run DHCP and TFTP on a dedicated interface.
With all features enabled, the demo setup will consume around 180GB of disk space for package content in /var/lib/pulp.
Using the immediate sync policy, the content sync alone takes more than 24 hours even with a high bandwidth internet connection.
In preparation for a Satellite-6 PoC this script can be used to perform this time consuming procedure ahead of the actual PoC engagement.
There is at least one manual intervention required directly after satellite-install has finished and a second halt is included right before the demo hosts are created at the end.
So be prepared to be around for at least an hour or so after starting the script to proceed after the first manual intervention.
After that, you may go home and proceed the next day...
You may want to run this script in a screen session.
The header section of this script declares a lot of variables that are used later on to customize the script.
Read through the values carefully and change where appropriate.
When finished, delete or comment the following exit command.
EOF
exit 0
set -x
set -e
longname=$(hostname | tr '.' '_')
# This is a Sat6 engineering manifest. Replace with your custom manifest.
export MANIFEST=/tmp/Satellite_65_Generated_July_16_2019.zip
# scp Satellite_65_Generated_July_16_2019.zip [email protected]:/tmp
# scp sat65-setup.sh [email protected]:
# The script is built such that the preparation steps can be skipped if later stages need to be extended or repeated.
# The higher the STAGE Level is, the more preparation steps are skipped.
# STAGE Level:
# 1 = preqequisite preparation
# 2 = Satellite 6 installation
# 3 = environment setup
# 4 = basic content view creation
# 5 = content sync
# 6 = content view customizing and promotion
# 7 = activation key, hostgroup setup, sc_params
# 8 = creation of example hosts
export STAGE=1
# This demo setup is built with IPA integration as one important feature to show.
# While it is possible to use IPA and leave Satellite with the self signed internal CA cert,
# it is recommended to demonstrate/test this feature as well.
# The IPA_EXT_CERT switch is mainly offered for debugging purposes.
export IPA_EXT_CERT=true
# Product / Repo List and Mapping
# CSV Fields:
# Index ; Priority ; CV-Mapping ; Repo-Name ; Prod-Name ; Prod-Family ; Architecture ; Release-Version
# Priority selects products based on a decimal encoded bit matrix. Essential
# content has assigned priority bit 1. All additional product selections are
# triggered by the appropriate bits in the priority value.
ESSENTIAL_CONTENT=1
RHEL8_CONTENT=2
RHEL7_CONTENT=4
RHEL6_CONTENT=8
MISC_CONTENT=16
DEV_CONTENT=32
JBOSS_CONTENT=64
EXT_CONTENT=128
OSCP_CONTENT=256
OSE_CONTENT=512
RHV_CONTENT=1024
export CONTENT_MASK=$((ESSENTIAL_CONTENT + RHEL6_CONTENT + RHEL7_CONTENT + RHEL8_CONTENT + MISC_CONTENT + DEV_CONTENT + JBOSS_CONTENT + EXT_CONTENT + OSCP_CONTENT + OSE_CONTENT + RHV_CONTENT))
export CUST_CONTENT='true'
export CUSTOM_REPO_HOST=sol.lunetix.org
export CUSTOM_REPO_IP=85.25.159.110
# CV-Mapping assigns products to Content Views based on a decimal encoded bit matrix.
# CV_RHEL7_Base=1
# CV_inf_capsule=2
# CV_inf_ipa_rhel7=4
# CV_inf_hypervisor_rhel7=8
# CV_inf_builder_rhel7=16
# CV_inf_oscp_rhel7=32
# CV_inf_eap_rhel7=64
# CV_inf_docker_rhel7=128
# CV_inf_git_rhel7=256
# CV_RHEL6_Base=512
# CV_RHEL8_Base=1024
# CV_RHEL8_Ext=2048
# CV_puppet_fasttrack=4096
CV_array=(RHEL7-Base inf-capsule inf-ipa-rhel7 inf-hypervisor-rhel7 inf-builder-rhel7 inf-oscp-rhel7 inf-eap-rhel7 inf-docker-rhel7 inf-git-rhel7 RHEL6-Base RHEL8-Base RHEL8-Ext puppet-fasttrack)
# The following block of parameters needs to reflect your environment.
# Most of the parameters are used with the satellite-installer
# The purpose should be pretty much self explanatory. In doubt, look at 'satellite-installer --help'
export SAT_CNET=172.24.100
export DNS_REV=100.24.172.in-addr.arpa
export SUBNET=${SAT_CNET}.0
export SUBNET_MASK=255.255.255.0
export DNS=${SAT_CNET}.2
export SAT_IP=${SAT_CNET}.3
export ORG="LunetIX"
export LOC="Orion"
export ADMIN=admin
export ADMIN_PASSWORD=$(pwmake 64)
export IPA_SERVER=sol.lunetix.org
export DOMAIN=lunetix.org
export REALM=LUNETIX.ORG
export REALM_PROXY_USER=realm-proxy
export C=DE
export ST=Berlin
export L=Berlin
export OU=IT-Ops
export DHCP_RANGE="${SAT_CNET}.20 ${SAT_CNET}.50"
export DHCP_GW=${SAT_CNET}.1
export DHCP_DNS=${SAT_CNET}.2
export SAT_INTERFACE=eth1
export SUBNET_IPAM_BEGIN=${SAT_CNET}.100
export SUBNET_IPAM_END=${SAT_CNET}.150
export SUBNET_NAME='kvmnet'
# The host prefix is used to distinguish the demo hosts created at the end of this script.
export HOST_PREFIX='kvm-'
# This is the default password used in hostgroup declarations.
export HOST_PASSWORD='Geheim!!'
export PREPARE_CAPSULE=true
export CAPSULE_NAME=pu-cap.lunetix.org
export CAPSULE_LOC="Puck"
longcapsulename=$(echo $CAPSULE_NAME | tr '.' '_')
# This demo is intended to run on a simple libvirt/KVM hypervisor.
# A dedicated server hosted by an internet service provider may be a cost effective choice for this ressource.
export CONFIGURE_LIBVIRT_RESOURCE=true
export COMPUTE_RES_FQDN="orion1318.server4you.de"
export COMPUTE_RES_NAME="KVM"
# This script alternatively allows to use a RHV virtualization backend using the following parameters
export CONFIGURE_RHEV_RESOURCE=false
# export COMPUTE_RES_FQDN="rhv.example.com"
# export COMPUTE_RES_NAME="RHV"
export RHV_VERSION_4=true
export RHV_RES_USER="admin@internal"
export RHV_RES_PASSWD="Geheim!!"
export RHV_RES_UUID="Default"
if [ $CONFIGURE_RHEV_RESOURCE = 'true' -a $CONFIGURE_LIBVIRT_RESOURCE = 'true' ]; then
echo "Only one of CONFIGURE_RHEV_RESOURCE and CONFIGURE_LIBVIRT_RESOURCE may be true."
exit 1
fi
# FIRST_SATELLITE matters only if you want to have more than one Sat work with the same IPA REALM infrastructure.
# If this is the case, you need to make sure to set this to false for all subsequent Satellite instances.
export FIRST_SATELLITE=false
# This is the end of the header section.
# Depending on the STAGE declared above, the script will start at some point and continue all the way to the end -- if everything goes well ;-)
# As mentioned before, there is a halt for manual intervention right after satellite-install and a second halt at the end before creating the demo hosts.
# Be prepared to wait a long time until the content sync has completed.
# BEGIN preqeq prep
if [ $STAGE -le 1 ]; then
subscription-manager register || true
subscription-manager repos --disable "*"
subscription-manager repos --enable=rhel-7-server-rpms \
--enable=rhel-server-rhscl-7-rpms \
--enable=rhel-7-server-optional-rpms \
--enable=rhel-7-server-satellite-6.5-rpms \
--enable=rhel-7-server-satellite-maintenance-6-rpms \
--enable=rhel-7-server-ansible-2.6-rpms
subscription-manager release --unset
yum install -y screen yum-utils vim
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm || true
yum-config-manager --disable epel
yum -y upgrade
echo "${SAT_IP} $(hostname)" >>/etc/hosts
yum install -y ipa-client ipa-admintools
ipa-client-install --server=$IPA_SERVER --domain=$DOMAIN --realm=$REALM --ip-address=${SAT_IP}
kinit admin@${REALM}
ipa service-add HTTP/$(hostname)
if [ $IPA_EXT_CERT = 'true' ]; then
mkdir -p /root/certs
openssl req -nodes -newkey rsa:2048 -keyout /root/certs/key.pem -out /root/certs/${longname}.csr -subj "/C=${C}/ST=${ST}/L=${L}/O=${ORG}/OU=${OU}/CN=$(hostname)"
serial=$(ipa cert-request --add --principal=host/$(hostname) /root/certs/${longname}.csr|grep number:|cut -d' ' -f5)
ipa cert-show --out /root/certs/${longname}.crt $serial
fi
fi
# END preqeq prep
# BEGIN installation
if [ $STAGE -le 2 ]; then
# yum -y install satellite foreman-proxy
yum -y install satellite
firewall-cmd --permanent --add-service='RH-Satellite-6' --add-service='dns' --add-service='dhcp' --add-service='tftp' --add-service='http' --add-service='https'
# goferd
firewall-cmd --permanent --add-port='5674/tcp'
# VNC
firewall-cmd --permanent --add-port='5901-5930/tcp'
# OMAPI
firewall-cmd --permanent --add-port='7911/tcp'
# Capsule
firewall-cmd --permanent --add-port="5000/tcp" --add-port="5646/tcp"
firewall-cmd --reload
mkdir -p /usr/share/foreman/.ssh
ssh-keygen -f /usr/share/foreman/.ssh/id_rsa -t rsa -N ''
ssh-keyscan -t ecdsa $COMPUTE_RES_FQDN >/usr/share/foreman/.ssh/known_hosts
chown -R foreman.foreman /usr/share/foreman/.ssh
mkdir -p /root/.hammer
cat > /root/.hammer/cli_config.yml <<EOF
:foreman:
:host: 'https://$(hostname)/'
:username: '$ADMIN'
:password: '$ADMIN_PASSWORD'
:request_timeout: -1
EOF
if [ $IPA_EXT_CERT = 'true' ]; then
katello-certs-check \
-b /etc/ipa/ca.crt \
-k /root/certs/key.pem \
-c /root/certs/${longname}.crt
CERT_ARGS="--certs-server-ca-cert=/etc/ipa/ca.crt \
--certs-server-key=/root/certs/key.pem \
--certs-server-cert=/root/certs/${longname}.crt \
--certs-server-cert-req=/root/certs/${longname}.csr"
fi
if [ $FIRST_SATELLITE = 'true' ]; then
foreman-prepare-realm admin ${REALM_PROXY_USER}
mv freeipa.keytab /root/freeipa.keytab
elif [ ! -f /root/freeipa.keytab ]; then
read -p "
Manual action required!
To proceed you need to manually copy the freeipa.keytab from your existing Satellite server.
The file is located in /etc/foreman-proxy/freeipa.keytab.
Make sure it is owned by foreman-proxy.foreman-proxy and has permission 0600.
Do not run foreman-prepare-realm again. This will invalidate all pre-existing freeipa.keytab files.
Hit Enter after the freeipa.keytab has been copied." answer
else
echo "Using existing keytab in /root/freeipa.keytab"
fi
cp /root/freeipa.keytab /etc/foreman-proxy
chown foreman-proxy:foreman-proxy /etc/foreman-proxy/freeipa.keytab
cp /etc/ipa/ca.crt /etc/pki/ca-trust/source/anchors/ipa.crt
update-ca-trust enable
update-ca-trust
time satellite-installer --scenario satellite -v \
--foreman-admin-password=$ADMIN_PASSWORD \
--foreman-admin-username=$ADMIN \
--foreman-initial-organization=$ORG \
--foreman-initial-location=$LOC \
--foreman-proxy-dns=true \
--foreman-proxy-dns-interface=$SAT_INTERFACE \
--foreman-proxy-dns-zone=$DOMAIN \
--foreman-proxy-dns-forwarders=$DNS \
--foreman-proxy-dns-reverse=$DNS_REV \
--foreman-proxy-dhcp=true \
--foreman-proxy-dhcp-interface=$SAT_INTERFACE \
--foreman-proxy-dhcp-range="$DHCP_RANGE" \
--foreman-proxy-dhcp-gateway=$DHCP_GW \
--foreman-proxy-dhcp-nameservers=$DHCP_DNS \
--foreman-proxy-tftp=true \
--foreman-proxy-tftp-servername=$(hostname) \
--foreman-proxy-puppetca=true ${CERT_ARGS} \
--foreman-proxy-realm=true \
--foreman-proxy-realm-keytab=/etc/foreman-proxy/freeipa.keytab \
--foreman-proxy-realm-principal="${REALM_PROXY_USER}@${REALM}" \
--foreman-proxy-realm-provider=freeipa \
--foreman-ipa-authentication=true \
--enable-foreman-plugin-openscap
service foreman-proxy restart
hammer capsule refresh-features --id=1
hammer settings set --name default_download_policy --value on_demand
hammer subscription upload --organization "$ORG" --file ${MANIFEST}
# hammer subscription refresh-manifest --organization "$ORG"
yum install -y puppet-foreman_scap_client
yum install -y foreman-discovery-image
foreman-rake foreman_openscap:bulk_upload:default
mkdir -p /etc/puppet/environments/production/modules
hammer realm create --realm-type='Red Hat Identity Management' --name=${REALM} --realm-proxy-id=1 --locations=${LOC} --organizations=${ORG}
if [ $PREPARE_CAPSULE = 'true' ]; then
hammer location create --name=$CAPSULE_LOC --description='Capsule Location'
hammer location add-organization --name=$CAPSULE_LOC --organization=$ORG
export CAPSULE_PASS=$(pwmake 64)
hammer user create --login='capsule' --firstname='Satellite' --lastname='Capsule' --default-location=$CAPSULE_LOC --default-organization=$ORG --locale='de' --organizations=$ORG --locations=$CAPSULE_LOC --timezone='Berlin' --password="$CAPSULE_PASS" --admin=true --mail="capsule@${DOMAIN}" --auth-source-id=1
cat > /root/.hammer/capsule_cli_config.yml <<EOF
:foreman:
:host: 'https://$(hostname)/'
:username: 'capsule'
:password: '$CAPSULE_PASS'
:request_timeout: -1
EOF
fi
fi
# END installation
# BEGIN environment setup
if [ $STAGE -le 3 ]; then
hammer lifecycle-environment create --organization "$ORG" --description 'Development' --name 'Development' --label development --prior Library
hammer lifecycle-environment create --organization "$ORG" --description 'Test' --name 'Test' --label test --prior 'Development'
hammer lifecycle-environment create --organization "$ORG" --description 'Production' --name 'Production' --label production --prior 'Test'
hammer lifecycle-environment create --organization "$ORG" --description 'Latest packages without staging' --name 'UnStaged' --label unstaged --prior Library
hammer domain update --id 1 --organizations "$ORG" --locations "$LOC"
hammer subnet create --name $SUBNET_NAME \
--network $SUBNET \
--mask $SUBNET_MASK \
--gateway $DHCP_GW \
--dns-primary $DHCP_DNS \
--ipam 'Internal DB' \
--from $SUBNET_IPAM_BEGIN \
--to $SUBNET_IPAM_END \
--tftp-id 1 \
--dhcp-id 1 \
--dns-id 1 \
--domain-ids 1 \
--organizations "$ORG" \
--locations "$LOC"
if [ $CONFIGURE_LIBVIRT_RESOURCE = 'true' ]; then
yum -y install libvirt-client
hammer compute-resource create --organizations "$ORG" --name "$COMPUTE_RES_NAME" --locations "$LOC" --provider Libvirt --url qemu+ssh://root@${COMPUTE_RES_FQDN}/system --set-console-password false
fi
if [ $CONFIGURE_RHEV_RESOURCE = 'true' ]; then
hammer compute-resource create --name "${COMPUTE_RES_NAME}" --provider "Ovirt" --description "RHV4 Managment Server" --url "https://${COMPUTE_RES_FQDN}/ovirt-engine/api/v3" --user "${RHV_RES_USER}" --password "${RHV_RES_PASSWD}" --locations "$LOC" --organizations "$ORG" --uuid "${RHV_RES_UUID}"
fi
cat >kickstart-docker <<EOF
<%#
kind: ptable
name: Kickstart Docker
oses:
- CentOS 5
- CentOS 6
- CentOS 7
- Fedora 16
- Fedora 17
- Fedora 18
- Fedora 19
- Fedora 20
- RedHat 5
- RedHat 6
- RedHat 7
%>
zerombr
clearpart --all --initlabel
part /boot --asprimary --size=1024
part swap --size=1024
part pv.01 --asprimary --size=12000 --grow
volgroup dockerhost pv.01
logvol / --vgname=dockerhost --size=9000 --name=rootvol
EOF
hammer partition-table create --file=kickstart-docker --name='Kickstart Docker' --os-family='Redhat' --organizations="$ORG" --locations="$LOC"
hammer os update --title 'RedHat 7.7' --partition-tables='Kickstart default','Kickstart Docker'
fi
# END environment setup
# BEGIN basic content view creation
if [ $STAGE -le 4 ]; then
for index in ${!CV_array[*]}
do
LABEL=$(echo ${CV_array[$index]} | tr '[:upper:]' '[:lower:]')
hammer content-view create --organization "$ORG" --name "${CV_array[$index]}" --label "$LABEL" --description "Installer Provided Content View $LABEL"
done
fi
# END content view setup
BIFS=$IFS
IFS=';'
function init_repo {
index=$1
prio_map=$2
cv_map=$3
repo_name=$4
prod_name=$5
product=$6
arch=$7
releasever=$8
policy=$9
priority=${10}
if [[ $index == \#* ]]; then return 0; fi
include='true'
for bit in 1 2 4 8 16 32 64 128 256 512 1024 2048 4096
do
map_mask=$(( prio_map & bit ))
prio_mask=$(( priority & bit ))
if [ $map_mask -gt 0 -a $prio_mask -eq 0 ]
then
include='false'
fi
done
if [ $include = 'true' ]
then
if [ ${releasever} != '000' ]
then
release_opt="--releasever=${releasever}"
else
release_opt=""
fi
hammer repository-set enable --organization "$ORG" --product "${product}" --basearch="${arch}" ${release_opt} --name "${prod_name}"
hammer repository update --organization "$ORG" --product "${product}" --name "${repo_name}" --download-policy "${policy}"
time hammer repository synchronize --organization "$ORG" --product "${product}" --name "${repo_name}"
for idx in ${!CV_array[*]}
do
bit=$((2**idx))
if [ $(( cv_map & bit )) -gt 0 ]
then
hammer content-view add-repository --organization "$ORG" --name "${CV_array[$idx]}" --product "${product}" --repository "${repo_name}"
fi
done
else
echo Excluded in prio $priority: $prio_map [$index] $repo_name
fi
}
# BEGIN content sync
# Sync of Red Hat RPM packages adds up to ~160GB of disk space in /var and takes ~ 24hours to finish
if [ $STAGE -le 5 ]; then
date
if false; then
hammer product create --name='Puppet Forge' --organization "$ORG"
hammer repository create --organization "$ORG" --name='Modules' --product='Puppet Forge' --content-type='puppet' --publish-via-http=true --url=http://forge.puppetlabs.com/
time hammer repository synchronize --organization "$ORG" --product 'Puppet Forge' --name 'Modules' 2>/dev/null
# 4327P, 426M, 110 min
du -sh /var/lib/pulp/content/units/puppet_module
find /var/lib/pulp/content/units/puppet_module -name \*tar.gz|wc -l
date
df -h
if [ $CUST_CONTENT = 'true' ]; then
wget https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8
hammer gpg create --organization "$ORG" --name 'GPG-EPEL8' --key RPM-GPG-KEY-EPEL-8
hammer product create --name='EPEL' --organization "$ORG"
hammer repository create --organization "$ORG" --name='EPEL 8 - x86_64' --product='EPEL' --gpg-key='GPG-EPEL8' --content-type='yum' --publish-via-http=true --url=http://mirror.de.leaseweb.net/epel/8/Everything/x86_64/ --download-policy immediate
time hammer repository synchronize --organization "$ORG" --product 'EPEL' --name 'EPEL 8 - x86_64' 2>/dev/null
# 12513P, 13.3G, 87 min
wget https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7Server
hammer gpg create --organization "$ORG" --name 'GPG-EPEL7' --key RPM-GPG-KEY-EPEL-7Server
hammer repository create --organization "$ORG" --name='EPEL 7 - x86_64' --product='EPEL' --gpg-key='GPG-EPEL7' --content-type='yum' --publish-via-http=true --url=http://mirror.de.leaseweb.net/epel/7/x86_64/ --download-policy on_demand
time hammer repository synchronize --organization "$ORG" --product 'EPEL' --name 'EPEL 7 - x86_64' 2>/dev/null
# 12513P, 13.3G, 87 min
echo "$CUSTOM_REPO_IP $CUSTOM_REPO_HOST" >>/etc/hosts
hammer product create --name="$ORG" --organization "$ORG"
hammer repository create --organization "$ORG" --name='Puppet Modules' --product="$ORG" --content-type='puppet' --publish-via-http=true --url=http://${CUSTOM_REPO_HOST}/repos/puppet-modules/
time hammer repository synchronize --organization "$ORG" --product="$ORG" --name='Puppet Modules' 2>/dev/null
hammer repository create --organization "$ORG" --name='Packages' --product="$ORG" --content-type='yum' --publish-via-http=true --url=http://${CUSTOM_REPO_HOST}/repos/${ORG}-packages/ --download-policy immediate
time hammer repository synchronize --organization "$ORG" --product="$ORG" --name='Packages' 2>/dev/null
wget http://pkg.jenkins.io/redhat/jenkins.io.key
hammer gpg create --organization "$ORG" --name GPG-JENKINS --key jenkins.io.key
hammer repository create --organization "$ORG" --name='Jenkins' --product="$ORG" --gpg-key='GPG-JENKINS' --content-type='yum' --publish-via-http=true --url=http://${CUSTOM_REPO_HOST}/repos/Jenkins-packages/ --download-policy immediate
time hammer repository synchronize --organization "$ORG" --product="$ORG" --name='Jenkins' 2>/dev/null
hammer product create --name='Maven' --organization "$ORG"
hammer repository create --organization "$ORG" --name='Maven 7Server' --product='Maven' --content-type='yum' --publish-via-http=true --url=https://repos.fedorapeople.org/repos/dchen/apache-maven/epel-7Server/x86_64/ --download-policy immediate
time hammer repository synchronize --organization "$ORG" --product='Maven' --name='Maven 7Server' 2>/dev/null
wget http://packages.icinga.org/icinga.key
hammer gpg create --organization "$ORG" --name GPG-ICINGA --key icinga.key
hammer product create --name='Icinga' --organization "$ORG"
hammer repository create --organization "$ORG" --name='Icinga 7Server' --product='Icinga' --content-type='yum' --gpg-key='GPG-ICINGA' --publish-via-http=true --url=http://packages.icinga.org/epel/7Server/release --download-policy immediate
time hammer repository synchronize --organization "$ORG" --product='Icinga' --name='Icinga 7Server' 2>/dev/null
date
df -h
fi
while read -r line
do
IFS=';' init_repo $line $CONTENT_MASK
done <<EOF
1;68;0;JBoss Enterprise Application Platform 6 RHEL 7 Server RPMs x86_64 7Server;JBoss Enterprise Application Platform 6 (RHEL 7 Server) (RPMs);JBoss Enterprise Application Platform;x86_64;7Server;on_demand
2;68;64;JBoss Enterprise Application Platform 7 RHEL 7 Server RPMs x86_64 7Server;JBoss Enterprise Application Platform 7 (RHEL 7 Server) (RPMs);JBoss Enterprise Application Platform;x86_64;7Server;on_demand
3;36;0;Red Hat Ceph Storage Installer 1.3 for Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server;Red Hat Ceph Storage Installer 1.3 for Red Hat Enterprise Linux 7 Server (RPMs);Red Hat Ceph Storage;x86_64;7Server;on_demand
4;36;0;Red Hat Ceph Storage Tools 1.3 for Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server;Red Hat Ceph Storage Tools 1.3 for Red Hat Enterprise Linux 7 Server (RPMs);Red Hat Enterprise Linux Server;x86_64;7Server;on_demand
5;136;0;Red Hat Enterprise Linux 6 Server - Extras RPMs x86_64;Red Hat Enterprise Linux 6 Server - Extras (RPMs);Red Hat Enterprise Linux Server;x86_64;000;immediate
6;9;512;Red Hat Enterprise Linux 6 Server Kickstart x86_64 6.9;Red Hat Enterprise Linux 6 Server (Kickstart);Red Hat Enterprise Linux Server;x86_64;6.9;immediate
7;40;0;Red Hat Enterprise Linux 6 Server - Optional RPMs x86_64 6Server;Red Hat Enterprise Linux 6 Server - Optional (RPMs);Red Hat Enterprise Linux Server;x86_64;6Server;immediate
8;136;0;Red Hat Enterprise Linux 6 Server - RH Common RPMs x86_64 6Server;Red Hat Enterprise Linux 6 Server - RH Common (RPMs);Red Hat Enterprise Linux Server;x86_64;6Server;on_demand
9;9;512;Red Hat Enterprise Linux 6 Server RPMs x86_64 6Server;Red Hat Enterprise Linux 6 Server (RPMs);Red Hat Enterprise Linux Server;x86_64;6Server;immediate
10;40;0;Red Hat Enterprise Linux 6 Server - Supplementary RPMs x86_64 6Server;Red Hat Enterprise Linux 6 Server - Supplementary (RPMs);Red Hat Enterprise Linux Server;x86_64;6Server;on_demand
11;132;0;Red Hat Enterprise Linux 7 Server - Extras RPMs x86_64;Red Hat Enterprise Linux 7 Server - Extras (RPMs);Red Hat Enterprise Linux Server;x86_64;000;on_demand
12;5;511;Red Hat Enterprise Linux 7 Server Kickstart x86_64 7.7;Red Hat Enterprise Linux 7 Server (Kickstart);Red Hat Enterprise Linux Server;x86_64;7.7;immediate
13;292;178;Red Hat Enterprise Linux 7 Server - Optional RPMs x86_64 7Server;Red Hat Enterprise Linux 7 Server - Optional (RPMs);Red Hat Enterprise Linux Server;x86_64;7Server;on_demand
14;36;16;Red Hat Enterprise Linux 7 Server - RH Common RPMs x86_64 7Server;Red Hat Enterprise Linux 7 Server - RH Common (RPMs);Red Hat Enterprise Linux Server;x86_64;7Server;on_demand
15;5;511;Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server;Red Hat Enterprise Linux 7 Server (RPMs);Red Hat Enterprise Linux Server;x86_64;7Server;immediate
16;36;16;Red Hat Enterprise Linux 7 Server - Supplementary RPMs x86_64 7Server;Red Hat Enterprise Linux 7 Server - Supplementary (RPMs);Red Hat Enterprise Linux Server;x86_64;7Server;on_demand
17;260;32;Red Hat Enterprise Linux Atomic Host RPMs x86_64;Red Hat Enterprise Linux Atomic Host (RPMs);Red Hat Enterprise Linux Atomic Host;x86_64;000;on_demand
18;260;32;Red Hat OpenShift Container Platform 3.9 RPMs x86_64;Red Hat OpenShift Container Platform 3.9 (RPMs);Red Hat OpenShift Container Platform;x86_64;000;on_demand
19;516;0;Red Hat OpenStack Platform 8 director for RHEL 7 RPMs x86_64 7Server;Red Hat OpenStack Platform 8 director for RHEL 7 (RPMs);Red Hat OpenStack;x86_64;7Server;on_demand
20;516;0;Red Hat OpenStack Platform 8 for RHEL 7 RPMs x86_64 7Server;Red Hat OpenStack Platform 8 for RHEL 7 (RPMs);Red Hat OpenStack;x86_64;7Server;on_demand
21;516;0;Red Hat OpenStack Platform 8 Operational Tools for RHEL 7 RPMs x86_64 7Server;Red Hat OpenStack Platform 8 Operational Tools for RHEL 7 (RPMs);Red Hat OpenStack;x86_64;7Server;on_demand
22;516;0;Red Hat OpenStack Tools 7.0 for Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server;Red Hat OpenStack Tools 7.0 for Red Hat Enterprise Linux 7 Server (RPMs);Red Hat Enterprise Linux Server;x86_64;7Server;on_demand
23;5;2;Red Hat Satellite 6.5 for RHEL 7 Server RPMs x86_64;Red Hat Satellite 6.5 (for RHEL 7 Server) (RPMs);Red Hat Satellite;x86_64;000;immediate
24;5;2;Red Hat Satellite Capsule 6.5 for RHEL 7 Server RPMs x86_64;Red Hat Satellite Capsule 6.5 (for RHEL 7 Server) (RPMs);Red Hat Satellite Capsule;x86_64;000;immediate
25;5;2;Red Hat Satellite Maintenance 6 for RHEL 7 Server RPMs x86_64;Red Hat Satellite Maintenance 6 (for RHEL 7 Server) (RPMs);Red Hat Enterprise Linux Server;x86_64;000;immediate
26;9;512;Red Hat Satellite Tools 6.5 for RHEL 6 Server RPMs x86_64;Red Hat Satellite Tools 6.5 (for RHEL 6 Server) (RPMs);Red Hat Enterprise Linux Server;x86_64;000;immediate
27;5;511;Red Hat Satellite Tools 6.5 for RHEL 7 Server RPMs x86_64;Red Hat Satellite Tools 6.5 (for RHEL 7 Server) (RPMs);Red Hat Enterprise Linux Server;x86_64;000;immediate
28;9;512;Red Hat Ansible Engine 2.6 RPMs for Red Hat Enterprise Linux 7 Server x86_64;Red Hat Ansible Engine 2.6 RPMs for Red Hat Enterprise Linux 7 Server;Red Hat Ansible Engine;x86_64;000;immediate
29;5;511;Red Hat Satellite Tools 6.3 - Puppet 4 for RHEL 7 Server RPMs x86_64;Red Hat Satellite Tools 6.3 - Puppet 4 (for RHEL 7 Server) (RPMs);Red Hat Enterprise Linux Server;x86_64;000;immediate
30;9;0;Red Hat Software Collections RPMs for Red Hat Enterprise Linux 6 Server x86_64 6Server;Red Hat Software Collections RPMs for Red Hat Enterprise Linux 6 Server;Red Hat Software Collections for RHEL Server;x86_64;6Server;on_demand
31;5;438;Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_64 7Server;Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server;Red Hat Software Collections for RHEL Server;x86_64;7Server;on_demand
32;132;0;Red Hat Storage Native Client for RHEL 7 RPMs x86_64 7Server;Red Hat Storage Native Client for RHEL 7 (RPMs);Red Hat Enterprise Linux Server;x86_64;7Server;on_demand
33;132;0;Red Hat Virtualization 4 Management Agents for RHEL 7 RPMs x86_64 7Server;Red Hat Virtualization 4 Management Agents for RHEL 7 (RPMs);Red Hat Virtualization;x86_64;7Server;on_demand
34;1028;0;Red Hat Virtualization Host 7 RPMs x86_64;Red Hat Virtualization Host 7 (RPMs);Red Hat Virtualization Host;x86_64;000;on_demand
35;1028;0;Red Hat Virtualization Manager 4.0 RHEL 7 Server RPMs x86_64;Red Hat Virtualization Manager 4.0 (RHEL 7 Server) (RPMs);Red Hat Virtualization;x86_64;000;on_demand
36;3;3072;Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs x86_64 8;Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs);Red Hat Enterprise Linux for x86_64;x86_64;8;immediate
37;3;3072;Red Hat Enterprise Linux 8 for x86_64 - BaseOS Kickstart x86_64 8;Red Hat Enterprise Linux 8 for x86_64 - BaseOS (Kickstart);Red Hat Enterprise Linux for x86_64;x86_64;8;immediate
38;3;3072;Red Hat Enterprise Linux 8 for x86_64 - AppStream RPMs x86_64 8;Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs);Red Hat Enterprise Linux for x86_64;x86_64;8;immediate
39;3;3072;Red Hat Enterprise Linux 8 for x86_64 - AppStream Kickstart x86_64 8;Red Hat Enterprise Linux 8 for x86_64 - AppStream (Kickstart);Red Hat Enterprise Linux for x86_64;x86_64;8;immediate
40;3;3072;Red Hat Satellite Tools 6.5 for RHEL 8 x86_64 RPMs x86_64;Red Hat Satellite Tools 6.5 for RHEL 8 x86_64 (RPMs);Red Hat Enterprise Linux for x86_64;x86_64;000;immediate
41;34;2048;Red Hat Enterprise Linux 8 for x86_64 - Supplementary RPMs x86_64 8;Red Hat Enterprise Linux 8 for x86_64 - Supplementary (RPMs);Red Hat Enterprise Linux for x86_64;x86_64;8;immediate
EOF
fi
IFS=$BIFS
hammer sync-plan create --name "nightly sync" --enabled=true --interval daily --organization $ORG --sync-date "2018-05-01 01:00:00"
for i in $(hammer --csv product list --organization $ORG --per-page 999 | grep -vi '^ID' | grep -vi not_synced | awk -F, {'{ if ($5!=0) print $1}'})
do
hammer product set-sync-plan --sync-plan "nightly sync" --organization $ORG --id $i
done
export CVMANAGER_PASS=$(pwmake 64)
hammer user create --login='cvmanager' --firstname='ContentView' --lastname='Manager' --default-location=$LOC --default-organization=$ORG --locale='de' --organizations=$ORG --locations=$LOC --timezone='Berlin' --password="$CVMANAGER_PASS" --roles='Manager' --mail="cvmanager@${DOMAIN}" --auth-source-id=1
yum -y install ruby-devel gcc gcc-c++
git clone https://github.com/RedHatSatellite/katello-cvmanager.git
gem install apipie-bindings || true
cat > /root/katello-cvmanager/UnStaged.yaml <<EOF
---
:settings:
:user: cvmanager
:pass: $CVMANAGER_PASS
:uri: https://$(hostname)
:timeout: 300
:org: 1
:lifecycle: 5
:keep: 3
:promote_cvs: true
:checkrepos: true
:cv:
RHEL7-Base: latest
inf-builder-rhel7: latest
inf-docker-rhel7: latest
inf-git-rhel7: latest
inf-hypervisor-rhel7: latest
inf-ipa-rhel7: latest
inf-oscp-rhel7: latest
:promote:
- RHEL7-Base
- inf-builder-rhel7
- inf-docker-rhel7
- inf-git-rhel7
- inf-hypervisor-rhel7
- inf-ipa-rhel7
- inf-oscp-rhel7
:publish:
- RHEL7-Base
- inf-builder-rhel7
- inf-docker-rhel7
- inf-git-rhel7
- inf-hypervisor-rhel7
- inf-ipa-rhel7
- inf-oscp-rhel7
EOF
cat > /root/katello-cvmanager/daily_updates.sh <<EOF
#! /bin/bash
set -e
./cvmanager --config=UnStaged.yaml --wait publish
./cvmanager --config=UnStaged.yaml --wait update
./cvmanager --config=UnStaged.yaml --wait promote
./cvmanager --config=UnStaged.yaml --wait clean
EOF
chmod +x /root/katello-cvmanager/daily_updates.sh
crontab -l | { cat; echo "30 04 * * * cd /root/katello-cvmanager/ && /root/katello-cvmanager/daily_updates.sh | mail -E -s 'Satellite daily report: Content view updates' cvmanager@${DOMAIN}"; } | crontab -
fi
# END content sync
# BEGIN content view customizing and promotion
if [ $STAGE -le 6 ]; then
date
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL8-Base --author puppetlabs --name stdlib
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL8-Base --author puppetlabs --name concat
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL8-Base --author drzewiec --name chrony
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL8-Base --author saz --name ssh
time hammer content-view publish --organization "$ORG" --name RHEL8-Base --description 'Initial Publishing' 2>/dev/null
time hammer content-view version promote --organization "$ORG" --content-view RHEL8-Base --to-lifecycle-environment UnStaged 2>/dev/null
hammer content-view add-repository --organization "$ORG" --name 'RHEL8-Ext' --product 'EPEL' --repository 'EPEL 8 - x86_64'
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL8-Ext --author puppetlabs --name stdlib
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL8-Ext --author puppetlabs --name concat
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL8-Ext --author drzewiec --name chrony
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL8-Ext --author saz --name ssh
time hammer content-view publish --organization "$ORG" --name RHEL8-Ext --description 'Initial Publishing' 2>/dev/null
time hammer content-view version promote --organization "$ORG" --content-view RHEL8-Ext --to-lifecycle-environment UnStaged 2>/dev/null
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL7-Base --author puppetlabs --name stdlib
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL7-Base --author puppetlabs --name concat
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL7-Base --author puppetlabs --name ntp
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL7-Base --author saz --name ssh
time hammer content-view publish --organization "$ORG" --name RHEL7-Base --description 'Initial Publishing' 2>/dev/null
time hammer content-view version promote --organization "$ORG" --content-view RHEL7-Base --to-lifecycle-environment UnStaged 2>/dev/null
if [ $PREPARE_CAPSULE = 'true' ]; then
hammer content-view puppet-module add --organization "$ORG" --content-view inf-capsule --author puppetlabs --name stdlib
hammer content-view puppet-module add --organization "$ORG" --content-view inf-capsule --author puppetlabs --name concat
hammer content-view puppet-module add --organization "$ORG" --content-view inf-capsule --author puppetlabs --name ntp
hammer content-view puppet-module add --organization "$ORG" --content-view inf-capsule --author saz --name ssh
time hammer content-view publish --organization "$ORG" --name inf-capsule --description 'Initial Publishing' 2>/dev/null
time hammer content-view version promote --organization "$ORG" --content-view inf-capsule --to-lifecycle-environment UnStaged 2>/dev/null
fi
hammer content-view add-repository --organization "$ORG" --name 'inf-ipa-rhel7' --product 'EPEL' --repository 'EPEL 7 - x86_64'
hammer content-view puppet-module add --organization "$ORG" --content-view inf-ipa-rhel7 --author puppetlabs --name stdlib
hammer content-view puppet-module add --organization "$ORG" --content-view inf-ipa-rhel7 --author puppetlabs --name concat
hammer content-view puppet-module add --organization "$ORG" --content-view inf-ipa-rhel7 --author puppetlabs --name ntp
hammer content-view puppet-module add --organization "$ORG" --content-view inf-ipa-rhel7 --author saz --name ssh
hammer content-view puppet-module add --organization "$ORG" --content-view inf-ipa-rhel7 --author example42 --name puppi
hammer content-view puppet-module add --organization "$ORG" --content-view inf-ipa-rhel7 --author example42 --name monitor
hammer content-view puppet-module add --organization "$ORG" --content-view inf-ipa-rhel7 --author netmanagers --name fail2ban
time hammer content-view publish --organization "$ORG" --name inf-ipa-rhel7 --description 'Initial Publishing' 2>/dev/null
time hammer content-view version promote --organization "$ORG" --content-view inf-ipa-rhel7 --to-lifecycle-environment UnStaged 2>/dev/null
hammer content-view puppet-module add --organization "$ORG" --content-view inf-hypervisor-rhel7 --author puppetlabs --name stdlib
hammer content-view puppet-module add --organization "$ORG" --content-view inf-hypervisor-rhel7 --author puppetlabs --name concat
hammer content-view puppet-module add --organization "$ORG" --content-view inf-hypervisor-rhel7 --author puppetlabs --name ntp
time hammer content-view publish --organization "$ORG" --name inf-hypervisor-rhel7 --description 'Initial Publishing' 2>/dev/null
time hammer content-view version promote --organization "$ORG" --content-view inf-hypervisor-rhel7 --to-lifecycle-environment UnStaged 2>/dev/null
hammer content-view add-repository --organization "$ORG" --name 'inf-builder-rhel7' --product 'Maven' --repository 'Maven 7Server'
hammer content-view add-repository --organization "$ORG" --name 'inf-builder-rhel7' --product 'EPEL' --repository 'EPEL 7 - x86_64'
hammer content-view add-repository --organization "$ORG" --name 'inf-builder-rhel7' --product "$ORG" --repository "Packages"
hammer content-view add-repository --organization "$ORG" --name 'inf-builder-rhel7' --product "$ORG" --repository "Jenkins"
hammer content-view puppet-module add --organization "$ORG" --content-view inf-builder-rhel7 --author puppetlabs --name stdlib
hammer content-view puppet-module add --organization "$ORG" --content-view inf-builder-rhel7 --author puppetlabs --name concat
hammer content-view puppet-module add --organization "$ORG" --content-view inf-builder-rhel7 --author puppetlabs --name ntp
hammer content-view puppet-module add --organization "$ORG" --content-view inf-builder-rhel7 --author saz --name ssh
hammer content-view puppet-module add --organization "$ORG" --content-view inf-builder-rhel7 --author puppetlabs --name postgresql
hammer content-view puppet-module add --organization "$ORG" --content-view inf-builder-rhel7 --author puppetlabs --name java
hammer content-view puppet-module add --organization "$ORG" --content-view inf-builder-rhel7 --author puppet --name jenkins
hammer content-view puppet-module add --organization "$ORG" --content-view inf-builder-rhel7 --author LunetIX --name git
hammer content-view puppet-module add --organization "$ORG" --content-view inf-builder-rhel7 --author LunetIX --name buildhost
hammer content-view puppet-module add --organization "$ORG" --content-view inf-builder-rhel7 --author puppet --name archive
time hammer content-view publish --organization "$ORG" --name inf-builder-rhel7 --description 'Initial Publishing'
time hammer content-view version promote --organization "$ORG" --content-view inf-builder-rhel7 --to-lifecycle-environment UnStaged
hammer content-view puppet-module add --organization "$ORG" --content-view inf-oscp-rhel7 --author puppetlabs --name stdlib
hammer content-view puppet-module add --organization "$ORG" --content-view inf-oscp-rhel7 --author puppetlabs --name concat
hammer content-view puppet-module add --organization "$ORG" --content-view inf-oscp-rhel7 --author puppetlabs --name ntp
hammer content-view puppet-module add --organization "$ORG" --content-view inf-oscp-rhel7 --author saz --name ssh
hammer content-view puppet-module add --organization "$ORG" --content-view inf-oscp-rhel7 --author cristifalcas --name kubernetes
hammer content-view puppet-module add --organization "$ORG" --content-view inf-oscp-rhel7 --author cristifalcas --name etcd
hammer content-view puppet-module add --organization "$ORG" --content-view inf-oscp-rhel7 --author LunetIX --name docker
hammer content-view puppet-module add --organization "$ORG" --content-view inf-oscp-rhel7 --author crayfishx --name firewalld
# hammer content-view puppet-module add --organization "$ORG" --content-view inf-oscp-rhel7 --author LunetIX --name oscp
time hammer content-view publish --organization "$ORG" --name inf-oscp-rhel7 --description 'Initial Publishing'
time hammer content-view version promote --organization "$ORG" --content-view inf-oscp-rhel7 --to-lifecycle-environment UnStaged
hammer content-view puppet-module add --organization "$ORG" --content-view inf-docker-rhel7 --author puppetlabs --name stdlib
hammer content-view puppet-module add --organization "$ORG" --content-view inf-docker-rhel7 --author puppetlabs --name concat
hammer content-view puppet-module add --organization "$ORG" --content-view inf-docker-rhel7 --author puppetlabs --name ntp
hammer content-view puppet-module add --organization "$ORG" --content-view inf-docker-rhel7 --author saz --name ssh
hammer content-view puppet-module add --organization "$ORG" --content-view inf-docker-rhel7 --author cristifalcas --name kubernetes
hammer content-view puppet-module add --organization "$ORG" --content-view inf-docker-rhel7 --author cristifalcas --name etcd
hammer content-view puppet-module add --organization "$ORG" --content-view inf-docker-rhel7 --author cristifalcas --name docker
hammer content-view puppet-module add --organization "$ORG" --content-view inf-docker-rhel7 --author crayfishx --name firewalld
hammer content-view puppet-module add --organization "$ORG" --content-view inf-docker-rhel7 --author LunetIX --name dockerhost
time hammer content-view publish --organization "$ORG" --name inf-docker-rhel7 --description 'Initial Publishing'
time hammer content-view version promote --organization "$ORG" --content-view inf-docker-rhel7 --to-lifecycle-environment UnStaged
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author puppetlabs --name stdlib
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author puppetlabs --name concat
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author puppetlabs --name ntp
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author saz --name ssh
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author puppetlabs --name postgresql
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author puppetlabs --name java
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author puppet --name jenkins
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author LunetIX --name git
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author LunetIX --name buildhost
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author puppet --name archive
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author cristifalcas --name kubernetes
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author cristifalcas --name etcd
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author LunetIX --name docker
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author LunetIX --name oscp
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author crayfishx --name firewalld
hammer content-view puppet-module add --organization "$ORG" --content-view puppet-fasttrack --author LunetIX --name dockerhost
time hammer content-view publish --organization "$ORG" --name puppet-fasttrack --description 'Initial Publishing'
time hammer content-view version promote --organization "$ORG" --content-view puppet-fasttrack --to-lifecycle-environment UnStaged
hammer content-view add-repository --organization "$ORG" --name 'inf-git-rhel7' --product 'EPEL' --repository 'EPEL 7 - x86_64'
hammer content-view puppet-module add --organization "$ORG" --content-view inf-git-rhel7 --author puppetlabs --name stdlib
hammer content-view puppet-module add --organization "$ORG" --content-view inf-git-rhel7 --author puppetlabs --name concat
hammer content-view puppet-module add --organization "$ORG" --content-view inf-git-rhel7 --author puppetlabs --name ntp
hammer content-view puppet-module add --organization "$ORG" --content-view inf-git-rhel7 --author saz --name ssh
hammer content-view puppet-module add --organization "$ORG" --content-view inf-git-rhel7 --author LunetIX --name git
hammer content-view puppet-module add --organization "$ORG" --content-view inf-git-rhel7 --author example42 --name puppi
hammer content-view puppet-module add --organization "$ORG" --content-view inf-git-rhel7 --author example42 --name monitor
hammer content-view puppet-module add --organization "$ORG" --content-view inf-git-rhel7 --author netmanagers --name fail2ban
time hammer content-view publish --organization "$ORG" --name inf-git-rhel7 --description 'Initial Publishing'
time hammer content-view version promote --organization "$ORG" --content-view inf-git-rhel7 --to-lifecycle-environment UnStaged
if [ $RHEL6_CONTENT = 'true' ]; then
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL6-Base --author puppetlabs --name stdlib
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL6-Base --author puppetlabs --name concat
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL6-Base --author puppetlabs --name ntp
hammer content-view puppet-module add --organization "$ORG" --content-view RHEL6-Base --author saz --name ssh
time hammer content-view publish --organization "$ORG" --name RHEL6-Base --description 'Initial Publishing' 2>/dev/null
time hammer content-view version promote --organization "$ORG" --content-view RHEL6-Base --to-lifecycle-environment UnStaged 2>/dev/null
fi
fi
# END content view setup
# BEGIN activation key and hostgroup setup
if [ $STAGE -le 7 ]; then
PuppetForge_Sub_ID=$(hammer --output='csv' subscription list --organization=$ORG --search='Puppet Forge' | tail -n+2 | head -n1 | cut -d',' -f1)
EPEL_Sub_ID=$(hammer --output='csv' subscription list --organization=$ORG --search='EPEL' | tail -n+2 | head -n1 | cut -d',' -f1)
ORG_Sub_ID=$(hammer --output='csv' subscription list --organization=$ORG --search="$ORG" | tail -n+2 | head -n1 | cut -d',' -f1)
Maven_Sub_ID=$(hammer --output='csv' subscription list --organization=$ORG --search='Maven' | tail -n+2 | head -n1 | cut -d',' -f1)
JBoss_Sub_ID=$(hammer --output='csv' subscription list --organization=$ORG --search='Red Hat JBoss Enterprise Application Platform, 16-Core Premium' | tail -n+2 | head -n1 | cut -d',' -f1)
RHEV_Sub_ID=$(hammer --output='csv' subscription list --organization=$ORG --search='Red Hat Virtualization (2-sockets), Standard' | tail -n+2 | head -n1 | cut -d',' -f1)
OSCP_Sub_ID=$(hammer --output='csv' subscription list --organization=$ORG --search='OpenShift Container Platform, Premium 2-Core' | tail -n+2 | head -n1 | cut -d',' -f1)
RHEL_Sub_ID=$(hammer --output='csv' subscription list --organization=$ORG --search='Red Hat Enterprise Linux Server with Smart Management, Standard (Physical or Virtual Nodes)' | grep -v 'ATOM\|Resilient\|Hyperscale' | tail -n+2 | head -n1 | cut -d',' -f1)
hammer medium create --path=http://$(hostname)/pulp/repos/${ORG}/Library/content/dist/rhel8/8/x86_64/baseos/kickstart/ --organizations="$ORG" --locations="$LOC" --os-family=Redhat --name="RHEL 8.0 Kickstart" --operatingsystems="RedHat 8.0"
hammer medium create --path=http://$(hostname)/pulp/repos/${ORG}/Library/content/dist/rhel8/8/x86_64/appstream/kickstart/ --organizations="$ORG" --locations="$LOC" --os-family=Redhat --name="RHEL 8.0 Appstream Kickstart" --operatingsystems="RedHat 8.0"
hammer medium create --path=http://$(hostname)/pulp/repos/${ORG}/Library/content/dist/rhel/server/7/7.7/x86_64/kickstart/ --organizations="$ORG" --locations="$LOC" --os-family=Redhat --name="RHEL 7.7 Kickstart" --operatingsystems="RedHat 7.7"
uuid=$(uuidgen)
hammer activation-key create --organization="$ORG" --name="el7base-${uuid}" --unlimited-hosts --lifecycle-environment='UnStaged' --content-view='RHEL7-Base'
hammer activation-key add-subscription --organization="$ORG" --name="el7base-${uuid}" --subscription-id="$PuppetForge_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name="el7base-${uuid}" --subscription-id="$RHEL_Sub_ID"
hammer activation-key content-override --organization="$ORG" --name="el7base-${uuid}" --content-label='rhel-7-server-satellite-tools-6.5-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name="el7base-${uuid}" --content-label='rhel-7-server-satellite-tools-6.5-puppet4-rpms' --value=1
hammer activation-key update --organization="$ORG" --name="el7base-${uuid}" --release-version='7Server' --service-level='Standard' --auto-attach=0
environment=$(hammer --output=csv environment list --search='unstaged_rhel7_base' | tail -n+2 | head -n1 | cut -d',' -f2)
hammer hostgroup create --query-organization="$ORG" --organizations="$ORG" --locations="$LOC" \
--architecture='x86_64' --content-source-id=1 --puppet-ca-proxy-id=1 --puppet-proxy-id=1 \
--domain="$DOMAIN" --realm="$REALM" --subnet="$SUBNET_NAME" \
--medium='RHEL 7.7 Kickstart' --pxe-loader='PXELinux BIOS' \
--lifecycle-environment='UnStaged' --operatingsystem='RedHat 7.7' --partition-table='Kickstart default' \
--root-pass="$HOST_PASSWORD" --puppet-classes='ssh::server,ntp' --content-view='RHEL7-Base' \
--environment="${environment}" --name='RHEL7-Base'
hammer hostgroup set-parameter --hostgroup='RHEL7-Base' --name='kt_activation_keys' --value="el7base-${uuid}"
hammer hostgroup set-parameter --hostgroup='RHEL7-Base' --name='enable-puppet4' --value='true'
uuid=$(uuidgen)
hammer activation-key create --organization="$ORG" --name="el8base-${uuid}" --unlimited-hosts --lifecycle-environment='UnStaged' --content-view='RHEL8-Base'
hammer activation-key add-subscription --organization="$ORG" --name="el8base-${uuid}" --subscription-id="$PuppetForge_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name="el8base-${uuid}" --subscription-id="$RHEL_Sub_ID"
hammer activation-key content-override --organization="$ORG" --name="el8base-${uuid}" --content-label='satellite-tools-6.5-for-rhel-8-x86_64-rpms' --value=1
hammer activation-key update --organization="$ORG" --name="el8base-${uuid}" --release-version='8' --service-level='Standard' --auto-attach=0
environment=$(hammer --output=csv environment list --search='unstaged_rhel8_base' | tail -n+2 | head -n1 | cut -d',' -f2)
hammer hostgroup create --query-organization="$ORG" --organizations="$ORG" --locations="$LOC" \
--architecture='x86_64' --content-source-id=1 --puppet-ca-proxy-id=1 --puppet-proxy-id=1 \
--domain="$DOMAIN" --realm="$REALM" --subnet="$SUBNET_NAME" \
--medium='RHEL 8.0 Kickstart' --pxe-loader='PXELinux BIOS' \
--lifecycle-environment='UnStaged' --operatingsystem='RedHat 8.0' --partition-table='Kickstart default' \
--root-pass="$HOST_PASSWORD" --puppet-classes='ssh::server,ntp' --content-view='RHEL8-Base' \
--environment="${environment}" --name='RHEL8-Base'
hammer hostgroup set-parameter --hostgroup='RHEL8-Base' --name='kt_activation_keys' --value="el8base-${uuid}"
hammer hostgroup set-parameter --hostgroup='RHEL8-Base' --name='enable-puppet4' --value='true'
if [ $PREPARE_CAPSULE = 'true' ]; then
CAPSULE_Sub_ID=$(hammer --output='csv' subscription list --organization=$ORG --search='Red Hat Satellite Capsule Server' | tail -n+2 | head -n1 | cut -d',' -f1)
uuid=$(uuidgen)
hammer activation-key create --organization="$ORG" --name="cap63-${uuid}" --max-hosts=2 --lifecycle-environment='UnStaged' --content-view='inf-capsule'
hammer activation-key add-subscription --organization="$ORG" --name="cap63-${uuid}" --subscription-id="$PuppetForge_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name="cap63-${uuid}" --subscription-id="$RHEL_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name="cap63-${uuid}" --subscription-id="$CAPSULE_Sub_ID"
hammer activation-key content-override --organization="$ORG" --name="cap63-${uuid}" --content-label='rhel-7-server-satellite-tools-6.5-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name="cap63-${uuid}" --content-label='rhel-7-server-satellite-tools-6.5-puppet4-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name="cap63-${uuid}" --content-label='rhel-7-server-satellite-capsule-6.5-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name="cap63-${uuid}" --content-label='rhel-server-rhscl-7-rpms' --value=1
hammer activation-key update --organization="$ORG" --name="cap63-${uuid}" --release-version='7Server' --service-level='Standard' --auto-attach=0
environment=$(hammer --output=csv environment list --search='unstaged_inf_capsule' --puppet-class='stdlib' | tail -n+2 | head -n1 | cut -d',' -f2)
hammer hostgroup create --query-organization="$ORG" --organizations="$ORG" --locations="$LOC" \
--architecture='x86_64' --content-source-id=1 --puppet-ca-proxy-id=1 --puppet-proxy-id=1 \
--domain="$DOMAIN" --realm="$REALM" --subnet="$SUBNET_NAME" \
--medium='RHEL 7.7 Kickstart' --pxe-loader='PXELinux BIOS' \
--lifecycle-environment='UnStaged' --operatingsystem='RedHat 7.7' --partition-table='Kickstart default' \
--root-pass="$HOST_PASSWORD" --puppet-classes='ssh::server,ntp' --content-view='inf-capsule' \
--environment="${environment}" --name='inf-capsule'
hammer hostgroup set-parameter --hostgroup='inf-capsule' --name='kt_activation_keys' --value="cap63-${uuid}"
hammer hostgroup set-parameter --hostgroup='inf-capsule' --name='enable-puppet4' --value='true'
fi
hammer activation-key create --organization="$ORG" --name='inf-builder-rhel7' --max-hosts=5 --lifecycle-environment='UnStaged' --content-view='inf-builder-rhel7'
hammer activation-key add-subscription --organization="$ORG" --name='inf-builder-rhel7' --subscription-id="$PuppetForge_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-builder-rhel7' --subscription-id="$RHEL_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-builder-rhel7' --subscription-id="$ORG_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-builder-rhel7' --subscription-id="$EPEL_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-builder-rhel7' --subscription-id="$Maven_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-builder-rhel7' --subscription-id="$JBoss_Sub_ID"
hammer activation-key content-override --organization="$ORG" --name='inf-builder-rhel7' --content-label='rhel-7-server-satellite-tools-6.5-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-builder-rhel7' --content-label='rhel-7-server-satellite-tools-6.5-puppet4-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-builder-rhel7' --content-label='rhel-server-rhscl-7-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-builder-rhel7' --content-label='rhel-7-server-optional-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-builder-rhel7' --content-label='rhel-7-server-supplementary-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-builder-rhel7' --content-label='rhel-7-server-rh-common-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-builder-rhel7' --content-label='jb-eap-7-for-rhel-7-server-rpms' --value=1
hammer activation-key update --organization="$ORG" --name='inf-builder-rhel7' --release-version='7Server' --service-level='Standard' --auto-attach=0
environment=$(hammer --output=csv environment list --search='unstaged_inf_builder_rhel7' --puppet-class='stdlib' | tail -n+2 | head -n1 | cut -d',' -f2)
hammer hostgroup create --query-organization="$ORG" --organizations="$ORG" --locations="$LOC" \
--architecture='x86_64' --content-source-id=1 --puppet-ca-proxy-id=1 --puppet-proxy-id=1 \
--domain="$DOMAIN" --realm="$REALM" --subnet="$SUBNET_NAME" \
--medium='RHEL 7.7 Kickstart' --pxe-loader='PXELinux BIOS' \
--lifecycle-environment='UnStaged' --operatingsystem='RedHat 7.7' --partition-table='Kickstart default' \
--root-pass="$HOST_PASSWORD" --puppet-classes='ssh::server,ntp,buildhost' --content-view='inf-builder-rhel7' \
--environment="$environment" --name='inf-builder-rhel7'
hammer hostgroup set-parameter --hostgroup='inf-builder-rhel7' --name='kt_activation_keys' --value='inf-builder-rhel7'
hammer hostgroup set-parameter --hostgroup='inf-builder-rhel7' --name='enable-puppet4' --value='true'
hammer activation-key create --organization="$ORG" --name='inf-hypervisor-rhel7' --max-hosts=5 --lifecycle-environment='UnStaged' --content-view='inf-hypervisor-rhel7'
hammer activation-key add-subscription --organization="$ORG" --name='inf-hypervisor-rhel7' --subscription-id="$PuppetForge_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-hypervisor-rhel7' --subscription-id="$RHEV_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-hypervisor-rhel7' --subscription-id="$RHEL_Sub_ID"
hammer activation-key content-override --organization="$ORG" --name='inf-hypervisor-rhel7' --content-label='rhel-7-server-satellite-tools-6.5-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-hypervisor-rhel7' --content-label='rhel-7-server-satellite-tools-6.5-puppet4-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-hypervisor-rhel7' --content-label='rhel-server-rhscl-7-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-hypervisor-rhel7' --content-label='rhel-7-server-rhev-mgmt-agent-rpms' --value=1
hammer activation-key update --organization="$ORG" --name='inf-hypervisor-rhel7' --release-version='7Server' --service-level='Standard' --auto-attach=0
environment=$(hammer --output=csv environment list --search='unstaged_inf_hypervisor_rhel7' --puppet-class='stdlib' | tail -n+2 | head -n1 | cut -d',' -f2)
hammer hostgroup create --query-organization="$ORG" --organizations="$ORG" --locations="$LOC" \
--architecture='x86_64' --content-source-id=1 --puppet-ca-proxy-id=1 --puppet-proxy-id=1 \
--domain="$DOMAIN" --realm="$REALM" --subnet="$SUBNET_NAME" \
--medium='RHEL 7.7 Kickstart' --pxe-loader='PXELinux BIOS' \
--lifecycle-environment='UnStaged' --operatingsystem='RedHat 7.7' --partition-table='Kickstart default' \
--root-pass="$HOST_PASSWORD" --puppet-classes='ssh::server,ntp' --content-view='inf-hypervisor-rhel7' \
--environment="$environment" --name='inf-hypervisor-rhel7'
hammer hostgroup set-parameter --hostgroup='inf-hypervisor-rhel7' --name='kt_activation_keys' --value='inf-hypervisor-rhel7'
hammer hostgroup set-parameter --hostgroup='inf-hypervisor-rhel7' --name='enable-puppet4' --value='true'
hammer activation-key create --organization="$ORG" --name='inf-git-rhel7' --max-hosts=5 --lifecycle-environment='UnStaged' --content-view='inf-git-rhel7'
hammer activation-key add-subscription --organization="$ORG" --name='inf-git-rhel7' --subscription-id="$PuppetForge_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-git-rhel7' --subscription-id="$RHEL_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-git-rhel7' --subscription-id="$ORG_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-git-rhel7' --subscription-id="$EPEL_Sub_ID"
hammer activation-key content-override --organization="$ORG" --name='inf-git-rhel7' --content-label='rhel-7-server-satellite-tools-6.5-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-git-rhel7' --content-label='rhel-7-server-satellite-tools-6.5-puppet4-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-git-rhel7' --content-label='rhel-server-rhscl-7-rpms' --value=1
hammer activation-key update --organization="$ORG" --name='inf-git-rhel7' --release-version='7Server' --service-level='Standard' --auto-attach=0
environment=$(hammer --output=csv environment list --search='unstaged_inf_git_rhel7' --puppet-class='stdlib' | tail -n+2 | head -n1 | cut -d',' -f2)
hammer hostgroup create --query-organization="$ORG" --organizations="$ORG" --locations="$LOC" \
--architecture='x86_64' --content-source-id=1 --puppet-ca-proxy-id=1 --puppet-proxy-id=1 \
--domain="$DOMAIN" --realm="$REALM" --subnet="$SUBNET_NAME" \
--medium='RHEL 7.7 Kickstart' --pxe-loader='PXELinux BIOS' \
--lifecycle-environment='UnStaged' --operatingsystem='RedHat 7.7' --partition-table='Kickstart default' \
--root-pass="$HOST_PASSWORD" --puppet-classes='ssh::server,ntp,git::server' --content-view='inf-git-rhel7' \
--environment="$environment" --name='inf-git-rhel7'
hammer hostgroup set-parameter --hostgroup='inf-git-rhel7' --name='kt_activation_keys' --value='inf-git-rhel7'
hammer hostgroup set-parameter --hostgroup='inf-git-rhel7' --name='enable-puppet4' --value='true'
hammer activation-key create --organization="$ORG" --name='inf-docker-rhel7' --max-hosts=5 --lifecycle-environment='UnStaged' --content-view='inf-docker-rhel7'
hammer activation-key add-subscription --organization="$ORG" --name='inf-docker-rhel7' --subscription-id="$PuppetForge_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-docker-rhel7' --subscription-id="$RHEL_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-docker-rhel7' --subscription-id="$ORG_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-docker-rhel7' --subscription-id="$EPEL_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-docker-rhel7' --subscription-id="$JBoss_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-docker-rhel7' --subscription-id="$OSCP_Sub_ID"
hammer activation-key content-override --organization="$ORG" --name='inf-docker-rhel7' --content-label='rhel-7-server-satellite-tools-6.5-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-docker-rhel7' --content-label='rhel-7-server-satellite-tools-6.5-puppet4-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-docker-rhel7' --content-label='rhel-server-rhscl-7-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-docker-rhel7' --content-label='rhel-7-server-optional-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-docker-rhel7' --content-label='rhel-7-server-extras-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-docker-rhel7' --content-label='rhel-7-server-supplementary-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-docker-rhel7' --content-label='rhel-7-server-rh-common-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-docker-rhel7' --content-label='jb-eap-7-for-rhel-7-server-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-docker-rhel7' --content-label='rhel-7-server-ose-3.2-rpms' --value=1
hammer activation-key update --organization="$ORG" --name='inf-docker-rhel7' --release-version='7Server' --service-level='Standard' --auto-attach=0
environment=$(hammer --output=csv environment list --search='unstaged_inf_docker_rhel7' --puppet-class='stdlib' | tail -n+2 | head -n1 | cut -d',' -f2)
hammer hostgroup create --query-organization="$ORG" --organizations="$ORG" --locations="$LOC" \
--architecture='x86_64' --content-source-id=1 --puppet-ca-proxy-id=1 --puppet-proxy-id=1 \
--domain="$DOMAIN" --realm="$REALM" --subnet="$SUBNET_NAME" \
--medium='RHEL 7.7 Kickstart' --pxe-loader='PXELinux BIOS' \
--lifecycle-environment='UnStaged' --operatingsystem='RedHat 7.7' --partition-table='Kickstart default' \
--root-pass="$HOST_PASSWORD" --puppet-classes='ssh::server,ntp,dockerhost' --content-view='inf-docker-rhel7' \
--environment="$environment" --name='inf-docker-rhel7'
hammer hostgroup set-parameter --hostgroup='inf-docker-rhel7' --name='kt_activation_keys' --value='inf-docker-rhel7'
hammer hostgroup set-parameter --hostgroup='inf-docker-rhel7' --name='enable-puppet4' --value='true'
hammer activation-key create --organization="$ORG" --name='inf-oscp-rhel7' --max-hosts=5 --lifecycle-environment='UnStaged' --content-view='inf-oscp-rhel7'
hammer activation-key add-subscription --organization="$ORG" --name='inf-oscp-rhel7' --subscription-id="$PuppetForge_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-oscp-rhel7' --subscription-id="$RHEL_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-oscp-rhel7' --subscription-id="$ORG_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-oscp-rhel7' --subscription-id="$EPEL_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-oscp-rhel7' --subscription-id="$JBoss_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-oscp-rhel7' --subscription-id="$OSCP_Sub_ID"
hammer activation-key content-override --organization="$ORG" --name='inf-oscp-rhel7' --content-label='rhel-7-server-satellite-tools-6.5-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-oscp-rhel7' --content-label='rhel-7-server-satellite-tools-6.5-puppet4-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-oscp-rhel7' --content-label='rhel-server-rhscl-7-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-oscp-rhel7' --content-label='rhel-7-server-optional-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-oscp-rhel7' --content-label='rhel-7-server-extras-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-oscp-rhel7' --content-label='rhel-7-server-supplementary-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-oscp-rhel7' --content-label='rhel-7-server-rh-common-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-oscp-rhel7' --content-label='jb-eap-7-for-rhel-7-server-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-oscp-rhel7' --content-label='rhel-7-server-ose-3.2-rpms' --value=1
hammer activation-key update --organization="$ORG" --name='inf-oscp-rhel7' --release-version='7Server' --service-level='Standard' --auto-attach=0
environment=$(hammer --output=csv environment list --search='unstaged_inf_oscp' --puppet-class='stdlib' | tail -n+2 | head -n1 | cut -d',' -f2)
hammer hostgroup create --query-organization="$ORG" --organizations="$ORG" --locations="$LOC" \
--architecture='x86_64' --content-source-id=1 --puppet-ca-proxy-id=1 --puppet-proxy-id=1 \
--domain="$DOMAIN" --realm="$REALM" --subnet="$SUBNET_NAME" \
--medium='RHEL 7.7 Kickstart' --pxe-loader='PXELinux BIOS' \
--lifecycle-environment='UnStaged' --operatingsystem='RedHat 7.7' --partition-table='Kickstart default' \
--root-pass="$HOST_PASSWORD" --puppet-classes='ssh::server,ntp,oscp' --content-view='inf-oscp-rhel7' \
--environment="$environment" --name='inf-oscp-rhel7'
hammer hostgroup set-parameter --hostgroup='inf-oscp-rhel7' --name='kt_activation_keys' --value='inf-oscp-rhel7'
hammer hostgroup set-parameter --hostgroup='inf-oscp-rhel7' --name='enable-puppet4' --value='true'
hammer activation-key create --organization="$ORG" --name='inf-ipa-rhel7' --max-hosts=5 --lifecycle-environment='UnStaged' --content-view='inf-ipa-rhel7'
hammer activation-key add-subscription --organization="$ORG" --name='inf-ipa-rhel7' --subscription-id="$PuppetForge_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-ipa-rhel7' --subscription-id="$RHEL_Sub_ID"
hammer activation-key add-subscription --organization="$ORG" --name='inf-ipa-rhel7' --subscription-id="$EPEL_Sub_ID"
hammer activation-key content-override --organization="$ORG" --name='inf-ipa-rhel7' --content-label='rhel-7-server-satellite-tools-6.5-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-ipa-rhel7' --content-label='rhel-7-server-satellite-tools-6.5-puppet4-rpms' --value=1
hammer activation-key content-override --organization="$ORG" --name='inf-ipa-rhel7' --content-label='rhel-server-rhscl-7-rpms' --value=1
hammer activation-key update --organization="$ORG" --name='inf-ipa-rhel7' --release-version='7Server' --service-level='Standard' --auto-attach=0
environment=$(hammer --output=csv environment list --search='unstaged_inf_ipa_rhel7' --puppet-class='stdlib' | tail -n+2 | head -n1 | cut -d',' -f2)
hammer hostgroup create --query-organization="$ORG" --organizations="$ORG" --locations="$LOC" \
--architecture='x86_64' --content-source-id=1 --puppet-ca-proxy-id=1 --puppet-proxy-id=1 \
--domain="$DOMAIN" --realm="$REALM" --subnet="$SUBNET_NAME" \
--medium='RHEL 7.7 Kickstart' --pxe-loader='PXELinux BIOS' \
--lifecycle-environment='UnStaged' --operatingsystem='RedHat 7.7' --partition-table='Kickstart default' \
--root-pass="$HOST_PASSWORD" --puppet-classes='ssh::server,ntp' --content-view='inf-ipa-rhel7' \
--partition-table='Kickstart Docker' --environment="$environment" --name='inf-ipa-rhel7'
hammer hostgroup set-parameter --hostgroup='inf-ipa-rhel7' --name='kt_activation_keys' --value='inf-ipa-rhel7'
hammer hostgroup set-parameter --hostgroup='inf-ipa-rhel7' --name='enable-puppet4' --value='true'