Project

Profile

Help

Issue #8410 » fm_install.sh

stfn, 04/01/2021 05:41 PM

 
#!/bin/bash
#
#
#


# Foreman 2.3
#yum -y localinstall https://yum.theforeman.org/releases/2.3/el7/x86_64/foreman-release.rpm

# Foreman 2.4
yum -y install https://yum.theforeman.org/releases/2.4/el7/x86_64/foreman-release.rpm

# Katello 3.18
#yum -y localinstall https://fedorapeople.org/groups/katello/releases/yum/3.18/katello/el7/x86_64/katello-repos-latest.rpm

# Katello 4.0
yum -y localinstall https://fedorapeople.org/groups/katello/releases/yum/4.0/katello/el7/x86_64/katello-repos-latest.rpm

yum -y localinstall https://yum.puppet.com/puppet6-release-el-7.noarch.rpm
yum -y install epel-release centos-release-scl-rh

yum update -y
yum install foreman-installer -y

yum install htop mc vim wget screen -y

yum update -y
yum info katello
yum install katello -y
foreman-installer --scenario katello --foreman-initial-organization "XXX" --foreman-initial-location "YYY"

yum install -y tfm-rubygem-foreman_ansible.noarch rubygem-smart_proxy_ansible.noarch tfm-rubygem-foreman_ansible_core.noarch tfm-rubygem-foreman_ansible-doc.noarch tfm-rubygem-hammer_cli_foreman_ansible.noarch

#
# Creating an Organization
#

hammer organization create \
--name "XXX" \
--label "XXX" \
--description "XXX"

hammer defaults add --param-name organization --param-value "XXX"
hammer defaults add --param-name organization --param-value "YYY"

mkdir -p /etc/pki/deb-gpg/debian10
mkdir -p /etc/pki/deb-gpg/debian10/main
mkdir -p /etc/pki/deb-gpg/debian10/updates
mkdir -p /etc/pki/deb-gpg/debian10/security
mkdir -p /etc/pki/deb-gpg/debian10/client

#
# Downloding PGP keys
#


cd /etc/pki/deb-gpg/debian10/main/
wget http://ftp.debian.org/debian/dists/buster/Release && wget http://ftp.debian.org/debian/dists/buster/Release.gpg
gpg --verify Release.gpg Release
gpg --keyserver hkp://keys.gnupg.net:80 --recv-key 16E90B3FDF65EDE3AA7F323C04EE7237B7D453EC
gpg --keyserver hkp://keys.gnupg.net:80 --recv-key 0146DC6D4A0B2914BDED34DB648ACFD622F3D138
gpg --keyserver hkp://keys.gnupg.net:80 --recv-key 6D33866EDD8FFA41C0143AEDDCC9EFBF77E11517
gpg --armor --export E0B11894F66AEC98 DC30D7C23CBBABEE DCC9EFBF77E11517 > RPM-GPG-KEY-Debian_10-main

cd /etc/pki/deb-gpg/debian10/security
wget http://security.debian.org/debian-security/dists/buster/updates/Release && wget http://security.debian.org/debian-security/dists/buster/updates/Release.gpg
gpg --verify Release.gpg Release
gpg --keyserver hkp://keys.gnupg.net:80 --recv-key 379483D8B60160B155B372DDAA8E81B4331F7F50
gpg --keyserver hkp://keys.gnupg.net:80 --recv-key 5237CEEEF212F3D51C74ABE0112695A0E562B32A
gpg --armor --export EDA0D2388AE22BA9 4DFAB270CAA96DFA > RPM-GPG-KEY-Debian_10-security

cd /etc/pki/deb-gpg/debian10/updates
wget http://ftp.debian.org/debian/dists/buster-updates/Release && wget http://ftp.debian.org/debian/dists/buster-updates/Release.gpg
gpg --verify Release.gpg Release
gpg --keyserver hkp://keys.gnupg.net:80 --recv-key 16E90B3FDF65EDE3AA7F323C04EE7237B7D453EC
gpg --keyserver hkp://keys.gnupg.net:80 --recv-key 0146DC6D4A0B2914BDED34DB648ACFD622F3D138
gpg --armor --export E0B11894F66AEC98 DC30D7C23CBBABEE > RPM-GPG-KEY-Debian_10-updates

cd /etc/pki/deb-gpg/debian10/client
wget --output-document=RPM-GPG-KEY-Debian_10-client https://apt.atix.de/atix_gpg.pub

#
# Importing PGP keys
#

cd /etc/pki/deb-gpg/debian10/updates
hammer content-credentials create --content-type gpg_key \
--path "RPM-GPG-KEY-Debian_10-updates" \
--name "RPM-GPG-KEY-Debian_10-updates"

cd /etc/pki/deb-gpg/debian10/main
hammer content-credentials create --content-type gpg_key \
--path "RPM-GPG-KEY-Debian_10-main" \
--name "RPM-GPG-KEY-Debian_10-main"


cd /etc/pki/deb-gpg/debian10/client
hammer content-credentials create --content-type gpg_key \
--path "RPM-GPG-KEY-Debian_10-client" \
--name "RPM-GPG-KEY-Debian_10-client"


cd /etc/pki/deb-gpg/debian10/security
hammer content-credentials create --content-type gpg_key \
--path "RPM-GPG-KEY-Debian_10-security" \
--name "RPM-GPG-KEY-Debian_10-security"

hammer content-credential list --organization-title=XXX

hammer location create --name "YYY"

hammer architecture create --name "amd64"

hammer os create --name "Debian10" --family "Debian" --release-name "buster" --major "10" --description "Debian 10" --architecture-ids 3


hammer sync-plan create --name 'Debian10_sync_plan' \
--organization "XXX" \
--description 'Sync repositories Debian 10' \
--interval weekly \
--sync-date $(date +"%Y-%m-%d")" 01:00:00" \
--enabled yes

hammer lifecycle-environment create \
--organization "XXX" \
--name "Production" \
--label "Production" \
--prior "Library"

hammer lifecycle-environment list --organization "XXX"

hammer product create \
--organization "XXX" \
--name "Debian10" \
--description "Repositories for Debian 10"

hammer repository create \
--organization "XXX" \
--product "Debian10" \
--name "Debian 10 main" \
--label "Debian_10_main" \
--content-type "deb" \
--url "http://ftp.debian.org/debian/" \
--deb-architectures amd64 \
--deb-components "main" \
--gpg-key-id 2 \
--deb-releases "buster" \
--mirror-on-sync "yes" \
--verify-ssl-on-sync "yes"

hammer repository create \
--organization "XXX" \
--product "Debian10" \
--name "Debian 10 security" \
--label "Debian_10_security" \
--content-type "deb" \
--url "http://deb.debian.org/debian-security/" \
--deb-architectures amd64 \
--deb-components "main" \
--gpg-key-id 4 \
--deb-releases "buster/updates" \
--mirror-on-sync "yes" \
--verify-ssl-on-sync "yes"

hammer repository create \
--organization "XXX" \
--product "Debian10" \
--name "Debian 10 updates" \
--label "Debian_10_updates" \
--content-type "deb" \
--url "http://ftp.debian.org/debian/" \
--deb-architectures amd64 \
--deb-components "main" \
--gpg-key-id 1 \
--deb-releases "buster-updates" \
--mirror-on-sync "yes" \
--verify-ssl-on-sync "yes"


hammer repository create \
--organization "XXX" \
--product "Debian10" \
--name "Debian 10 sm" \
--label "Debian_10_sm" \
--content-type "deb" \
--url "https://apt.atix.de/Debian10/" \
--deb-architectures amd64 \
--deb-components "main" \
--gpg-key-id 3 \
--deb-releases "stable" \
--mirror-on-sync "yes" \
--verify-ssl-on-sync "yes"

(4-4/6)