skripting-section:bash:satellite-installer

Redhat Satellite Installer - Script

Filename: satellite_6.2_configurator.sh

#!/bin/bash
# Auto configuration of Satellite 6.2

if ls /root | grep -q manifest ; then
	manifest=$(ls /root | grep manifest)
    echo 'Mainfest file is present, staring with deploy..'
else
	echo 'Please place the Satellite manifest file in /root and rerun the script!'
	exit 1
fi


# ---------------------------------------Environment Config------------------------------------------
## Get main configuration:
	host='https://'$(hostname -f)'/'
	organisation='Post IT'
	#label='Post_IT'
	username='admin'
	echo -n 'Enter a passwort for the admin user: '
	read password

## Repository configuration:
	epel='true'
	gluster='true'
	packetfence='true'
	rhel5='true'
	rhel6='true'
	rhel7='true'

	other='true'

# ---------------------------------------Installing Satellite----------------------------------------
clear
echo -e "\e[91mYour Satellite will be available & configured with the following information:\e[0m"
echo -e "\e[31m#############################################################################\e[0m"
echo -e "\e[41m[Genaeral Information]:\e[0m"
echo "Hostname: $host"
echo "Organization: $organisation"
echo ''
echo -e "\e[41m[Login Information]:\e[0m"
echo "Username: $username"
echo "Password: $password"
echo ''
echo -e "\e[41m[Available Repositories]:\e[0m"
echo "EPEL Repository Enabled: $epel"
echo "Gluster Repositories Enabled: $gluster"
echo "Packetfence Repositories Enabled: $packetfence"
echo "RHEL 5 Repositories Enabled: $rhel5"
echo "RHEL 6 Repositories Enabled: $rhel6"
echo "RHEL 7 Repositories Enabled: $rhel7"
echo "Other RHEL Repositories Enabled: $other"
echo -e "\e[31m#############################################################################\e[0m"
echo ''
echo -n 'Would you like to install Satellite with this Configuration? ([Y]/N): '
read choice
###
### start with installation..
if [ "$choice" == Y ]; then
    echo -e "\e[91mDisable all standard repositories..\e[0m"
	subscription-manager repos --disable '*'
	echo -e "\e[91mEnable Satellite Repos..\e[0m"
	subscription-manager repos --enable=rhel-7-server-rpms --enable=rhel-server-rhscl-7-rpms --enable=rhel-7-server-satellite-6.2-rpms
	echo -e "\e[91mUpdate the System and install Satellite installer..\e[0m"
	yum update -y && yum install -y satellite
	echo -e "\e[91mInstall and configure Satellite Server..\e[0m"
	satellite-installer --scenario satellite --foreman-initial-organization "$organisation" --foreman-initial-location 'Default Location' \
	--foreman-admin-username $username --foreman-admin-password $password --katello-proxy-url=http://outappl.pnet.ch --katello-proxy-port=3128
else
	clear
	echo -n 'Please rerun the script, after your changes..'
    exit 1
fi
# ---------------------------------------------------Hammer Commands--------------------------------------------------------------------------------------------------------------
if [ ! -d /root/.hammer ]; then
  mkdir /root/.hammer;
fi
cd "/root/.hammer"
cat <<EOF > cli_config.yml
:foreman:
  :enable_module: true

  :host: $host
  :username: $username
  :password: $password
EOF

hammer user update --login="$username" --locale='en'

##Create LDAP Connection
echo -e "\e[91mCreating Satellite LDAP connection..\e[0m"
hammer auth-source ldap create --name='pnet' --port='636' --server-type='active_directory' --host='ldaps1pnet.pnet.ch' --account='POST\s-satellite' --account-password='xJ*9C)6o' --base-dn='DC=pnet,DC=ch' --groups-base='OU=groups,DC=pnet,DC=ch' --ldap-filter='(|(ou=it*)(ou=p55))' --onthefly-register='true' --usergroup-sync='false' --attr-firstname='givenName' --attr-lastname='sn' --attr-login='samaccountname' --attr-mail='mail' --tls='true'


### Create organization, label, and location
#hammer organization create --name="$organisation" --label=$label
echo -e "\e[91mCreating locations..\e[0m"
hammer location create --name='RZ-Engehalde'
hammer location create --name='RZ-Zofingen'

#---------------------------------------------------------------------------------------------------------------
##PGP Key Import
echo -e "\e[91mImporting & creating PGP keys..\e[0m"
cat <<EOF > /root/Centos-Storage-SIG.pub
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.22 (GNU/Linux)

mQENBFTCLWABCADDHh5ktfB+78L6yxcIxwbZgaLKTp0mKvM3i2CjBrbw+xHJ4x9E
mn39rkTJf2UHOK0PgAp3FftoAFCtrSAXuanNGpEcpSxXDzxNj2QMpAbySZ2r4RpL
qxNVlB73dHuASXIMlhyV1ASpM6Me0dpaTtyKj38kRPFkWWuIUaiEQzXFgztYx7Kp
i+we0iUBfSKY47l2rbqyu9qZ8kCeMjuSuLfG5OKw+fj9zwqFJkc+LAz8IPTF4g7p
48m0m5bUPvKIIa1BfYcyqaTMxfbqjGaF1M37zF1O0TUKGQ+8VddzQmwg7GglQMt3
FqVer1WJUNPXyEgmZMzfmg7lqdPKKYaQBLk1ABEBAAG0XkNlbnRPUyBTdG9yYWdl
IFNJRyAoaHR0cDovL3dpa2kuY2VudG9zLm9yZy9TcGVjaWFsSW50ZXJlc3RHcm91
cC9TdG9yYWdlKSA8c2VjdXJpdHlAY2VudG9zLm9yZz6JATkEEwECACMFAlTCLWAC
GwMHCwkIBwMCAQYVCAIJCgsEFgIDAQIeAQIXgAAKCRDUouUL5FHltbq9B/93dtpt
lQG2mVvGik9TFgRdt+p3CPTqT1fwNzhB3iO02yJu5oM6s4FB1XqKRaKlqtvtBzyT
geAwenu74aU1hFv4uq+uETCanUaSgOvTcCn5WXUpOvlwKJV7TUjLSNRfp2dAG8Ig
d3euLnfajCE13t5BrqhTAlaMxAbGAqtzr6K9y0hUeT0ogjrscfoQSVptlcLs8d7m
P+VMR4GUfvUAws65JZxBaal4N7eIIZCWktnJ+B3dE3/tsAksGyXGLaSroPSuY18V
wksdBuscKVV49Ees0SbhvSrF5JJ07ccUt43SSFun84iNW4nuiWm2QOOKMcd182Sk
d9SDUTFu/G4s2gx7
=a0nM
-----END PGP PUBLIC KEY BLOCK-----
EOF
hammer gpg create --name Centos-Storage-SIG --organization "$organisation" --key /root/Centos-Storage-SIG.pub


cat <<EOF > /root/Post_Packages_Key.pub
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.15 (GNU/Linux)

mQINBFa6DsoBEADYVQoctXmjtd4ic3o+MRuS4ldWjZMNzKJs38I/zeBFxjDfY1WZ
MoHr4qYc2L4b4pubPDWPH7bT0QPDWVO8D0zqQyR7HaA5V+olvZEn7DMKfkQ4phFl
AXqhXD3jmWghuUaopbnXHjztiKWH4y3Onh5CI82sqimerKKsPIUkqNxDKKe88UvU
J6FReYqfjf2sp/Jck38f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UVjwD+ba
vhLjjq9B+2up14B0lA6oPckr2f0GVLd0S9fpY6hxczBDamOX/NCIqQX5rRyDd4f4
tnUJ2gctOHnkG0OK3GerAZPxHwL6qaqQluksrPcRQBnBWo9vamRC/xqYmAwf0xdK
KNtHDAHmXQEWgAKjFyvboqS05hoSllPT+/P3bniL9EwfSi2JmyVPGEXLN6fuhn5T
pk4Yq+Ki8pcOq5Kkr7s/Owiq4V4Bbw2kqpmJ8OKB/AFeL0W/YkNjUnBsa2FqRZ2m
yBca4YAShQsVIpNqm/lxUptKXlL1QHxxJTCKOgCEWa1Nfd0RLIyuR/TLBoRm
=YFFl
-----END PGP PUBLIC KEY BLOCK-----
EOF
hammer gpg create --name "Post Packages Key" --organization "$organisation" --key /root/Post_Packages_Key.pub


cat <<EOF > /root/RPM-GPG-KEY-PACKETFENCE-CENTOS.pub
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (GNU/Linux)

mQINBFboV/kBEAD0lENE/obEKUnHhRJzr/y+27BVHI0KUia4CbXESHBYla/+ZMS/
Kr91b8JFgfhw52BMDeB/73vN1HKoPvO8THzimOJA3CoN8C9I/0eqyE32SsqGA/c2
6FL9a1zTRff7BVkQTsiq3gPjLfykERzIpmfWB/FML0S+guGmS6BY04P15MOhGCwH
1emW931uwZyMv7VpNffnaUoxoMjkh4PPo7ferNRpU+cCaiokmvVS+1l+ZWeehq9N
YrNJzupQao5HdG2t2tj1n+IJChrCo5qDBZ6YlnjYxaNSaaa8bK4nPmbdmjm/3YFK
On2DIriAU0CRaJVYkWgvhEQznHwGzKeXm6x8K7Px+uvNx/OAfiwBti43WMlxbyw4
Z5fkKfRErm1BBlHI7FQkOi0sY+g7yCrlTx6+4evJC6kJ+xPyk5wFgwrs+A9iEpj2
kXkvYOPuZttA5XsqKo1tsC85j2zRnC5X53WV4ccPWiRM6cpsvDZrpi32pP6I4WE2
oE9Dt25RVA4VTovaYZKXq0H7FIIVtCTxyHXNevAmPpZKmdAnSi9vb3Yj329p5JFf
3BHtZH8li+bg5dSUSUyxS2Kdb+4q63n4NAYz52wex0t7evutEo1rzpTjNQuSp/aa
Y9mspj9xV/LdlMce9v822wGUKtvaXFUhhor0XV5icYsv93NEl3NBSnpnfQARAQAB
tDpJbnZlcnNlIFN1cHBvcnQgKFJQTSBwYWNrYWdlIHNpZ25pbmcpIDxzdXBwb3J0
QGludmVyc2UuY2E+iQI4BBMBAgAiBQJW6Ff5AhsDBgsJCAcDAgYVCAIJCgsEFgID
AQIeAQIXgAAKCRDLLToqoAMOLFyKEADV1/4XeP7maHYqRdzEfovd8dSqRTgnQKxb
gErvBdpna1vR7QNGY19zMKduSQKTIOI704s8jrtGmORrtlM5OJgrfYA1HDiTIkRp
1L6yps7Vz7qBSxGhKaT5sDsolYHX9MlgJBIQ4rs5lxZ0oQFLbaNUgRf333v+SyJC
Y720OohUa9qtur6uK2VDrJqgzl1huWctZ3FdxcbKrMwn93//W27VNdPCaRxcpbeO
qy8hJ74F+Iom9Kqw5YBPAABdSlJ2DEwxN+ItyiMExYqkTidcQmk+LdNkP2eN4OIM
d59Lp2iWP2zIqaJ9hKURwdUKYajrsFpAS7eubUprN436sK/dFpv4NL7grnoD4seB
wvk8eqxIyzONZqgZH5nhilf6QJ340SYHglQ2gChkAC5MENsUk2Cr8+R72GRtOvAP
N2GTU+v7KWtudl2jpWorlxNWRSqpFynHIUbnDdn6t0VQWnpNJWhgZBGhzA0eIYgl
7rtqJ/hlU7Cu7CzWtM3XluWhrNw4/K3lmngj2UNJkIxbZKi3K/UKsuHtvHAt6B1H
LOoD07gvX25E1Kx14KxW6oq4lsnjg/vdUwKYDdmGZCDCSsUCMdHcMQPNbLhEoBNl
B2RzxDpxO81bCL692Wxx50JFFhspOLR1a09ljrwAHtWrX5zV3Pb4qrTeiQpMgeZq
yglRDT063w==
=sdaP
-----END PGP PUBLIC KEY BLOCK-----
EOF
hammer gpg create --name RPM-GPG-KEY-PACKETFENCE-CENTOS --organization "$organisation" --key /root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fnkaCKxgXgQS3AT+hGYhlzIqQVTkGNveHTnt4SSzgAqR9sSwQwqvEfVtYNeS
w5rDguLG41HQm1Hojv59HNYjH6F/S1rClZi21bLgZbKpCFX76qPt8CTw+iQLBPPd
yoOGHfzyp7nsfhUrAAMFB/9/H9Gpk822ZpBexQW4y3LGFo9ZSnmu+ueOZPU3SqDA
DW1ovZdYzGuJTGGM9oMl6bL8eZrcUBBOFaWge5wZczIE3hx2exEOkDdvq+MUDVD1
axmN45q/7h1NYRp5GQL2ZsoV4g9U2gMdzHOFtZCER6PP9ErVlfJpgBUCdSL93V4H
Sgpkk7znmTOklbCM6l/G/A6q4sCRqfzHwVSTiruyTBiU9lfROsAl8fjIq2OzWJ2T
P9sadBe1llUYaow7txYSUxssW+89avct35gIyrBbof5M+CBXyAOUaSWmpM2eub24
0qbqiSr/Y6Om0t6vSzR8gRk7g+1H6IE0Tt1IJCvCAMimiE8EGBECAA8FAkXopTYC
GwwFCRLMAwAACgkQEZzANiF1IfZQYgCgiZHCv4xb+sTHCn/otc1Ovvi/OgMAnRXY
bbsLFWOfmzAnNIGvFRWy+YHi
=MMNL
-----END PGP PUBLIC KEY BLOCK-----
EOF
hammer gpg create --name "EPEL 5" --organization "$organisation" --key /root/EPEL_5.pub

cat <<EOF > /root/EPEL_6.pub
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.5 (GNU/Linux)

mQINBEvSKUIBEADLGnUj24ZVKW7liFN/JA5CgtzlNnKs7sBg7fVbNWryiE3URbn1
JXvrdwHtkKyY96/ifZ1Ld3lE2gOF61bGZ2CWwJNee76Sp9Z+isP8RQXbG5jwj/4B
M9HK7phktqFVJ8VbY2jfTjcfxRvGM8YBwXF8hx0CDZURAjvf1xRSQJ7iAo58qcHn
XtxOAvQmAbR9z6Q/h/D+Y/PhoIJp1OV4VNHCbCs9M7HUVBpgC53PDcTUQuwcgeY6
pQgo9eT1eLNSZVrJ5Bctivl1UcD6P6CIGkkeT2gNhqindRPngU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akCgxGb2paQOzqqpOcHKvlyLuzO5uybMXaipLExTGJXBlXrbbASfXa/yGYSAG
iVrGz9CE6676dMlm8F+s3XXE13QZrXmjloc6jwOljnfAkjTGXjiB7OULESed96MR
XtfLk0W5Ab9pd7tKDR6QHI7rgHXfCopRnZ2VVQ==
=V/6I
-----END PGP PUBLIC KEY BLOCK-----
EOF
hammer gpg create --name "EPEL 6" --organization "$organisation" --key /root/EPEL_6.pub

cat <<EOF > /root/EPEL_7.pub
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: rpm-4.11.1 (NSS-3)

mQINBFKuaIQBEAC1UphXwMqCAarPUH/ZsOFslabeTVO2pDk5YnO96f+rgZB7xArB
OSeQk7B90iqSJ85/c72OAn4OXYvT63gfCeXpJs5M7emXkPsNQWWSju99lW+AqSNm
jYWhmRlLRGl0OO7gIwj776dIXvcMNFlzSPj00N2xAqjMbjlnV2n2abAE5gq6VpqP
vFXVyfrVa/ualogDVmf6h2t4Rdpifq8qTHsHFU3xpCz+T6/dGWKGQ42ZQfTaLnDM
jToAsmY0AyevkIbX6iZVtzGvanYpPcWW4X0RDPcpqfFNZk643xI4lsZ+Y2Er9Yu5
S/8x0ly+tmmIokaE0wwbdUu740YTZjCesroYWiRg5zuQ2xfKxJoV5E+Eh+tYwGDJ
n6HfWhRgnudRRwvuJ45ztYVtKulKw8QQpd2STWrcQQDJaRWmnMooX/PATTjCBExB
9dkz38Druvk7IkHMtsIqlkAOQMdsX1d3Tov6BE2XDjIG0zFxLduJGbVwc/6rIc95
T055j36Ez0HrjxdpTGOOHxRqMK5m9flFbaxxtDnS7w77WqzW7HjFrD0VeTx2vnjj
GqchHEQpfDpFOzb8LTFhgYidyRNUflQY35WLOzLNV+pV3eQ3Jg11UFwelSNLqfQf
uFRGc+zcwkNjHh5yPvm9odR1BIfqJ6sKGPGbtPNXo7ERMRypWyRz0zi0twARAQAB
tChGZWRvcmEgRVBFTCAoNykgPGVwZWxAZmVkb3JhcHJvamVjdC5vcmc+iQI4BBMB
AgAiBQJSrmiEAhsPBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRBqL66iNSxk
5cfGD/4spqpsTjtDM7qpytKLHKruZtvuWiqt5RfvT9ww9GUUFMZ4ZZGX4nUXg49q
ixDLayWR8ddG/s5kyOi3C0uX/6inzaYyRg+Bh70brqKUK14F1BrrPi29eaKfG+Gu
MFtXdBG2a7OtPmw3yuKmq9Epv6B0mP6E5KSdvSRSqJWtGcA6wRS/wDzXJENHp5re
9Ism3CYydpy0GLRA5wo4fPB5uLdUhLEUDvh2KK//fMjja3o0L+SNz8N0aDZyn5Ax
CU9RB3EHcTecFgoy5umRj99BZrebR1NO+4gBrivIfdvD4fJNfNBHXwhSH9ACGCNv
HnXVjHQF9iHWApKkRIeh8Fr2n5dtfJEF7SEX8GbX7FbsWo29kXMrVgNqHNyDnfAB
VoPubgQdtJZJkVZAkaHrMu8AytwT62Q4eNqmJI1aWbZQNI5jWYqc6RKuCK6/F99q
thFT9gJO17+yRuL6Uv2/vgzVR1RGdwVLKwlUjGPAjYflpCQwWMAASxiv9uPyYPHc
ErSrbRG0wjIfAR3vus1OSOx3xZHZpXFfmQTsDP7zVROLzV98R3JwFAxJ4/xqeON4
vCPFU6OsT3lWQ8w7il5ohY95wmujfr6lk89kEzJdOTzcn7DBbUru33CQMGKZ3Evt
RjsC7FDbL017qxS+ZVA/HGkyfiu4cpgV8VUnbql5eAZ+1Ll6Dw==
=hdPa
-----END PGP PUBLIC KEY BLOCK-----
EOF
hammer gpg create --name "EPEL 7" --organization "$organisation" --key /root/EPEL_7.pub

#---------------------------------------------------------------------------------------------------------------
##Add Subscription & enable Repositories
echo -e "\e[91mAdding Satellite-subscription & enable Repositories..\e[0m"
hammer subscription upload --file="/root/$manifest" --organization="$organisation" 2>> /var/log/satellite_installation.log

if [ $epel == true ]; then
	echo -e "\e[94mActivating EPEL Repositories..\e[0m"
	hammer product create --name='Extra Packages for Enterprise Linux (EPEL)' --organization="$organisation"
	hammer repository create --name='EPEL 5 - x86_64' --organization="$organisation" --product='Extra Packages for Enterprise Linux (EPEL)' --content-type='yum' --publish-via-http=true --url=http://ftp.tu-chemnitz.de/pub/linux/fedora-epel/5/x86_64/ --gpg-key "EPEL 5"
	hammer repository create --name='EPEL 6 - x86_64' --organization="$organisation" --product='Extra Packages for Enterprise Linux (EPEL)' --content-type='yum' --publish-via-http=true --url=http://ftp.tu-chemnitz.de/pub/linux/fedora-epel/6/x86_64/ --gpg-key "EPEL 6"
	hammer repository create --name='EPEL 7 - x86_64' --organization="$organisation" --product='Extra Packages for Enterprise Linux (EPEL)' --content-type='yum' --publish-via-http=true --url=http://ftp.tu-chemnitz.de/pub/linux/fedora-epel/7/x86_64/ --gpg-key "EPEL 7"
	echo ''
else
	echo 'Skipping EPEL Repositories'
fi

if [ $gluster == true ]; then
	echo -e "\e[94mActivating Gluster Repositories..\e[0m"
	hammer product create --name='Gluster Upstream' --organization="$organisation" --gpg-key Centos-Storage-SIG
	hammer repository create --name='gluster-3.7' --organization="$organisation" --product='Gluster Upstream' --content-type='yum' --publish-via-http=true --url=http://mirror.centos.org/centos/7/storage/x86_64/gluster-3.7/ --gpg-key Centos-Storage-SIG
	hammer repository create --name='gluster-3.8' --organization="$organisation" --product='Gluster Upstream' --content-type='yum' --publish-via-http=true --url=http://mirror.centos.org/centos/7/storage/x86_64/gluster-3.8/ --gpg-key Centos-Storage-SIG
	hammer repository create --name='gluster-3.9' --organization="$organisation" --product='Gluster Upstream' --content-type='yum' --publish-via-http=true --url=http://mirror.centos.org/centos/7/storage/x86_64/gluster-3.9/ --gpg-key Centos-Storage-SIG
	hammer repository create --name='gluster-3.10' --organization="$organisation" --product='Gluster Upstream' --content-type='yum' --publish-via-http=true --url=http://mirror.centos.org/centos/7/storage/x86_64/gluster-3.10/ --gpg-key Centos-Storage-SIG
	echo ''
else
	echo 'Skipping Gluster Repositories'
fi

if [ $packetfence == true ]; then
	echo -e "\e[94mActivating Packetfence Repositories..\e[0m"
	hammer product create --name='PacketFence' --organization="$organisation" --gpg-key RPM-GPG-KEY-PACKETFENCE-CENTOS
	hammer repository create --name='packetfence' --organization="$organisation" --product='PacketFence' --content-type='yum' --publish-via-http=true --url=https://packetfence.org/downloads/PacketFence/RHEL7/x86_64/ --gpg-key RPM-GPG-KEY-PACKETFENCE-CENTOS
	hammer repository create --name='packetfence-devel' --organization="$organisation" --product='PacketFence' --content-type='yum' --publish-via-http=true --url=https://packetfence.org/downloads/PacketFence/RHEL7/devel/x86_64/ --gpg-key RPM-GPG-KEY-PACKETFENCE-CENTOS
	hammer repository create --name='packetfence-extra' --organization="$organisation" --product='PacketFence' --content-type='yum' --publish-via-http=true --url=https://packetfence.org/downloads/PacketFence/RHEL7/extra/x86_64/ --gpg-key RPM-GPG-KEY-PACKETFENCE-CENTOS
	echo ''
else
	echo 'Skipping PacketFence Repositories'
fi

if [ $rhel5 == true ]; then
	echo -e "\e[94mActivating RHEL 5 Repositories..\e[0m"
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='5Server' --name 'Red Hat Enterprise Linux 5 Server - RH Common (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='5Server' --name 'Red Hat Enterprise Linux 5 Server - Optional Productivity Applications (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='5Server' --name 'Red Hat Enterprise Linux 5 Server (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='5.11' --name 'Red Hat Enterprise Linux 5 Server (Kickstart)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='5Server' --name 'Red Hat Enterprise Linux 5 Server - Supplementary (RPMs)'
	echo ''
else
        echo 'Skipping Red Hat Enterprise Linux 5 Repositories'
fi

if [ $rhel6 == true ]; then
	echo -e "\e[94mActivating RHEL 6 Repositories..\e[0m"
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='6Server' --name 'Red Hat Enterprise Linux 6 Server (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --name 'Red Hat Enterprise Linux 6 Server - Extras (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='6.6' --name 'Red Hat Enterprise Linux 6 Server (Kickstart)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='6.7' --name 'Red Hat Enterprise Linux 6 Server (Kickstart)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='6.8' --name 'Red Hat Enterprise Linux 6 Server (Kickstart)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='6.6' --name 'Red Hat Enterprise Linux 6 Server - Optional (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='6Server' --name 'Red Hat Enterprise Linux 6 Server - Optional (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='6.6' --name 'Red Hat Enterprise Linux 6 Server - RH Common (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='6Server' --name 'Red Hat Enterprise Linux 6 Server - RH Common (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='6.6' --name 'Red Hat Enterprise Linux 6 Server (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='6.6' --name 'Red Hat Enterprise Linux 6 Server - Supplementary (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='6Server' --name 'Red Hat Enterprise Linux 6 Server - Supplementary (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server - Extended Update Support' --basearch='x86_64' --releasever='6.6' --name 'Red Hat Enterprise Linux 6 Server - Extended Update Support (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server - Extended Update Support' --basearch='x86_64' --releasever='6Server' --name 'Red Hat Enterprise Linux 6 Server - Extended Update Support - Optional (RPMs)'
	echo ''
else
        echo 'Skipping Red Hat Enterprise Linux 6 Repositories'
fi

if [ $rhel7 == true ]; then
	echo -e "\e[94mActivating RHEL 7 Repositories..\e[0m"
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server - Extended Update Support' --basearch='x86_64' --releasever='7Server' --name 'Red Hat Enterprise Linux 7 Server - Extended Update Support - Optional (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server - Extended Update Support' --basearch='x86_64' --releasever='7.2' --name 'Red Hat Enterprise Linux 7 Server - Extended Update Support (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --name 'Red Hat Enterprise Linux 7 Server - Extras (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='7Server' --name 'Red Hat Enterprise Linux 7 Server (ISOs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='7.2' --name 'Red Hat Enterprise Linux 7 Server (Kickstart)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='7Server' --name 'Red Hat Enterprise Linux 7 Server - Optional (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='7Server' --name 'Red Hat Enterprise Linux 7 Server - RH Common (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='7Server' --name 'Red Hat Enterprise Linux 7 Server (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --releasever='7Server' --name 'Red Hat Enterprise Linux 7 Server - Supplementary (RPMs)'
	echo ''
else
	echo 'Skipping Red Hat Enterprise Linux 7 Repositories'
fi

if [ $other == true ]; then
	echo -e "\e[94mActivating Other RHEL Repositories..\e[0m"
	hammer product create --name='Post Packages' --organization="$organisation" --gpg-key "Post Packages Key"
	hammer product create --name='Post Puppet Modules' --organization="$organisation"
	
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux for SAP Hana' --basearch='x86_64' --releasever='7.2' --name 'Red Hat Enterprise Linux for SAP HANA (RHEL 7 Server) (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux for SAP Hana' --basearch='x86_64' --releasever='6.6' --name 'RHEL for SAP HANA (for RHEL 6 Server) (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux for SAP Hana' --basearch='x86_64' --releasever='6.8' --name 'RHEL for SAP HANA (for RHEL 6 Server) (RPMs)'
	
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux High Availability for RHEL Server' --basearch='x86_64' --releasever='7Server' --name 'Red Hat Enterprise Linux High Availability (for RHEL 7 Server) (RPMs)'
	
	hammer repository-set enable --organization "$organisation" --product 'Red Hat OpenShift Container Platform' --basearch='x86_64' --name 'Red Hat OpenShift Container Platform 3.3 (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat OpenShift Container Platform' --basearch='x86_64' --name 'Red Hat OpenShift Container Platform 3.4 (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat OpenShift Container Platform' --basearch='x86_64' --name 'Red Hat OpenShift Container Platform 3.5 (RPMs)'

	hammer repository-set enable --organization "$organisation" --product 'Red Hat OpenShift Container Platform' --basearch='x86_64' --name 'Red Hat OpenShift Enterprise 3.1 (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat OpenShift Container Platform' --basearch='x86_64' --name 'Red Hat OpenShift Enterprise 3.2 (RPMs)'

	hammer repository-set enable --organization "$organisation" --product 'Red Hat Software Collections for RHEL Server' --basearch='x86_64' --name 'Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server' --releasever='7Server'

	hammer repository-set enable --organization "$organisation" --product 'Red Hat Satellite' --basearch='x86_64' --name 'Red Hat Satellite 6.2 (for RHEL 7 Server) (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --name 'Red Hat Satellite Tools 6.2 (for RHEL 6 Server) (RPMs)'
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Enterprise Linux Server' --basearch='x86_64' --name 'Red Hat Satellite Tools 6.2 (for RHEL 7 Server) (RPMs)'
	
	hammer repository-set enable --organization "$organisation" --product 'Red Hat Satellite Capsule' --basearch='x86_64' --name 'Red Hat Satellite Capsule 6.2 (for RHEL 7 Server) (RPMs)'

	hammer repository-set enable --organization "$organisation" --product 'RHEL for SAP HANA - Extended Update Support' --basearch='x86_64' --releasever='6.6' --name 'RHEL for SAP HANA (for RHEL 6 Server) Extended Update Support (RPMs)'

	echo ''
else
	echo 'Skipping other Red Hat Enterprise Linux Repositories'
fi

#---------------------------------------------------------------------------------------------------------------
###Create the lifecycle-environments
echo -e "\e[91mCreate the lifecycle-environments..\e[0m"
hammer lifecycle-environment create --name='Engineering' --label='Engineering' --prior='Library' --organization="$organisation"
hammer lifecycle-environment create --name='Test/Integration' --label='Test_Integration' --prior='Engineering' --organization="$organisation"
hammer lifecycle-environment create --name='Production' --label='Production' --prior='Test/Integration' --organization="$organisation"
hammer lifecycle-environment create --name='SPS Production' --label='SPS_Production' --prior='Library' --organization="$organisation"

###Create synchonization plans
echo -e "\e[91mCreate synchonization plans..\e[0m"
hammer sync-plan create --name='EPEL Daily Sync' --interval=daily --description='Sync EPEL daily' --organization="$organisation" --enabled=1 --sync-date='2017-01-01'
hammer sync-plan create --name='PacketFence Sync' --interval=daily --description='Sync PacketFence daily' --organization="$organisation" --enabled=1 --sync-date='2017-01-01'
hammer sync-plan create --name='Red Hat Products Daily Sync' --interval=daily --description='Sync Red Hat products on a daily basis.' --organization="$organisation" --enabled=1 --sync-date='2017-01-01'

##Assign plans with products:
echo -e "\e[91mAssign plans with products..\e[0m"
hammer product set-sync-plan --sync-plan='EPEL Daily Sync' --organization="$organisation" --name='Gluster Upstream'
hammer product set-sync-plan --sync-plan='EPEL Daily Sync' --organization="$organisation" --name='Extra Packages for Enterprise Linux (EPEL)'
hammer product set-sync-plan --sync-plan='PacketFence Sync' --organization="$organisation" --name='PacketFence'
hammer product set-sync-plan --sync-plan='Red Hat Products Daily Sync' --organization="$organisation" --name='Red Hat Satellite'
hammer product set-sync-plan --sync-plan='Red Hat Products Daily Sync' --organization="$organisation" --name='Red Hat Enterprise Linux Server'
hammer product set-sync-plan --sync-plan='Red Hat Products Daily Sync' --organization="$organisation" --name='Red Hat Satellite Capsule'
hammer product set-sync-plan --sync-plan='Red Hat Products Daily Sync' --organization="$organisation" --name='Red Hat Enterprise Linux for SAP Hana'
hammer product set-sync-plan --sync-plan='Red Hat Products Daily Sync' --organization="$organisation" --name='Red Hat OpenShift Container Platform'
hammer product set-sync-plan --sync-plan='Red Hat Products Daily Sync' --organization="$organisation" --name='Red Hat Software Collections for RHEL Server'
hammer product set-sync-plan --sync-plan='Red Hat Products Daily Sync' --organization="$organisation" --name='Red Hat Enterprise Linux Server - Extended Update Support'
hammer product set-sync-plan --sync-plan='Red Hat Products Daily Sync' --organization="$organisation" --name='RHEL for SAP HANA - Extended Update Support'

#---------------------------------------------------------------------------------------------------------------
##Create Content Views..
echo -e "\e[91mCreate Content Views..\e[0m"
hammer content-view create --name='cv-rhel5' --organization="$organisation"
hammer content-view create --name='cv-rhel6 ' --organization="$organisation"
hammer content-view create --name='cv-rhel7' --organization="$organisation"
hammer content-view create --name='cv-rhel-sps' --organization="$organisation"
hammer content-view create --name='cv-rhel-sap-hana' --organization="$organisation"
hammer content-view create --name='cv-rhel' --organization="$organisation"
hammer content-view create --name='cv-puppetmodules' --organization="$organisation"
hammer content-view create --name='cv-post' --organization="$organisation"
hammer content-view create --name='cv-openshift3' --organization="$organisation"
hammer content-view create --name='cv-gluster-upstream' --organization="$organisation"
hammer content-view create --name='cv-app-capsule' --organization="$organisation"

##Assign Repositories to new Content Views
echo -e "\e[91mAssign Repositories to new Content Views..\e[0m"
hammer content-view add-repository --name='cv-rhel5' --organization="$organisation" --repository='EPEL 5 - x86_64' --product='Extra Packages for Enterprise Linux (EPEL)'
hammer content-view add-repository --name='cv-rhel5' --organization="$organisation" --repository='Red Hat Enterprise Linux 5 Server Kickstart x86_64 5.11' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel5' --organization="$organisation" --repository='Red Hat Enterprise Linux 5 Server - Optional Productivity Applications RPMs x86_64 5Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel5' --organization="$organisation" --repository='Red Hat Enterprise Linux 5 Server - RH Common RPMs x86_64 5Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel5' --organization="$organisation" --repository='Red Hat Enterprise Linux 5 Server RPMs x86_64 5Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel5' --organization="$organisation" --repository='Red Hat Enterprise Linux 5 Server - Supplementary RPMs x86_64 5Server' --product='Red Hat Enterprise Linux Server'

hammer content-view add-repository --name='cv-rhel6' --organization="$organisation" --repository='EPEL 6 - x86_64' --product='Extra Packages for Enterprise Linux (EPEL)'
hammer content-view add-repository --name='cv-rhel6' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server - Extended Update Support RPMs x86_64 6.6' --product='Red Hat Enterprise Linux Server - Extended Update Support'
hammer content-view add-repository --name='cv-rhel6' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server - Extras RPMs x86_64' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel6' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server Kickstart x86_64 6.7' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel6' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server - Optional RPMs x86_64 6Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel6' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server - RH Common RPMs x86_64 6.6' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel6' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server - RH Common RPMs x86_64 6Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel6' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server RPMs x86_64 6Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel6' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server - Supplementary RPMs x86_64 6.6' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel6' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server - Supplementary RPMs x86_64 6Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel6' --organization="$organisation" --repository='Red Hat Satellite Tools 6.2 for RHEL 6 Server RPMs x86_64' --product='Red Hat Enterprise Linux Server'

hammer content-view add-repository --name='cv-rhel7' --organization="$organisation" --repository='EPEL 7 - x86_64' --product='Extra Packages for Enterprise Linux (EPEL)'
hammer content-view add-repository --name='cv-rhel7' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server - Extras RPMs x86_64' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel7' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server Kickstart x86_64 7.2' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel7' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server - Optional RPMs x86_64 7Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel7' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server - RH Common RPMs x86_64 7Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel7' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel7' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server - Supplementary RPMs x86_64 7Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel7' --organization="$organisation" --repository='Red Hat Satellite 6.2 for RHEL 7 Server RPMs x86_64' --product='Red Hat Satellite'
hammer content-view add-repository --name='cv-rhel7' --organization="$organisation" --repository='Red Hat Satellite Tools 6.2 for RHEL 7 Server RPMs x86_64' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel7' --organization="$organisation" --repository='Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_64 7Server' --product='Red Hat Software Collections for RHEL Server'

hammer content-view add-repository --name='cv-rhel-sps' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server - Extras RPMs x86_64' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel-sps' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server - Optional RPMs x86_64 7Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel-sps' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server' --product='Red Hat Enterprise Linux Server'

hammer content-view add-repository --name='cv-rhel-sap-hana' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server - Extended Update Support RPMs x86_64 6.6' --product='Red Hat Enterprise Linux Server - Extended Update Support'
hammer content-view add-repository --name='cv-rhel-sap-hana' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server Kickstart x86_64 6.6' --product='Red Hat Enterprise Linux Server'

hammer content-view add-repository --name='cv-rhel-sap-hana' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server - Extended Update Support - Optional RPMs x86_64 7Server' --product='Red Hat Enterprise Linux Server - Extended Update Support'

hammer content-view add-repository --name='cv-rhel-sap-hana' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server - Extended Update Support RPMs x86_64 7.2' --product='Red Hat Enterprise Linux Server - Extended Update Support'
hammer content-view add-repository --name='cv-rhel-sap-hana' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server - Extras RPMs x86_64' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel-sap-hana' --organization="$organisation" --repository='Red Hat Enterprise Linux for SAP HANA RHEL 7 Server RPMs x86_64 7.2' --product='Red Hat Enterprise Linux for SAP Hana'
hammer content-view add-repository --name='cv-rhel-sap-hana' --organization="$organisation" --repository='Red Hat Satellite Tools 6.2 for RHEL 6 Server RPMs x86_64' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel-sap-hana' --organization="$organisation" --repository='RHEL for SAP HANA for RHEL 6 Server RPMs x86_64 6.6' --product='Red Hat Enterprise Linux for SAP Hana'

hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 5 Server - Optional Productivity Applications RPMs x86_64 5Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 5 Server - RH Common RPMs x86_64 5Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 5 Server RPMs x86_64 5Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 5 Server - Supplementary RPMs x86_64 5Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server - Extras RPMs x86_64' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server Kickstart x86_64 6.6' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server - Optional RPMs x86_64 6.6' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server - Optional RPMs x86_64 6Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server - RH Common RPMs x86_64 6.6' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server - RH Common RPMs x86_64 6Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server RPMs x86_64 6.6' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server RPMs x86_64 6Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server - Supplementary RPMs x86_64 6.6' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 6 Server - Supplementary RPMs x86_64 6Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server - Extras RPMs x86_64' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server Kickstart x86_64 7.2' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server - Optional RPMs x86_64 7Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server - RH Common RPMs x86_64 7Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Enterprise Linux 7 Server - Supplementary RPMs x86_64 7Server' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Satellite Tools 6.2 for RHEL 6 Server RPMs x86_64' --product='Red Hat Enterprise Linux Server'
hammer content-view add-repository --name='cv-rhel' --organization="$organisation" --repository='Red Hat Satellite Tools 6.2 for RHEL 7 Server RPMs x86_64' --product='Red Hat Enterprise Linux Server'

hammer content-view add-repository --name='cv-openshift3' --organization="$organisation" --repository='Red Hat OpenShift Enterprise 3.1 RPMs x86_64' --product='Red Hat OpenShift Container Platform'
hammer content-view add-repository --name='cv-openshift3' --organization="$organisation" --repository='Red Hat OpenShift Enterprise 3.2 RPMs x86_64' --product='Red Hat OpenShift Container Platform'
hammer content-view add-repository --name='cv-openshift3' --organization="$organisation" --repository='Red Hat OpenShift Container Platform 3.3 RPMs x86_64' --product='Red Hat OpenShift Container Platform'
hammer content-view add-repository --name='cv-openshift3' --organization="$organisation" --repository='Red Hat OpenShift Container Platform 3.4 RPMs x86_64' --product='Red Hat OpenShift Container Platform'
hammer content-view add-repository --name='cv-openshift3' --organization="$organisation" --repository='Red Hat OpenShift Container Platform 3.5 RPMs x86_64' --product='Red Hat OpenShift Container Platform'

hammer content-view add-repository --name='cv-gluster-upstream' --organization="$organisation" --repository='gluster-3.8' --product='Gluster Upstream'
hammer content-view add-repository --name='cv-gluster-upstream' --organization="$organisation" --repository='gluster-3.10' --product='Gluster Upstream'

hammer content-view add-repository --name='cv-app-capsule' --organization="$organisation" --repository='Red Hat Satellite Capsule 6.2 for RHEL 7 Server RPMs x86_64' --product='Red Hat Satellite Capsule'


##Publishing Content Views
echo -e "\e[91mPublishing new Content Views..\e[0m"
hammer content-view publish --name='cv-rhel5' --organization="$organisation" --async
hammer content-view publish --name='cv-rhel6' --organization="$organisation" --async
hammer content-view publish --name='cv-rhel7' --organization="$organisation" --async
hammer content-view publish --name='cv-rhel-sps' --organization="$organisation" --async
hammer content-view publish --name='cv-rhel-sap-hana' --organization="$organisation" --async
hammer content-view publish --name='cv-rhel' --organization="$organisation" --async
hammer content-view publish --name='cv-puppetmodules' --organization="$organisation" --async
hammer content-view publish --name='cv-post' --organization="$organisation" --async
hammer content-view publish --name='cv-openshift3' --organization="$organisation" --async
hammer content-view publish --name='cv-gluster-upstream' --organization="$organisation" --async
hammer content-view publish --name='cv-app-capsule' --organization="$organisation" --async


##Create Composit Content Views & Assign Content Views to Composit Content Views
echo -e "\e[91mCreate Composit Content Views & assign Content Views to Composit Content Views..\e[0m"
hammer content-view list --organization="$organisation" > /tmp/cwList

hammer content-view create --name='ccv-rhel7-openshift3' --organization="$organisation" --composite --component-ids="$(awk '/cv-rhel7/{print $1}' /tmp/cwList),$(awk '/cv-post/{print $1}' /tmp/cwList),$(awk '/cv-openshift3/{print $1}' /tmp/cwList),$(awk '/cv-puppetmodules/{print $1}' /tmp/cwList)"
hammer content-view create --name='ccv-rhel7-basic' --organization="$organisation" --composite
hammer content-view create --name='ccv-rhel6.6-sap-hana' --organization="$organisation" --composite
hammer content-view create --name='ccv-rhel6-basic' --organization="$organisation" --composite
hammer content-view create --name='ccv-rhel5-basic' --organization="$organisation" --composite
hammer content-view create --name='ccv-infra-capsule' --organization="$organisation" --composite --component-ids="$(awk '/cv-rhel7/{print $1}' /tmp/cwList),$(awk '/cv-app-capsule/{print $1}' /tmp/cwList)"


##Publishing Composit Content Views.
echo -e "\e[91mPublishing new Composit Content Views..\e[0m"
hammer content-view publish --name='ccv-rhel7-openshift3' --organization="$organisation" --async
hammer content-view publish --name='ccv-rhel7-basic' --organization="$organisation" --async
hammer content-view publish --name='ccv-rhel6.6-sap-hana' --organization="$organisation" --async
hammer content-view publish --name='ccv-rhel6-basic' --organization="$organisation" --async
hammer content-view publish --name='ccv-rhel5-basic' --organization="$organisation" --async
hammer content-view publish --name='ccv-infra-capsule' --organization="$organisation" --async

#---------------------------------------------------------------------------------------------------------------

while hammer task list | grep -q 'pending.*Publish' ; do

	echo -e "\e[91mWaiting to complete Content View creation..\e[0m"
	sleep 10;
done 2>/dev/null

##Promote Content Views to LifeCycle
echo -e "\e[91mPromote Content Views to LifeCycle..\e[0m"
hammer content-view version promote --organization="$organisation" --to-lifecycle-environment='Engineering' --content-view='ccv-rhel7-basic' --async

function waitToComplete {
	while hammer task list | grep -q 'pending.*Promotion' ; do

		echo -e "\e[91mWaiting to complete Content View promotion..\e[0m"
		sleep 10;
	done 2>/dev/null
}

waitToComplete
hammer content-view version promote --organization="$organisation" --to-lifecycle-environment='Engineering' --content-view='ccv-rhel7-openshift3' --async
waitToComplete
hammer content-view version promote --organization="$organisation" --to-lifecycle-environment='Engineering' --content-view='cv-openshift3' --async
waitToComplete
hammer content-view version promote --organization="$organisation" --to-lifecycle-environment='Engineering' --content-view='cv-rhel-sap-hana' --async
waitToComplete
hammer content-view version promote --organization="$organisation" --to-lifecycle-environment='Test/Integration' --content-view='ccv-rhel7-basic' --async
waitToComplete
hammer content-view version promote --organization="$organisation" --to-lifecycle-environment='Production' --content-view='ccv-rhel7-basic' --async
waitToComplete
hammer content-view version promote --organization="$organisation" --to-lifecycle-environment='SPS Production' --content-view='cv-rhel-sps' --async
waitToComplete

#---------------------------------------------------------------------------------------------------------------

##Create Activation Keys:
echo -e "\e[91mCreate Activation Keys..\e[0m"
hammer activation-key create --name='act-rhel7' --unlimited-hosts --lifecycle-environment='Library' --organization="$organisation" --content-view='ccv-rhel7-basic'
hammer activation-key create --name='act-rhel7-engineering' --unlimited-hosts --lifecycle-environment='Engineering' --organization="$organisation" --content-view='ccv-rhel7-basic'
hammer activation-key create --name='act-rhel7-openshift3' --unlimited-hosts --lifecycle-environment='Library' --organization="$organisation" --content-view='ccv-rhel7-openshift3'

hammer activation-key create --name='act-rhel7-production' --unlimited-hosts --lifecycle-environment='Production' --organization="$organisation" --content-view='ccv-rhel7-basic'

hammer activation-key create --name='act-rhel7-swiss-post-solutions-prod' --max-hosts='60' --lifecycle-environment='SPS Production' --organization="$organisation" --content-view='cv-rhel-sps'

hammer activation-key create --name='act-rhel7-swiss-post-solutions-test' --max-hosts='10' --lifecycle-environment='Library' --organization="$organisation" --content-view='cv-rhel-sps'
hammer activation-key create --name='act-rhel7-test-integration' --unlimited-hosts --lifecycle-environment='Test/Integration' --organization="$organisation" --content-view='ccv-rhel7-basic'


## Update Release Versions of Keys:
echo -e "\e[91mUpdating Release Versions of Keys..\e[0m"
hammer activation-key update --release-version='7Server' --organization="$organisation" --name='act-rhel7'
hammer activation-key update --release-version='7Server' --organization="$organisation" --name='act-rhel7-engineering'
hammer activation-key update --release-version='7Server' --organization="$organisation" --name='act-rhel7-openshift3'
#----->>  activation_key not found
hammer activation-key update --release-version='7Server' --organization="$organisation" --name='act-rhel7-production'

hammer activation-key update --release-version='' --organization="$organisation" --name='act-rhel7-swiss-post-solutions-prod'
hammer activation-key update --release-version='' --organization="$organisation" --name='act-rhel7-swiss-post-solutions-test'
hammer activation-key update --release-version='7Server' --organization="$organisation" --name='act-rhel7-test-integration'

#---------------------------------------------------------------------------------------------------------------

##Synchronizise & Update all Repositories:
echo -e "\e[91mSynchronizising & updating all repositories..\e[0m"
for i in $(hammer --csv repository list --organization="$organisation"  | awk -F, 'BEGIN{ IGNORECASE=1} !/^ID/ {print $1}'); do hammer repository synchronize --id ${i} --organization="$organisation" --async; done

  • skripting-section/bash/satellite-installer.txt
  • Last modified: 2017/09/04 13:47
  • by michael