├── .github └── workflows │ └── pull_request.yml ├── .gitignore ├── .pre-commit-config.yaml ├── CentOS5 ├── Dockerfile ├── startup.sh └── subman.repo ├── CentOS6 ├── Dockerfile └── startup.sh ├── CentOS7 ├── Dockerfile └── startup.sh ├── Fedora28 ├── Dockerfile └── startup.sh ├── LICENSE ├── OpenSuse ├── Dockerfile ├── install-tools.sh └── startup.sh ├── README.md ├── RHEL6-Puppet ├── Dockerfile └── startup.sh ├── RHEL6 ├── Dockerfile ├── resources │ └── startup.sh └── setup_scripts │ └── placeholder ├── RHEL7-Guest ├── Dockerfile ├── hostname-3.13-3.el7.x86_64.rpm └── startup.sh ├── RHEL7-High-Traffic ├── Dockerfile ├── hostname-3.13-3.el7.x86_64.rpm └── startup.sh ├── RHEL7-Puppet ├── Dockerfile ├── hostname-3.13-3.el7.x86_64.rpm └── startup.sh ├── RHEL7-RemoteExecution ├── Dockerfile ├── hostname-3.13-3.el7.x86_64.rpm └── startup.sh ├── RHEL7 ├── Dockerfile ├── hostname-3.13-3.el7.x86_64.rpm └── startup.sh ├── RHEL72 ├── Dockerfile ├── hostname-3.13-3.el7.x86_64.rpm └── startup.sh ├── RHEL8 ├── Dockerfile ├── hostname-3.20-6.el8.x86_64.rpm └── startup.sh ├── SLES11 ├── Dockerfile ├── install-tools.sh └── startup.sh ├── SLES11sp4 ├── Dockerfile ├── install-tools.sh └── startup.sh ├── SLES12 ├── Dockerfile ├── install-tools.sh └── startup.sh ├── SLES12sp3 ├── Dockerfile ├── install-tools.sh └── startup.sh ├── SLES12sp4 ├── Dockerfile ├── install-tools.sh └── startup.sh ├── SLES15sp1 ├── Dockerfile ├── install-tools.sh └── startup.sh ├── UBI10-init ├── Dockerfile ├── resources │ └── hostname-3.23-14.el10.x86_64.rpm └── setup_scripts │ ├── 00_hostname.sh │ └── 01_sshd.sh ├── UBI10 ├── Dockerfile ├── resources │ ├── hostname-3.23-14.el10.x86_64.rpm │ └── startup.sh └── setup_scripts │ └── 00_hostname.sh ├── UBI7-init ├── Dockerfile ├── resources │ └── hostname-3.13-3.el7.x86_64.rpm └── setup_scripts │ ├── 00_hostname.sh │ └── 01_sshd.sh ├── UBI7 ├── Dockerfile ├── resources │ ├── hostname-3.13-3.el7.x86_64.rpm │ └── startup.sh └── setup_scripts │ └── 00_hostname.sh ├── UBI8-init ├── Dockerfile ├── resources │ └── hostname-3.20-6.el8.x86_64.rpm └── setup_scripts │ ├── 00_hostname.sh │ └── 01_sshd.sh ├── UBI8 ├── Dockerfile ├── resources │ ├── hostname-3.20-6.el8.x86_64.rpm │ └── startup.sh └── setup_scripts │ └── 00_hostname.sh ├── UBI9-init ├── Dockerfile ├── resources │ └── hostname-3.23-6.el9.x86_64.rpm └── setup_scripts │ ├── 00_hostname.sh │ └── 01_sshd.sh ├── UBI9 ├── Dockerfile ├── resources │ ├── hostname-3.23-6.el9.x86_64.rpm │ └── startup.sh └── setup_scripts │ └── 00_hostname.sh ├── build-and-push.sh ├── flood.py ├── playbooks ├── ansible.cfg ├── chd-run.yaml ├── chd-setup.yaml └── hosts ├── requirements_test.txt └── tests ├── conftest.py └── test_Dockerfiles.py /.github/workflows/pull_request.yml: -------------------------------------------------------------------------------- 1 | name: Code Checks 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | code-checks: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout code 13 | uses: actions/checkout@v2 14 | 15 | - name: Set up Python 16 | uses: actions/setup-python@v2 17 | with: 18 | python-version: '3.13' 19 | 20 | - name: Install pre-commit 21 | run: pip install pre-commit 22 | 23 | - name: Run pre-commit checks 24 | run: pre-commit run --all-files 25 | 26 | - name: Set up Docker Buildx 27 | uses: docker/setup-buildx-action@v1 28 | 29 | - name: Install pytest 30 | run: pip install pytest 31 | 32 | - name: Run pytest 33 | run: pytest -sv tests/ 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | flood.log 2 | container.log 3 | /resources/ 4 | /setup_scripts/ 5 | __pycache__/ 6 | .pytest_cache 7 | 8 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/koalaman/shellcheck-precommit 3 | rev: v0.10.0 4 | hooks: 5 | - id: shellcheck 6 | args: ["--severity=warning"] # Optionally only show errors and warnings 7 | 8 | -------------------------------------------------------------------------------- /CentOS5/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:5 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | ADD subman.repo /etc/yum.repos.d/ 5 | RUN install -Dv /dev/null /var/cache/yum/base/mirrorlist.txt && \ 6 | install -Dv /dev/null /var/cache/yum/extras/mirrorlist.txt && \ 7 | install -Dv /dev/null /var/cache/yum/updates/mirrorlist.txt && \ 8 | install -Dv /dev/null /var/cache/yum/libselinux/mirrorlist.txt 9 | RUN echo "http://vault.centos.org/5.11/os/x86_64/" > /var/cache/yum/base/mirrorlist.txt && \ 10 | echo "http://vault.centos.org/5.11/extras/x86_64/" > /var/cache/yum/extras/mirrorlist.txt && \ 11 | echo "http://vault.centos.org/5.11/updates/x86_64/" > /var/cache/yum/updates/mirrorlist.txt && \ 12 | echo "http://vault.centos.org/5.11/centosplus/x86_64/" > /var/cache/yum/libselinux/mirrorlist.txt 13 | RUN yum install -y subscription-manager 14 | 15 | ADD startup.sh /tmp/ 16 | RUN chmod +x /tmp/startup.sh 17 | 18 | EXPOSE 22 19 | 20 | CMD /tmp/startup.sh 21 | -------------------------------------------------------------------------------- /CentOS5/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | fi 14 | 15 | # Configure our registration auth, if provided 16 | if [ -n "$AUTH" ]; then 17 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 18 | AUTH="--username=$UNAME --password=$PWORD" 19 | else 20 | AUTH="--username=admin --password=changeme" 21 | fi 22 | 23 | # Set the organization to default, if not provided 24 | if [ -z "$ORG" ]; then 25 | ORG="Default_Organization" 26 | fi 27 | 28 | # Register to the sat if an activation key specified 29 | if [ -n "$AK" ]; then 30 | echo "Activation key $AK found. Registering..." 31 | subscription-manager register --org="$ORG" --activationkey="$AK" 32 | # If an environment is otherwise specified, use it 33 | elif [ -n "$ENV" ]; then 34 | echo "Environment $ENV found. Registering..." 35 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 36 | # If no specifics are provided, register to the library 37 | else 38 | echo "No registration details specified. Registering to $ORG and Library..." 39 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 40 | fi 41 | 42 | # Install katello agent 43 | yum -y install katello-agent 44 | 45 | # if the KILL arg was not passed, then keep the container running 46 | if [ -z "$KILL" ]; then 47 | echo "Tailing rhsm.log." 48 | tail -f /var/log/rhsm/rhsm.log 49 | fi 50 | -------------------------------------------------------------------------------- /CentOS5/subman.repo: -------------------------------------------------------------------------------- 1 | [subman] 2 | name=Subscription Manager 3 | baseurl=https://fedorapeople.org/groups/katello/releases/yum/2.2/client/RHEL/5/x86_64/ 4 | enabled=1 5 | gpgcheck=0 -------------------------------------------------------------------------------- /CentOS6/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:6 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | RUN yum install -y wget 5 | RUN wget https://copr.fedoraproject.org/coprs/dgoodwin/subscription-manager/repo/epel-6/dgoodwin-subscription-manager-epel-6.repo -O /etc/yum.repos.d/dgoodwin-subscription-manager-epel-6.repo 6 | RUN yum install -y subscription-manager 7 | 8 | ADD startup.sh /tmp/ 9 | RUN chmod +x /tmp/startup.sh 10 | 11 | EXPOSE 22 12 | 13 | CMD /tmp/startup.sh 14 | -------------------------------------------------------------------------------- /CentOS6/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | fi 14 | 15 | # Configure our registration auth, if provided 16 | if [ -n "$AUTH" ]; then 17 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 18 | AUTH="--username=$UNAME --password=$PWORD" 19 | else 20 | AUTH="--username=admin --password=changeme" 21 | fi 22 | 23 | # Set the organization to default, if not provided 24 | if [ -z "$ORG" ]; then 25 | ORG="Default_Organization" 26 | fi 27 | 28 | # Register to the sat if an activation key specified 29 | if [ -n "$AK" ]; then 30 | echo "Activation key $AK found. Registering..." 31 | subscription-manager register --org="$ORG" --activationkey="$AK" 32 | # If an environment is otherwise specified, use it 33 | elif [ -n "$ENV" ]; then 34 | echo "Environment $ENV found. Registering..." 35 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 36 | # If no specifics are provided, register to the library 37 | else 38 | echo "No registration details specified. Registering to $ORG and Library..." 39 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 40 | fi 41 | 42 | # Install katello agent 43 | yum -y install katello-agent 44 | 45 | # if the KILL arg was not passed, then keep the container running 46 | if [ -z "$KILL" ]; then 47 | echo "Tailing rhsm.log." 48 | tail -f /var/log/rhsm/rhsm.log 49 | fi 50 | -------------------------------------------------------------------------------- /CentOS7/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:7 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | RUN yum install -y subscription-manager 5 | 6 | ADD startup.sh /tmp/ 7 | RUN chmod +x /tmp/startup.sh 8 | 9 | EXPOSE 22 10 | 11 | CMD /tmp/startup.sh 12 | -------------------------------------------------------------------------------- /CentOS7/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | fi 14 | 15 | # Configure our registration auth, if provided 16 | if [ -n "$AUTH" ]; then 17 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 18 | AUTH="--username=$UNAME --password=$PWORD" 19 | else 20 | AUTH="--username=admin --password=changeme" 21 | fi 22 | 23 | # Set the organization to default, if not provided 24 | if [ -z "$ORG" ]; then 25 | ORG="Default_Organization" 26 | fi 27 | 28 | # Register to the sat if an activation key specified 29 | if [ -n "$AK" ]; then 30 | echo "Activation key $AK found. Registering..." 31 | subscription-manager register --org="$ORG" --activationkey="$AK" 32 | # If an environment is otherwise specified, use it 33 | elif [ -n "$ENV" ]; then 34 | echo "Environment $ENV found. Registering..." 35 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 36 | # If no specifics are provided, register to the library 37 | else 38 | echo "No registration details specified. Registering to $ORG and Library..." 39 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 40 | fi 41 | 42 | # Install katello agent 43 | yum -y install katello-agent 44 | 45 | # if the KILL arg was not passed, then keep the container running 46 | if [ -z "$KILL" ]; then 47 | echo "Starting goferd in foreground." 48 | goferd -f 49 | tail -f /var/log/rhsm/rhsm.log 50 | fi 51 | 52 | -------------------------------------------------------------------------------- /Fedora28/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM fedora:30 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | RUN dnf install -y subscription-manager openssh-server 5 | RUN sleep .1 ; printf "%s\n" "dog8code" "dog8code" | passwd 6 | RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config 7 | RUN sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config 8 | 9 | ADD startup.sh /tmp/ 10 | RUN chmod +x /tmp/startup.sh 11 | 12 | EXPOSE 22 13 | 14 | CMD /tmp/startup.sh 15 | -------------------------------------------------------------------------------- /Fedora28/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | curl --insecure --output katello-ca-consumer-latest.noarch.rpm https://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | dnf -y localinstall katello-ca-consumer-latest.noarch.rpm 14 | fi 15 | 16 | # Configure our registration auth, if provided 17 | if [ -n "$AUTH" ]; then 18 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 19 | AUTH="--username=$UNAME --password=$PWORD" 20 | else 21 | AUTH="--username=admin --password=changeme" 22 | fi 23 | 24 | # Set the organization to default, if not provided 25 | if [ -z "$ORG" ]; then 26 | ORG="Default_Organization" 27 | fi 28 | 29 | # Register to the sat if an activation key specified 30 | if [ -n "$AK" ]; then 31 | echo "Activation key $AK specified. Registering..." 32 | subscription-manager register --org="$ORG" --activationkey="$AK" 33 | # If an environment is otherwise specified, use it 34 | elif [ -n "$ENV" ]; then 35 | echo "Environment $ENV found. Registering..." 36 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 37 | # If no specifics are provided, register to the library 38 | else 39 | echo "No registration details specified. Registering to $ORG and Library..." 40 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 41 | fi 42 | 43 | # Install katello agent 44 | dnf -y install katello-host-tools 45 | 46 | # if the KILL arg was not passed, then keep the container running 47 | if [ -z "$KILL" ]; then 48 | echo "Setting up and starting sshd" 49 | ssh-keygen -A 50 | /usr/sbin/sshd 51 | echo "Tailing rhsm log." 52 | tail -f /var/log/rhsm/rhsm.log 53 | fi 54 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2022 Jacob Callahan 2 | 3 | Do what you want with this repo, but I'm not responsible. 4 | 5 | -------------------------------------------------------------------------------- /OpenSuse/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jacobcallahan/opensuse-host 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | ADD startup.sh /tmp/ 5 | ADD install-tools.sh /tmp/ 6 | RUN chmod +x /tmp/startup.sh 7 | 8 | EXPOSE 22 9 | 10 | CMD /tmp/startup.sh 11 | -------------------------------------------------------------------------------- /OpenSuse/install-tools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir host_tools 3 | # shellcheck disable=SC2164 4 | cd host_tools 5 | for pkg in "gofer-2.7.6-1.el7.noarch.rpm" \ 6 | "katello-client-repos-3.5.1-1.el7.noarch.rpm" \ 7 | "katello-client-repos-latest.rpm" \ 8 | "katello-host-tools-3.1.0-1.el7.noarch.rpm" \ 9 | "katello-host-tools-fact-plugin-3.1.0-1.el7.noarch.rpm" \ 10 | "pulp-rpm-handlers-2.13.4-1.el7.noarch.rpm" \ 11 | "python-amqp-1.4.9-1.el7.noarch.rpm" \ 12 | "python-gofer-2.7.6-1.el7.noarch.rpm" \ 13 | "python-gofer-amqp-2.7.6-1.el7.noarch.rpm" \ 14 | "python-gofer-proton-2.7.6-1.el7.noarch.rpm" \ 15 | "python-gofer-qpid-2.7.6-1.el7.noarch.rpm" \ 16 | "python-isodate-0.5.0-4.pulp.el7.noarch.rpm" \ 17 | "python-pulp-agent-lib-2.13.4-1.el7.noarch.rpm" \ 18 | "python-pulp-common-2.13.4-1.el7.noarch.rpm" \ 19 | "python-pulp-rpm-common-2.13.4-1.el7.noarch.rpm" \ 20 | "python-saslwrapper-0.22-5.el7.x86_64.rpm" \ 21 | "katello-agent-3.1.0-1.el7.noarch.rpm" \ 22 | "saslwrapper-0.22-5.el7.x86_64.rpm"; \ 23 | do wget https://fedorapeople.org/groups/katello/releases/yum/3.5/client/el7/x86_64/$pkg; done 24 | rpm -Uvh * --nodeps -------------------------------------------------------------------------------- /OpenSuse/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | wget http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | rpm -Uvh katello-ca-consumer-latest.noarch.rpm 14 | fi 15 | 16 | # Configure our registration auth, if provided 17 | if [ -n "$AUTH" ]; then 18 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 19 | AUTH="--username=$UNAME --password=$PWORD" 20 | else 21 | AUTH="--username=admin --password=changeme" 22 | fi 23 | 24 | # Set the organization to default, if not provided 25 | if [ -z "$ORG" ]; then 26 | ORG="Default_Organization" 27 | fi 28 | 29 | # Register to the sat if an activation key specified 30 | if [ -n "$AK" ]; then 31 | echo "Activation key $AK specified. Registering..." 32 | subscription-manager register --org="$ORG" --activationkey="$AK" 33 | # If an environment is otherwise specified, use it 34 | elif [ -n "$ENV" ]; then 35 | echo "Environment $ENV found. Registering..." 36 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 37 | # If no specifics are provided, register to the library 38 | else 39 | echo "No registration details specified. Registering to $ORG and Library..." 40 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 41 | fi 42 | 43 | # Install katello agent 44 | echo "Trying to install katello-agent" 45 | yum -y install katello-agent 46 | 47 | # if the KILL arg was not passed, then keep the container running 48 | if [ -z "$KILL" ]; then 49 | echo "Starting goferd in foreground." 50 | goferd -f 51 | tail -f /var/log/rhsm/rhsm.log 52 | fi 53 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # content-host-d 2 | A Docker-ized Centos Content Host for Red Hat Satellite 6 3 | 4 | Current automated tags are: centos5, centos6, centos7, sles11, sles12, opensuse 5 | 6 | Manual tags are: rhel6, rhel72, rhel7 7 | 8 | Installation 9 | ------------ 10 | ```docker pull jacobcallahan/content-host-d:``` 11 | 12 | or specify a directory and build the image manually 13 | 14 | ```docker build -t ch-d:sles11 SLES11/.``` 15 | 16 | Certain dockerfiles (currently only `UBI` and `RHEL6`) support including of additional files and setup scripts by adding them to 17 | their respective directories (`resources`, `setup_scripts`). The setup scripts are executed in alphabetical order 18 | so it is possible to control the execution order by naming them accordingly. 19 | 20 | Note: `resources/startup.sh` is reserved and it is used as the entrypoint. 21 | 22 | 23 | 24 | Usage 25 | ----- 26 | ```docker run jacobcallahan/content-host-d:``` 27 | 28 | Accepted Arguments 29 | ------------------ 30 | -e (e.g. ```-e "SATHOST=my.hostname.domain.com"```) 31 | * AK - Name of the Activation Key to use. 32 | * AUTH - Satellite user name and password. (AUTH=username/password) 33 | * ENV - Name of the Environment to use. 34 | * KILL - A flag to terminate the container. If not passed, the container is left alive and goferd running. 35 | * ORG - The label of the Organization to use. 36 | * SATHOST (Required) - Host name of the Satellite (FQDN not a URL). 37 | * LOCAL - IP Address of the Satellite Server when this cannot be retrievied using DNS. 38 | 39 | Note 40 | ---- 41 | If you want to be able to use katello-agent, you must mount your /dev/log to the container at runtime. (i.e. -v /dev/log:/dev/log) 42 | 43 | Examples 44 | -------- 45 | ```docker run -e "SATHOST=my.host.domain.com" jacobcallahan/content-host-d:5``` 46 | 47 | ```docker run -e "SATHOST=my.host.domain.com" -e "LOCAL=192.168.0.10" jacobcallahan/content-host-d:5``` 48 | 49 | ```docker run -e "SATHOST=my.host.domain.com" -e "ENV=Dev" -e "AUTH=username/password" jacobcallahan/content-host-d:6``` 50 | 51 | ```docker run -d -e "SATHOST=my.host.domain.com" -e "AK=sat62" -e "KILL=1" jacobcallahan/content-host-d:7``` 52 | 53 | ```docker run -h DockerCH -v /dev/log:/dev/log -d -e "SATHOST=my.host.domain.com" -e "AK=sat62" jacobcallahan/content-host-d:5``` 54 | 55 | ```for i in {1..10}; do docker run -d -e "SATHOST=my.host.domain.com" -e "AK=sat62" -e "KILL=1" jacobcallahan/content-host-d:6; done;``` 56 | 57 | ```for i in {1..10}; do docker run -d -h Docker$i -e "SATHOST=my.host.domain.com" -e "AK=sat62" jacobcallahan/content-host-d:7; done;``` 58 | 59 | Flood Script 60 | ------------ 61 | This repo also contains a flood.py helper script to orchestrate container creation and deletion. You will need python and docker-py (via pip) installed locally. 62 | 63 | See ```python flood.py -h``` for usage. 64 | 65 | There are two primary modes: 66 | - Traditional - Create normal content host containers. 67 | - Virt - Create fake hypervisors on the Satellite, then create guest container hosts. 68 | 69 | Ansible-playbook run 70 | -------------------- 71 | You can also use the available playbooks in `playbooks` folder of this project to setup a container host or run the flood.py script. 72 | 73 | Examples 74 | -------- 75 | container host setup 76 | 77 | ```sh 78 | ansible-playbook --inventory=containerhost.example.com, --extra-vars 'WORKSPACE=/home/testlab/workspace/content-host-d CONTAINER_OS=RHEL7' chd-setup.yaml 79 | ``` 80 | Run flood.py 81 | 82 | ```sh 83 | ansible-playbook --inventory=containerhost.example.com, --extra-vars 'SATELLITE_HOST=satellite.example.com CONTENT_HOST_PREFIX=testhost ACTIVATION_KEY=rhel7ak NUMBER_OF_HOSTS=3 EXIT_CRITERIA=registration CONTAINER_TAG=rhel7' chd-run.yaml 84 | ``` 85 | -------------------------------------------------------------------------------- /RHEL6-Puppet/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/rhel6.8 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 5 | 6 | ADD startup.sh /tmp 7 | RUN chmod +x /tmp/startup.sh 8 | 9 | EXPOSE 22 10 | 11 | CMD /tmp/startup.sh 12 | -------------------------------------------------------------------------------- /RHEL6-Puppet/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | fi 14 | 15 | # Configure our registration auth, if provided 16 | if [ -n "$AUTH" ]; then 17 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 18 | AUTH="--username=$UNAME --password=$PWORD" 19 | else 20 | AUTH="--username=admin --password=changeme" 21 | fi 22 | 23 | # Set the organization to default, if not provided 24 | if [ -z "$ORG" ]; then 25 | ORG="Default_Organization" 26 | fi 27 | 28 | # Register to the sat if an activation key specified 29 | if [ -n "$AK" ]; then 30 | echo "Activation key $AK provided. Registering..." 31 | subscription-manager register --org="$ORG" --activationkey="$AK" 32 | # If an environment is otherwise specified, use it 33 | elif [ -n "$ENV" ]; then 34 | echo "Environment $ENV found. Registering..." 35 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 36 | # If no specifics are provided, register to the library 37 | else 38 | echo "No registration details specified. Registering to $ORG and Library..." 39 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 40 | fi 41 | 42 | # Install puppet 43 | subscription-manager attach --auto 44 | yum clean all && yum repolist enabled 45 | yum -y install puppet 46 | service puppet reload 47 | sed -i "2i\ server = $SATHOST" /etc/puppet/puppet.conf 48 | echo " ca_server = $SATHOST" >> /etc/puppet/puppet.conf 49 | echo " server = $SATHOST" >> /etc/puppet/puppet.conf 50 | echo " environment = production" >> /etc/puppet/puppet.conf 51 | echo " pluginsync = true" >> /etc/puppet/puppet.conf 52 | echo " report = true" >> /etc/puppet/puppet.conf 53 | echo " ignoreschedules = true" >> /etc/puppet/puppet.conf 54 | echo " daemon = false" >> /etc/puppet/puppet.conf 55 | 56 | echo "Initial puppet registration" 57 | puppet agent -t --server $SATHOST 58 | echo "sleeping for 1 minute. make sure $(hostname) has a valid certificate" 59 | sleep 60 60 | echo "Second puppet registration" 61 | puppet agent -t --server $SATHOST 62 | 63 | # if the KILL arg was not passed, then keep the container running 64 | if [ -z "$KILL" ]; then 65 | echo "Starting fact flood." 66 | while true 67 | do 68 | echo "Updating facts..." 69 | puppet facts upload 70 | echo "sleeping" 71 | sleep 1 72 | done 73 | fi 74 | 75 | -------------------------------------------------------------------------------- /RHEL6/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/rhel6.10 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | LABEL broker_compatible="True" 4 | 5 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 6 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 7 | 8 | # add and process the external resources 9 | ADD resources/* /tmp/ 10 | ADD setup_scripts/* /tmp/setup_scripts/ 11 | 12 | WORKDIR /tmp 13 | RUN chmod +x *.sh setup_scripts/*.sh || true 14 | RUN for i in `ls setup_scripts/*.sh`; do bash $i; done 15 | WORKDIR /root 16 | 17 | EXPOSE 22 18 | 19 | CMD /tmp/startup.sh 20 | 21 | -------------------------------------------------------------------------------- /RHEL6/resources/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | fi 14 | 15 | # Configure our registration auth, if provided 16 | if [ -n "$AUTH" ]; then 17 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 18 | AUTH="--username=$UNAME --password=$PWORD" 19 | else 20 | AUTH="--username=admin --password=changeme" 21 | fi 22 | 23 | # Set the organization to default, if not provided 24 | if [ -z "$ORG" ]; then 25 | ORG="Default_Organization" 26 | fi 27 | 28 | # Register to the sat if an activation key specified 29 | if [ -n "$AK" ]; then 30 | echo "Activation key $AK found. Registering..." 31 | subscription-manager register --org="$ORG" --activationkey="$AK" 32 | # If an environment is otherwise specified, use it 33 | elif [ -n "$ENV" ]; then 34 | echo "Environment $ENV found. Registering..." 35 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 36 | # If no specifics are provided, register to the library 37 | else 38 | echo "No registration details specified. Registering to $ORG and Library..." 39 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 40 | fi 41 | 42 | # Install katello agent 43 | yum -y install katello-agent 44 | 45 | # if the KILL arg was not passed, then keep the container running 46 | if [ -z "$KILL" ]; then 47 | echo "Tailing rhsm.log." 48 | tail -f /var/log/rhsm/rhsm.log || tail -f /dev/null 49 | fi 50 | -------------------------------------------------------------------------------- /RHEL6/setup_scripts/placeholder: -------------------------------------------------------------------------------- 1 | Placeholder file so the `ADD setup_scripts/*` does not fail if the dir is empty. 2 | Workaround of https://github.com/moby/moby/issues/13045 -------------------------------------------------------------------------------- /RHEL7-Guest/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/rhel7.2 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 5 | ADD startup.sh /tmp/ 6 | RUN chmod +x /tmp/startup.sh 7 | ADD hostname-3.13-3.el7.x86_64.rpm /tmp/ 8 | RUN yum -y localinstall /tmp/hostname-3.13-3.el7.x86_64.rpm 9 | 10 | EXPOSE 22 11 | 12 | CMD /tmp/startup.sh 13 | -------------------------------------------------------------------------------- /RHEL7-Guest/hostname-3.13-3.el7.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JacobCallahan/content-host-d/e69726127110646b3066319b974837d3c4128153/RHEL7-Guest/hostname-3.13-3.el7.x86_64.rpm -------------------------------------------------------------------------------- /RHEL7-Guest/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add custom facts to fake being a virt-who guest 10 | if [ -n "$UUID" ]; then 11 | echo "Adding guest config with UUID: $UUID." 12 | echo "{\"virt.host_type\": \"vmware\", \"virt.uuid\": \"$UUID\", \"virt.is_guest\": \"True\"}" > /etc/rhsm/facts/guest.facts 13 | fi 14 | 15 | # Add the Satellite's cert 16 | if [ -n "$SATHOST" ]; then 17 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 18 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 19 | fi 20 | 21 | # Configure our registration auth, if provided 22 | if [ -n "$AUTH" ]; then 23 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 24 | AUTH="--username=$UNAME --password=$PWORD" 25 | else 26 | AUTH="--username=admin --password=changeme" 27 | fi 28 | 29 | # Set the organization to default, if not provided 30 | if [ -z "$ORG" ]; then 31 | ORG="Default_Organization" 32 | fi 33 | 34 | # Register to the sat if an activation key specified 35 | if [ -n "$AK" ]; then 36 | echo "Activation key $AK found. Registering..." 37 | subscription-manager register --org="$ORG" --activationkey="$AK" 38 | # If an environment is otherwise specified, use it 39 | elif [ -n "$ENV" ]; then 40 | echo "Environment $ENV found. Registering..." 41 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 42 | # If no specifics are provided, register to the library 43 | else 44 | echo "No registration details specified. Registering to $ORG and Library..." 45 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 46 | fi 47 | 48 | # If an activation key wasn't used, and we are a virt guest 49 | if [ -z "$AK" ] && [ -n "$UUID" ]; then 50 | echo "Attempting to auto-attach a subscription." 51 | subscription-manager attach --auto 52 | fi 53 | 54 | # Install katello agent 55 | yum -y install katello-agent 56 | 57 | # if the KILL arg was not passed, then keep the container running 58 | if [ -z "$KILL" ]; then 59 | echo "Starting goferd in foreground." 60 | goferd -f 61 | tail -f /var/log/rhsm/rhsm.log 62 | fi 63 | -------------------------------------------------------------------------------- /RHEL7-High-Traffic/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/rhel7.4 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 5 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 6 | ADD startup.sh /tmp/ 7 | RUN chmod +x /tmp/startup.sh 8 | ADD hostname-3.13-3.el7.x86_64.rpm /tmp/ 9 | RUN yum -y localinstall /tmp/hostname-3.13-3.el7.x86_64.rpm 10 | 11 | EXPOSE 22 12 | 13 | CMD /tmp/startup.sh 14 | -------------------------------------------------------------------------------- /RHEL7-High-Traffic/hostname-3.13-3.el7.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JacobCallahan/content-host-d/e69726127110646b3066319b974837d3c4128153/RHEL7-High-Traffic/hostname-3.13-3.el7.x86_64.rpm -------------------------------------------------------------------------------- /RHEL7-High-Traffic/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | fi 14 | 15 | # Configure our registration auth, if provided 16 | if [ -n "$AUTH" ]; then 17 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 18 | AUTH="--username=$UNAME --password=$PWORD" 19 | else 20 | AUTH="--username=admin --password=changeme" 21 | fi 22 | 23 | # Set the organization to default, if not provided 24 | if [ -z "$ORG" ]; then 25 | ORG="Default_Organization" 26 | fi 27 | 28 | # Register to the sat if an activation key specified 29 | if [ -n "$AK" ]; then 30 | echo "Activation key $AK specified. Registering..." 31 | subscription-manager register --org="$ORG" --activationkey="$AK" 32 | # If an environment is otherwise specified, use it 33 | elif [ -n "$ENV" ]; then 34 | echo "Environment $ENV found. Registering..." 35 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 36 | # If no specifics are provided, register to the library 37 | else 38 | echo "No registration details specified. Registering to $ORG and Library..." 39 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 40 | fi 41 | 42 | # Install katello host tools 43 | yum -y install katello-host-tools 44 | 45 | # if the KILL arg was not passed, then keep the container running 46 | if [ -z "$KILL" ]; then 47 | while true; 48 | do 49 | # This loop simulates typical traffic interactions that standard clients 50 | # often execute. Small numbers of containers can simulate traffic similar to 51 | # thousands of clients 52 | yum repolist 53 | subscription-manager refresh 54 | subscription-manager repos --disable rhel-7-server-satellite-tools-6.4-rpms 55 | subscription-manager repos --enable rhel-7-server-satellite-tools-6.4-rpms 56 | subscription-manager facts --update & 57 | katello-enabled-repos-upload -f 58 | katello-package-upload -f 59 | echo "**** Completed iteration." 60 | done 61 | fi 62 | -------------------------------------------------------------------------------- /RHEL7-Puppet/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/rhel7.4 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | # RUN sleep .1 ; printf "%s\n" "dog8code" "dog8code" | passwd 5 | # RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config 6 | # RUN sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config 7 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 8 | ADD startup.sh /tmp/ 9 | RUN chmod +x /tmp/startup.sh 10 | ADD hostname-3.13-3.el7.x86_64.rpm /tmp/ 11 | RUN yum -y localinstall /tmp/hostname-3.13-3.el7.x86_64.rpm 12 | 13 | EXPOSE 22 14 | 15 | CMD /tmp/startup.sh 16 | 17 | -------------------------------------------------------------------------------- /RHEL7-Puppet/hostname-3.13-3.el7.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JacobCallahan/content-host-d/e69726127110646b3066319b974837d3c4128153/RHEL7-Puppet/hostname-3.13-3.el7.x86_64.rpm -------------------------------------------------------------------------------- /RHEL7-Puppet/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | fi 14 | 15 | # Configure our registration auth, if provided 16 | if [ -n "$AUTH" ]; then 17 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 18 | AUTH="--username=$UNAME --password=$PWORD" 19 | else 20 | AUTH="--username=admin --password=changeme" 21 | fi 22 | 23 | # Set the organization to default, if not provided 24 | if [ -z "$ORG" ]; then 25 | ORG="Default_Organization" 26 | fi 27 | 28 | # Register to the sat if an activation key specified 29 | if [ -n "$AK" ]; then 30 | echo "Activation key $AK provided. Registering..." 31 | subscription-manager register --org="$ORG" --activationkey="$AK" 32 | # If an environment is otherwise specified, use it 33 | elif [ -n "$ENV" ]; then 34 | echo "Environment $ENV found. Registering..." 35 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 36 | # If no specifics are provided, register to the library 37 | else 38 | echo "No registration details specified. Registering to $ORG and Library..." 39 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 40 | fi 41 | 42 | # Install puppet 43 | subscription-manager attach --auto 44 | yum clean all && yum repolist enabled 45 | yum -y install puppet 46 | systemctl enable puppet 47 | sed -i "2i\ server = $SATHOST" /etc/puppet/puppet.conf 48 | echo " ca_server = $SATHOST" >> /etc/puppet/puppet.conf 49 | echo " server = $SATHOST" >> /etc/puppet/puppet.conf 50 | echo " environment = production" >> /etc/puppet/puppet.conf 51 | echo " pluginsync = true" >> /etc/puppet/puppet.conf 52 | echo " report = true" >> /etc/puppet/puppet.conf 53 | echo " ignoreschedules = true" >> /etc/puppet/puppet.conf 54 | echo " daemon = false" >> /etc/puppet/puppet.conf 55 | 56 | echo "10.19.34.24 yttrium.idmqe.lab.eng.bos.redhat.com yttrium" >> /etc/hosts 57 | 58 | echo "Initial puppet registration" 59 | puppet agent -t --server $SATHOST 60 | echo "sleeping for 1 minute. make sure $(hostname) has a valid certificate" 61 | sleep 60 62 | echo "Second puppet registration" 63 | puppet agent -t --server $SATHOST 64 | 65 | # if the KILL arg was not passed, then keep the container running 66 | if [ -z "$KILL" ]; then 67 | echo "Starting fact flood." 68 | while true 69 | do 70 | echo "Updating facts..." 71 | puppet facts upload 72 | echo "sleeping" 73 | sleep 1 74 | done 75 | fi 76 | 77 | -------------------------------------------------------------------------------- /RHEL7-RemoteExecution/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/rhel7.7 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | RUN yum install -y openssh-server 5 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 6 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 7 | ADD startup.sh /tmp/ 8 | RUN chmod +x /tmp/startup.sh 9 | ADD hostname-3.13-3.el7.x86_64.rpm /tmp/ 10 | RUN yum -y localinstall /tmp/hostname-3.13-3.el7.x86_64.rpm 11 | RUN /usr/bin/ssh-keygen -A 12 | 13 | EXPOSE 22 14 | 15 | CMD /tmp/startup.sh 16 | -------------------------------------------------------------------------------- /RHEL7-RemoteExecution/hostname-3.13-3.el7.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JacobCallahan/content-host-d/e69726127110646b3066319b974837d3c4128153/RHEL7-RemoteExecution/hostname-3.13-3.el7.x86_64.rpm -------------------------------------------------------------------------------- /RHEL7-RemoteExecution/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | mkdir .ssh 14 | curl https://$SATHOST:9090/ssh/pubkey >> ~/.ssh/authorized_keys 15 | fi 16 | 17 | # Configure our registration auth, if provided 18 | if [ -n "$AUTH" ]; then 19 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 20 | AUTH="--username=$UNAME --password=$PWORD" 21 | else 22 | AUTH="--username=admin --password=changeme" 23 | fi 24 | 25 | # Set the organization to default, if not provided 26 | if [ -z "$ORG" ]; then 27 | ORG="Default_Organization" 28 | fi 29 | 30 | # Register to the sat if an activation key specified 31 | if [ -n "$AK" ]; then 32 | echo "Activation key $AK specified. Registering..." 33 | subscription-manager register --org="$ORG" --activationkey="$AK" 34 | # If an environment is otherwise specified, use it 35 | elif [ -n "$ENV" ]; then 36 | echo "Environment $ENV found. Registering..." 37 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 38 | # If no specifics are provided, register to the library 39 | else 40 | echo "No registration details specified. Registering to $ORG and Library..." 41 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 42 | fi 43 | 44 | # Install katello agent 45 | yum -y install katello-agent 46 | 47 | # if the KILL arg was not passed, then keep the container running 48 | if [ -z "$KILL" ]; then 49 | /usr/sbin/sshd -D 50 | fi 51 | -------------------------------------------------------------------------------- /RHEL7/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/rhel7.7 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 5 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 6 | ADD startup.sh /tmp/ 7 | RUN chmod +x /tmp/startup.sh 8 | ADD hostname-3.13-3.el7.x86_64.rpm /tmp/ 9 | RUN yum -y localinstall /tmp/hostname-3.13-3.el7.x86_64.rpm 10 | 11 | EXPOSE 22 12 | 13 | CMD /tmp/startup.sh 14 | -------------------------------------------------------------------------------- /RHEL7/hostname-3.13-3.el7.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JacobCallahan/content-host-d/e69726127110646b3066319b974837d3c4128153/RHEL7/hostname-3.13-3.el7.x86_64.rpm -------------------------------------------------------------------------------- /RHEL7/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | fi 14 | 15 | # Configure our registration auth, if provided 16 | if [ -n "$AUTH" ]; then 17 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 18 | AUTH="--username=$UNAME --password=$PWORD" 19 | else 20 | AUTH="--username=admin --password=changeme" 21 | fi 22 | 23 | # Set the organization to default, if not provided 24 | if [ -z "$ORG" ]; then 25 | ORG="Default_Organization" 26 | fi 27 | 28 | # Register to the sat if an activation key specified 29 | if [ -n "$AK" ]; then 30 | echo "Activation key $AK specified. Registering..." 31 | subscription-manager register --org="$ORG" --activationkey="$AK" 32 | # If an environment is otherwise specified, use it 33 | elif [ -n "$ENV" ]; then 34 | echo "Environment $ENV found. Registering..." 35 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 36 | # If no specifics are provided, register to the library 37 | else 38 | echo "No registration details specified. Registering to $ORG and Library..." 39 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 40 | fi 41 | 42 | # Workaround for BZ#1958220 43 | subscription-manager attach --auto 44 | 45 | # Install katello agent 46 | yum -y install katello-agent 47 | 48 | # if the KILL arg was not passed, then keep the container running 49 | if [ -z "$KILL" ]; then 50 | echo "Tailing rhsm log." 51 | tail -f /var/log/rhsm/rhsm.log 52 | fi 53 | -------------------------------------------------------------------------------- /RHEL72/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/rhel7.2 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 5 | ADD startup.sh /tmp/ 6 | RUN chmod +x /tmp/startup.sh 7 | ADD hostname-3.13-3.el7.x86_64.rpm /tmp/ 8 | RUN yum -y localinstall /tmp/hostname-3.13-3.el7.x86_64.rpm 9 | 10 | EXPOSE 22 11 | 12 | CMD /tmp/startup.sh 13 | -------------------------------------------------------------------------------- /RHEL72/hostname-3.13-3.el7.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JacobCallahan/content-host-d/e69726127110646b3066319b974837d3c4128153/RHEL72/hostname-3.13-3.el7.x86_64.rpm -------------------------------------------------------------------------------- /RHEL72/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | fi 14 | 15 | # Configure our registration auth, if provided 16 | if [ -n "$AUTH" ]; then 17 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 18 | AUTH="--username=$UNAME --password=$PWORD" 19 | else 20 | AUTH="--username=admin --password=changeme" 21 | fi 22 | 23 | # Set the organization to default, if not provided 24 | if [ -z "$ORG" ]; then 25 | ORG="Default_Organization" 26 | fi 27 | 28 | # Register to the sat if an activation key specified 29 | if [ -n "$AK" ]; then 30 | echo "Activation key $AK found. Registering..." 31 | subscription-manager register --org="$ORG" --activationkey="$AK" 32 | # If an environment is otherwise specified, use it 33 | elif [ -n "$ENV" ]; then 34 | echo "Environment $ENV found. Registering..." 35 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 36 | # If no specifics are provided, register to the library 37 | else 38 | echo "No registration details specified. Registering to $ORG and Library..." 39 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 40 | fi 41 | 42 | # Install katello agent 43 | yum -y install katello-agent 44 | 45 | # if the KILL arg was not passed, then keep the container running 46 | if [ -z "$KILL" ]; then 47 | echo "Starting goferd in foreground." 48 | goferd -f 49 | tail -f /var/log/rhsm/rhsm.log 50 | fi 51 | -------------------------------------------------------------------------------- /RHEL8/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/ubi8 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 5 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 6 | RUN echo -e "\nexport LC_ALL=C\nexport LANG=C\n" >> .bashrc 7 | ADD startup.sh /tmp/ 8 | RUN chmod +x /tmp/startup.sh 9 | ADD hostname-3.20-6.el8.x86_64.rpm /tmp/ 10 | RUN yum -y localinstall /tmp/hostname-3.20-6.el8.x86_64.rpm 11 | 12 | EXPOSE 22 13 | 14 | CMD /tmp/startup.sh 15 | -------------------------------------------------------------------------------- /RHEL8/hostname-3.20-6.el8.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JacobCallahan/content-host-d/e69726127110646b3066319b974837d3c4128153/RHEL8/hostname-3.20-6.el8.x86_64.rpm -------------------------------------------------------------------------------- /RHEL8/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source /root/.bashrc 3 | 4 | # Adding the local entry on /etc/hosts 5 | if [ -n "$LOCAL" ]; then 6 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 7 | echo "$LOCAL $SATHOST" >>/etc/hosts 8 | fi 9 | 10 | # Add the Satellite's cert 11 | if [ -n "$SATHOST" ]; then 12 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 13 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 14 | fi 15 | 16 | # Configure our registration auth, if provided 17 | if [ -n "$AUTH" ]; then 18 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 19 | AUTH="--username=$UNAME --password=$PWORD" 20 | else 21 | AUTH="--username=admin --password=changeme" 22 | fi 23 | 24 | # Set the organization to default, if not provided 25 | if [ -z "$ORG" ]; then 26 | ORG="Default_Organization" 27 | fi 28 | 29 | # Register to the sat if an activation key specified 30 | if [ -n "$AK" ]; then 31 | echo "Activation key $AK specified. Registering..." 32 | subscription-manager register --org="$ORG" --activationkey="$AK" 33 | # If an environment is otherwise specified, use it 34 | elif [ -n "$ENV" ]; then 35 | echo "Environment $ENV found. Registering..." 36 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 37 | # If no specifics are provided, register to the library 38 | else 39 | echo "No registration details specified. Registering to $ORG and Library..." 40 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 41 | fi 42 | 43 | # Install katello agent 44 | yum -y install katello-agent 45 | 46 | # if the KILL arg was not passed, then keep the container running 47 | if [ -z "$KILL" ]; then 48 | echo "Tailing rhsm log." 49 | tail -f /var/log/rhsm/rhsm.log 50 | fi 51 | -------------------------------------------------------------------------------- /SLES11/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jacobcallahan/sles:11 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | ADD startup.sh /tmp/ 5 | ADD install-tools.sh /tmp/ 6 | RUN chmod +x /tmp/startup.sh 7 | 8 | EXPOSE 22 9 | 10 | CMD /tmp/startup.sh 11 | -------------------------------------------------------------------------------- /SLES11/install-tools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir host_tools 3 | # shellcheck disable=SC2164 4 | cd host_tools 5 | for pkg in "gofer-2.7.6-1.el7.noarch.rpm" \ 6 | "katello-client-repos-3.5.1-1.el7.noarch.rpm" \ 7 | "katello-client-repos-latest.rpm" \ 8 | "katello-host-tools-3.1.0-1.el7.noarch.rpm" \ 9 | "katello-host-tools-fact-plugin-3.1.0-1.el7.noarch.rpm" \ 10 | "pulp-rpm-handlers-2.13.4-1.el7.noarch.rpm" \ 11 | "python-amqp-1.4.9-1.el7.noarch.rpm" \ 12 | "python-gofer-2.7.6-1.el7.noarch.rpm" \ 13 | "python-gofer-amqp-2.7.6-1.el7.noarch.rpm" \ 14 | "python-gofer-proton-2.7.6-1.el7.noarch.rpm" \ 15 | "python-gofer-qpid-2.7.6-1.el7.noarch.rpm" \ 16 | "python-isodate-0.5.0-4.pulp.el7.noarch.rpm" \ 17 | "python-pulp-agent-lib-2.13.4-1.el7.noarch.rpm" \ 18 | "python-pulp-common-2.13.4-1.el7.noarch.rpm" \ 19 | "python-pulp-rpm-common-2.13.4-1.el7.noarch.rpm" \ 20 | "python-saslwrapper-0.22-5.el7.x86_64.rpm" \ 21 | "katello-agent-3.1.0-1.el7.noarch.rpm" \ 22 | "saslwrapper-0.22-5.el7.x86_64.rpm"; \ 23 | do wget https://fedorapeople.org/groups/katello/releases/yum/3.5/client/el7/x86_64/$pkg; done 24 | rpm -Uvh * --nodeps -------------------------------------------------------------------------------- /SLES11/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | wget http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | rpm -Uvh katello-ca-consumer-latest.noarch.rpm 14 | fi 15 | 16 | # Configure our registration auth, if provided 17 | if [ -n "$AUTH" ]; then 18 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 19 | AUTH="--username=$UNAME --password=$PWORD" 20 | else 21 | AUTH="--username=admin --password=changeme" 22 | fi 23 | 24 | # Set the organization to default, if not provided 25 | if [ -z "$ORG" ]; then 26 | ORG="Default_Organization" 27 | fi 28 | 29 | # Register to the sat if an activation key specified 30 | if [ -n "$AK" ]; then 31 | echo "Activation key $AK specified. Registering..." 32 | subscription-manager register --org="$ORG" --activationkey="$AK" 33 | # If an environment is otherwise specified, use it 34 | elif [ -n "$ENV" ]; then 35 | echo "Environment $ENV found. Registering..." 36 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 37 | # If no specifics are provided, register to the library 38 | else 39 | echo "No registration details specified. Registering to $ORG and Library..." 40 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 41 | fi 42 | 43 | # Install katello agent 44 | echo "Trying to install katello-agent" 45 | yum -y install katello-agent 46 | 47 | # if the KILL arg was not passed, then keep the container running 48 | if [ -z "$KILL" ]; then 49 | echo "Starting goferd in foreground." 50 | goferd -f 51 | tail -f /var/log/rhsm/rhsm.log 52 | fi 53 | -------------------------------------------------------------------------------- /SLES11sp4/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jacobcallahan/sles:11sp4 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 5 | ADD startup.sh /tmp/ 6 | ADD install-tools.sh /tmp/ 7 | RUN chmod +x /tmp/startup.sh 8 | 9 | EXPOSE 22 10 | 11 | CMD /tmp/startup.sh 12 | -------------------------------------------------------------------------------- /SLES11sp4/install-tools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir host_tools 3 | # shellcheck disable=SC2164 4 | cd host_tools 5 | for pkg in "gofer-2.7.6-1.el7.noarch.rpm" \ 6 | "katello-client-repos-3.5.1-1.el7.noarch.rpm" \ 7 | "katello-client-repos-latest.rpm" \ 8 | "katello-host-tools-3.1.0-1.el7.noarch.rpm" \ 9 | "katello-host-tools-fact-plugin-3.1.0-1.el7.noarch.rpm" \ 10 | "pulp-rpm-handlers-2.13.4-1.el7.noarch.rpm" \ 11 | "python-amqp-1.4.9-1.el7.noarch.rpm" \ 12 | "python-gofer-2.7.6-1.el7.noarch.rpm" \ 13 | "python-gofer-amqp-2.7.6-1.el7.noarch.rpm" \ 14 | "python-gofer-proton-2.7.6-1.el7.noarch.rpm" \ 15 | "python-gofer-qpid-2.7.6-1.el7.noarch.rpm" \ 16 | "python-isodate-0.5.0-4.pulp.el7.noarch.rpm" \ 17 | "python-pulp-agent-lib-2.13.4-1.el7.noarch.rpm" \ 18 | "python-pulp-common-2.13.4-1.el7.noarch.rpm" \ 19 | "python-pulp-rpm-common-2.13.4-1.el7.noarch.rpm" \ 20 | "python-saslwrapper-0.22-5.el7.x86_64.rpm" \ 21 | "katello-agent-3.1.0-1.el7.noarch.rpm" \ 22 | "saslwrapper-0.22-5.el7.x86_64.rpm"; \ 23 | do wget https://fedorapeople.org/groups/katello/releases/yum/3.5/client/el7/x86_64/$pkg; done 24 | rpm -Uvh * --nodeps -------------------------------------------------------------------------------- /SLES11sp4/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | curl --insecure --output katello-ca-consumer-latest.noarch.rpm http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | rpm -Uvh katello-ca-consumer-latest.noarch.rpm 14 | fi 15 | 16 | # Configure our registration auth, if provided 17 | if [ -n "$AUTH" ]; then 18 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 19 | AUTH="--username=$UNAME --password=$PWORD" 20 | else 21 | AUTH="--username=admin --password=changeme" 22 | fi 23 | 24 | # Set the organization to default, if not provided 25 | if [ -z "$ORG" ]; then 26 | ORG="Default_Organization" 27 | fi 28 | 29 | cp /var/lib/rhsm/kdf/* /etc/pki/product/. 30 | 31 | # Register to the sat if an activation key specified 32 | if [ -n "$AK" ]; then 33 | echo "Activation key $AK specified. Registering..." 34 | subscription-manager register --org="$ORG" --activationkey="$AK" 35 | # If an environment is otherwise specified, use it 36 | elif [ -n "$ENV" ]; then 37 | echo "Environment $ENV found. Registering..." 38 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 39 | # If no specifics are provided, register to the library 40 | else 41 | echo "No registration details specified. Registering to $ORG and Library..." 42 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 43 | fi 44 | 45 | # Install katello agent 46 | echo "Trying to install katello-host-tools" 47 | zypper --no-gpg-checks in -y katello-host-tools 48 | 49 | # if the KILL arg was not passed, then keep the container running 50 | if [ -z "$KILL" ]; then 51 | echo "Starting goferd in foreground." 52 | goferd -f 53 | tail -f /var/log/rhsm/rhsm.log 54 | fi 55 | -------------------------------------------------------------------------------- /SLES12/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jacobcallahan/sles:12 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | ADD startup.sh /tmp/ 5 | ADD install-tools.sh /tmp/ 6 | RUN chmod +x /tmp/startup.sh 7 | 8 | EXPOSE 22 9 | 10 | CMD /tmp/startup.sh 11 | -------------------------------------------------------------------------------- /SLES12/install-tools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir host_tools 3 | # shellcheck disable=SC2164 4 | cd host_tools 5 | for pkg in "gofer-2.7.6-1.el7.noarch.rpm" \ 6 | "katello-client-repos-3.5.1-1.el7.noarch.rpm" \ 7 | "katello-client-repos-latest.rpm" \ 8 | "katello-host-tools-3.1.0-1.el7.noarch.rpm" \ 9 | "katello-host-tools-fact-plugin-3.1.0-1.el7.noarch.rpm" \ 10 | "pulp-rpm-handlers-2.13.4-1.el7.noarch.rpm" \ 11 | "python-amqp-1.4.9-1.el7.noarch.rpm" \ 12 | "python-gofer-2.7.6-1.el7.noarch.rpm" \ 13 | "python-gofer-amqp-2.7.6-1.el7.noarch.rpm" \ 14 | "python-gofer-proton-2.7.6-1.el7.noarch.rpm" \ 15 | "python-gofer-qpid-2.7.6-1.el7.noarch.rpm" \ 16 | "python-isodate-0.5.0-4.pulp.el7.noarch.rpm" \ 17 | "python-pulp-agent-lib-2.13.4-1.el7.noarch.rpm" \ 18 | "python-pulp-common-2.13.4-1.el7.noarch.rpm" \ 19 | "python-pulp-rpm-common-2.13.4-1.el7.noarch.rpm" \ 20 | "python-saslwrapper-0.22-5.el7.x86_64.rpm" \ 21 | "katello-agent-3.1.0-1.el7.noarch.rpm" \ 22 | "saslwrapper-0.22-5.el7.x86_64.rpm"; \ 23 | do wget https://fedorapeople.org/groups/katello/releases/yum/3.5/client/el7/x86_64/$pkg; done 24 | rpm -Uvh * --nodeps -------------------------------------------------------------------------------- /SLES12/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | curl --insecure --output katello-ca-consumer-latest.noarch.rpm http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | rpm -Uvh katello-ca-consumer-latest.noarch.rpm 14 | fi 15 | 16 | # Configure our registration auth, if provided 17 | if [ -n "$AUTH" ]; then 18 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 19 | AUTH="--username=$UNAME --password=$PWORD" 20 | else 21 | AUTH="--username=admin --password=changeme" 22 | fi 23 | 24 | # Set the organization to default, if not provided 25 | if [ -z "$ORG" ]; then 26 | ORG="Default_Organization" 27 | fi 28 | 29 | # Register to the sat if an activation key specified 30 | if [ -n "$AK" ]; then 31 | echo "Activation key $AK specified. Registering..." 32 | subscription-manager register --org="$ORG" --activationkey="$AK" 33 | # If an environment is otherwise specified, use it 34 | elif [ -n "$ENV" ]; then 35 | echo "Environment $ENV found. Registering..." 36 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 37 | # If no specifics are provided, register to the library 38 | else 39 | echo "No registration details specified. Registering to $ORG and Library..." 40 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 41 | fi 42 | 43 | # Install katello agent 44 | echo "Trying to install katello-host-tools" 45 | zypper --no-gpg-checks --auto-agree-with-licenses in -y katello-host-tools 46 | 47 | # if the KILL arg was not passed, then keep the container running 48 | if [ -z "$KILL" ]; then 49 | echo "Starting goferd in foreground." 50 | goferd -f 51 | tail -f /var/log/rhsm/rhsm.log 52 | fi 53 | -------------------------------------------------------------------------------- /SLES12sp3/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jacobcallahan/sles:12sp3 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 5 | ADD startup.sh /tmp/ 6 | ADD install-tools.sh /tmp/ 7 | RUN chmod +x /tmp/startup.sh 8 | 9 | EXPOSE 22 10 | 11 | CMD /tmp/startup.sh 12 | -------------------------------------------------------------------------------- /SLES12sp3/install-tools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir host_tools 3 | # shellcheck disable=SC2164 4 | cd host_tools 5 | for pkg in "gofer-2.7.6-1.el7.noarch.rpm" \ 6 | "katello-client-repos-3.5.1-1.el7.noarch.rpm" \ 7 | "katello-client-repos-latest.rpm" \ 8 | "katello-host-tools-3.1.0-1.el7.noarch.rpm" \ 9 | "katello-host-tools-fact-plugin-3.1.0-1.el7.noarch.rpm" \ 10 | "pulp-rpm-handlers-2.13.4-1.el7.noarch.rpm" \ 11 | "python-amqp-1.4.9-1.el7.noarch.rpm" \ 12 | "python-gofer-2.7.6-1.el7.noarch.rpm" \ 13 | "python-gofer-amqp-2.7.6-1.el7.noarch.rpm" \ 14 | "python-gofer-proton-2.7.6-1.el7.noarch.rpm" \ 15 | "python-gofer-qpid-2.7.6-1.el7.noarch.rpm" \ 16 | "python-isodate-0.5.0-4.pulp.el7.noarch.rpm" \ 17 | "python-pulp-agent-lib-2.13.4-1.el7.noarch.rpm" \ 18 | "python-pulp-common-2.13.4-1.el7.noarch.rpm" \ 19 | "python-pulp-rpm-common-2.13.4-1.el7.noarch.rpm" \ 20 | "python-saslwrapper-0.22-5.el7.x86_64.rpm" \ 21 | "katello-agent-3.1.0-1.el7.noarch.rpm" \ 22 | "saslwrapper-0.22-5.el7.x86_64.rpm"; \ 23 | do wget https://fedorapeople.org/groups/katello/releases/yum/3.5/client/el7/x86_64/$pkg; done 24 | rpm -Uvh * --nodeps -------------------------------------------------------------------------------- /SLES12sp3/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | curl --insecure --output katello-ca-consumer-latest.noarch.rpm http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | rpm -Uvh katello-ca-consumer-latest.noarch.rpm 14 | fi 15 | 16 | # Configure our registration auth, if provided 17 | if [ -n "$AUTH" ]; then 18 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 19 | AUTH="--username=$UNAME --password=$PWORD" 20 | else 21 | AUTH="--username=admin --password=changeme" 22 | fi 23 | 24 | # Set the organization to default, if not provided 25 | if [ -z "$ORG" ]; then 26 | ORG="Default_Organization" 27 | fi 28 | 29 | cp /var/lib/rhsm/kdf/* /etc/pki/product/. 30 | 31 | # Register to the sat if an activation key specified 32 | if [ -n "$AK" ]; then 33 | echo "Activation key $AK specified. Registering..." 34 | subscription-manager register --org="$ORG" --activationkey="$AK" 35 | # If an environment is otherwise specified, use it 36 | elif [ -n "$ENV" ]; then 37 | echo "Environment $ENV found. Registering..." 38 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 39 | # If no specifics are provided, register to the library 40 | else 41 | echo "No registration details specified. Registering to $ORG and Library..." 42 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 43 | fi 44 | 45 | # Install katello agent 46 | echo "Trying to install katello-host-tools" 47 | zypper --no-gpg-checks in -y katello-host-tools 48 | 49 | # if the KILL arg was not passed, then keep the container running 50 | if [ -z "$KILL" ]; then 51 | echo "Starting goferd in foreground." 52 | goferd -f 53 | tail -f /var/log/rhsm/rhsm.log 54 | fi 55 | -------------------------------------------------------------------------------- /SLES12sp4/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jacobcallahan/sles:12sp4 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 5 | ADD startup.sh /tmp/ 6 | ADD install-tools.sh /tmp/ 7 | RUN chmod +x /tmp/startup.sh 8 | 9 | EXPOSE 22 10 | 11 | CMD /tmp/startup.sh 12 | -------------------------------------------------------------------------------- /SLES12sp4/install-tools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir host_tools 3 | # shellcheck disable=SC2164 4 | cd host_tools 5 | for pkg in "gofer-2.7.6-1.el7.noarch.rpm" \ 6 | "katello-client-repos-3.5.1-1.el7.noarch.rpm" \ 7 | "katello-client-repos-latest.rpm" \ 8 | "katello-host-tools-3.1.0-1.el7.noarch.rpm" \ 9 | "katello-host-tools-fact-plugin-3.1.0-1.el7.noarch.rpm" \ 10 | "pulp-rpm-handlers-2.13.4-1.el7.noarch.rpm" \ 11 | "python-amqp-1.4.9-1.el7.noarch.rpm" \ 12 | "python-gofer-2.7.6-1.el7.noarch.rpm" \ 13 | "python-gofer-amqp-2.7.6-1.el7.noarch.rpm" \ 14 | "python-gofer-proton-2.7.6-1.el7.noarch.rpm" \ 15 | "python-gofer-qpid-2.7.6-1.el7.noarch.rpm" \ 16 | "python-isodate-0.5.0-4.pulp.el7.noarch.rpm" \ 17 | "python-pulp-agent-lib-2.13.4-1.el7.noarch.rpm" \ 18 | "python-pulp-common-2.13.4-1.el7.noarch.rpm" \ 19 | "python-pulp-rpm-common-2.13.4-1.el7.noarch.rpm" \ 20 | "python-saslwrapper-0.22-5.el7.x86_64.rpm" \ 21 | "katello-agent-3.1.0-1.el7.noarch.rpm" \ 22 | "saslwrapper-0.22-5.el7.x86_64.rpm"; \ 23 | do wget https://fedorapeople.org/groups/katello/releases/yum/3.5/client/el7/x86_64/$pkg; done 24 | rpm -Uvh * --nodeps -------------------------------------------------------------------------------- /SLES12sp4/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | curl --insecure --output katello-ca-consumer-latest.noarch.rpm http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | rpm -Uvh katello-ca-consumer-latest.noarch.rpm 14 | fi 15 | 16 | # Configure our registration auth, if provided 17 | if [ -n "$AUTH" ]; then 18 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 19 | AUTH="--username=$UNAME --password=$PWORD" 20 | else 21 | AUTH="--username=admin --password=changeme" 22 | fi 23 | 24 | # Set the organization to default, if not provided 25 | if [ -z "$ORG" ]; then 26 | ORG="Default_Organization" 27 | fi 28 | 29 | cp /var/lib/rhsm/kdf/* /etc/pki/product/. 30 | 31 | # Register to the sat if an activation key specified 32 | if [ -n "$AK" ]; then 33 | echo "Activation key $AK specified. Registering..." 34 | subscription-manager register --org="$ORG" --activationkey="$AK" 35 | # If an environment is otherwise specified, use it 36 | elif [ -n "$ENV" ]; then 37 | echo "Environment $ENV found. Registering..." 38 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 39 | # If no specifics are provided, register to the library 40 | else 41 | echo "No registration details specified. Registering to $ORG and Library..." 42 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 43 | fi 44 | 45 | # Install katello agent 46 | echo "Trying to install katello-host-tools" 47 | zypper --no-gpg-checks in -y katello-host-tools 48 | 49 | # if the KILL arg was not passed, then keep the container running 50 | if [ -z "$KILL" ]; then 51 | echo "Starting goferd in foreground." 52 | goferd -f 53 | tail -f /var/log/rhsm/rhsm.log 54 | fi 55 | -------------------------------------------------------------------------------- /SLES15sp1/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jacobcallahan/sles:15sp1 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | 4 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 5 | ADD startup.sh /tmp/ 6 | ADD install-tools.sh /tmp/ 7 | RUN chmod +x /tmp/startup.sh 8 | 9 | EXPOSE 22 10 | 11 | CMD /tmp/startup.sh 12 | -------------------------------------------------------------------------------- /SLES15sp1/install-tools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir host_tools 3 | # shellcheck disable=SC2164 4 | cd host_tools 5 | for pkg in "gofer-2.7.6-1.el7.noarch.rpm" \ 6 | "katello-client-repos-3.5.1-1.el7.noarch.rpm" \ 7 | "katello-client-repos-latest.rpm" \ 8 | "katello-host-tools-3.1.0-1.el7.noarch.rpm" \ 9 | "katello-host-tools-fact-plugin-3.1.0-1.el7.noarch.rpm" \ 10 | "pulp-rpm-handlers-2.13.4-1.el7.noarch.rpm" \ 11 | "python-amqp-1.4.9-1.el7.noarch.rpm" \ 12 | "python-gofer-2.7.6-1.el7.noarch.rpm" \ 13 | "python-gofer-amqp-2.7.6-1.el7.noarch.rpm" \ 14 | "python-gofer-proton-2.7.6-1.el7.noarch.rpm" \ 15 | "python-gofer-qpid-2.7.6-1.el7.noarch.rpm" \ 16 | "python-isodate-0.5.0-4.pulp.el7.noarch.rpm" \ 17 | "python-pulp-agent-lib-2.13.4-1.el7.noarch.rpm" \ 18 | "python-pulp-common-2.13.4-1.el7.noarch.rpm" \ 19 | "python-pulp-rpm-common-2.13.4-1.el7.noarch.rpm" \ 20 | "python-saslwrapper-0.22-5.el7.x86_64.rpm" \ 21 | "katello-agent-3.1.0-1.el7.noarch.rpm" \ 22 | "saslwrapper-0.22-5.el7.x86_64.rpm"; \ 23 | do wget https://fedorapeople.org/groups/katello/releases/yum/3.5/client/el7/x86_64/$pkg; done 24 | rpm -Uvh * --nodeps -------------------------------------------------------------------------------- /SLES15sp1/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | curl --insecure --output katello-ca-consumer-latest.noarch.rpm http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | rpm -Uvh katello-ca-consumer-latest.noarch.rpm 14 | fi 15 | 16 | # Configure our registration auth, if provided 17 | if [ -n "$AUTH" ]; then 18 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 19 | AUTH="--username=$UNAME --password=$PWORD" 20 | else 21 | AUTH="--username=admin --password=changeme" 22 | fi 23 | 24 | # Set the organization to default, if not provided 25 | if [ -z "$ORG" ]; then 26 | ORG="Default_Organization" 27 | fi 28 | 29 | cp /var/lib/rhsm/kdf/* /etc/pki/product/. 30 | 31 | # Register to the sat if an activation key specified 32 | if [ -n "$AK" ]; then 33 | echo "Activation key $AK specified. Registering..." 34 | subscription-manager register --org="$ORG" --activationkey="$AK" 35 | # If an environment is otherwise specified, use it 36 | elif [ -n "$ENV" ]; then 37 | echo "Environment $ENV found. Registering..." 38 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 39 | # If no specifics are provided, register to the library 40 | else 41 | echo "No registration details specified. Registering to $ORG and Library..." 42 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 43 | fi 44 | 45 | # Install katello agent 46 | echo "Trying to install katello-host-tools" 47 | zypper --no-gpg-checks in -y katello-host-tools 48 | 49 | # if the KILL arg was not passed, then keep the container running 50 | if [ -z "$KILL" ]; then 51 | echo "Starting goferd in foreground." 52 | goferd -f 53 | tail -f /var/log/rhsm/rhsm.log 54 | fi 55 | -------------------------------------------------------------------------------- /UBI10-init/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/ubi10-init 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | LABEL broker_compatible="True" 4 | 5 | ENV INIT_ENABLED=1 6 | 7 | # set root password 8 | ARG ROOT_PASSWD=change-me 9 | RUN echo "root:${ROOT_PASSWD:-default}" | chpasswd 10 | 11 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 12 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 13 | 14 | # add and process the external resources 15 | ADD resources/* /tmp/ 16 | ADD setup_scripts/* /tmp/setup_scripts/ 17 | 18 | WORKDIR /tmp 19 | RUN chmod +x setup_scripts/*.sh 20 | RUN for i in `ls setup_scripts/*.sh`; do bash $i; done 21 | WORKDIR /root 22 | 23 | RUN sed -i 's/enabled = 1/enabled = 0/g' /etc/yum.repos.d/ubi.repo 24 | RUN dnf clean all 25 | 26 | EXPOSE 22 27 | 28 | -------------------------------------------------------------------------------- /UBI10-init/resources/hostname-3.23-14.el10.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JacobCallahan/content-host-d/e69726127110646b3066319b974837d3c4128153/UBI10-init/resources/hostname-3.23-14.el10.x86_64.rpm -------------------------------------------------------------------------------- /UBI10-init/setup_scripts/00_hostname.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | yum -y localinstall hostname-3.23-14.el10.x86_64.rpm 4 | -------------------------------------------------------------------------------- /UBI10-init/setup_scripts/01_sshd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | dnf -y install openssh-server 3 | mkdir -p /etc/ssh/sshd_config.d 4 | cat <> /etc/ssh/sshd_config.d/99-redhat.conf 5 | PermitRootLogin yes 6 | 7 | EOT 8 | systemctl enable sshd 9 | 10 | -------------------------------------------------------------------------------- /UBI10/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/ubi10/ubi 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | LABEL broker_compatible="True" 4 | 5 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 6 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 7 | 8 | # add and process the external resources 9 | ADD resources/* /tmp/ 10 | ADD setup_scripts/* /tmp/setup_scripts/ 11 | 12 | WORKDIR /tmp 13 | RUN chmod +x *.sh setup_scripts/*.sh 14 | RUN for i in `ls setup_scripts/*.sh`; do bash $i; done 15 | WORKDIR /root 16 | 17 | RUN sed -i 's/enabled = 1/enabled = 0/g' /etc/yum.repos.d/ubi.repo 18 | RUN dnf clean all 19 | 20 | EXPOSE 22 21 | 22 | CMD /tmp/startup.sh 23 | -------------------------------------------------------------------------------- /UBI10/resources/hostname-3.23-14.el10.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JacobCallahan/content-host-d/e69726127110646b3066319b974837d3c4128153/UBI10/resources/hostname-3.23-14.el10.x86_64.rpm -------------------------------------------------------------------------------- /UBI10/resources/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | fi 14 | 15 | # Configure our registration auth, if provided 16 | if [ -n "$AUTH" ]; then 17 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 18 | AUTH="--username=$UNAME --password=$PWORD" 19 | else 20 | AUTH="--username=admin --password=changeme" 21 | fi 22 | 23 | # Set the organization to default, if not provided 24 | if [ -z "$ORG" ]; then 25 | ORG="Default_Organization" 26 | fi 27 | 28 | # Register to the sat if an activation key specified 29 | if [ -n "$AK" ]; then 30 | echo "Activation key $AK specified. Registering..." 31 | subscription-manager register --org="$ORG" --activationkey="$AK" 32 | # If an environment is otherwise specified, use it 33 | elif [ -n "$ENV" ]; then 34 | echo "Environment $ENV found. Registering..." 35 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 36 | # If no specifics are provided, register to the library 37 | else 38 | echo "No registration details specified. Registering to $ORG and Library..." 39 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 40 | fi 41 | 42 | # Install katello agent 43 | yum -y install katello-agent 44 | 45 | # if the KILL arg was not passed, then keep the container running 46 | if [ -z "$KILL" ]; then 47 | tail -f /var/log/messages || tail -f /dev/null 48 | fi 49 | -------------------------------------------------------------------------------- /UBI10/setup_scripts/00_hostname.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | yum -y localinstall hostname-3.23-14.el10.x86_64.rpm 4 | -------------------------------------------------------------------------------- /UBI7-init/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/ubi7-init 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | LABEL broker_compatible="True" 4 | 5 | ENV INIT_ENABLED=1 6 | 7 | # set root password 8 | ARG ROOT_PASSWD=change-me 9 | RUN echo "root:${ROOT_PASSWD:-default}" | chpasswd 10 | 11 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 12 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 13 | 14 | # add and process the external resources 15 | ADD resources/* /tmp/ 16 | ADD setup_scripts/* /tmp/setup_scripts/ 17 | 18 | WORKDIR /tmp 19 | RUN chmod +x setup_scripts/*.sh 20 | RUN for i in `ls setup_scripts/*.sh`; do bash $i; done 21 | WORKDIR /root 22 | 23 | RUN sed -i 's/enabled = 1/enabled = 0/g' /etc/yum.repos.d/ubi.repo 24 | RUN yum clean all || true 25 | 26 | EXPOSE 22 27 | 28 | -------------------------------------------------------------------------------- /UBI7-init/resources/hostname-3.13-3.el7.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JacobCallahan/content-host-d/e69726127110646b3066319b974837d3c4128153/UBI7-init/resources/hostname-3.13-3.el7.x86_64.rpm -------------------------------------------------------------------------------- /UBI7-init/setup_scripts/00_hostname.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | yum -y localinstall hostname-3.13-3.el7.x86_64.rpm 4 | -------------------------------------------------------------------------------- /UBI7-init/setup_scripts/01_sshd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | yum -y install openssh-server 3 | mkdir -p /etc/ssh/sshd_config.d 4 | cat <> /etc/ssh/sshd_config.d/99-redhat.conf 5 | PermitRootLogin yes 6 | 7 | EOT 8 | systemctl enable sshd 9 | 10 | -------------------------------------------------------------------------------- /UBI7/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/ubi7/ubi 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | LABEL broker_compatible="True" 4 | 5 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 6 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 7 | 8 | # add and process the external resources 9 | ADD resources/* /tmp/ 10 | ADD setup_scripts/* /tmp/setup_scripts/ 11 | 12 | WORKDIR /tmp 13 | RUN chmod +x *.sh setup_scripts/*.sh 14 | RUN for i in `ls setup_scripts/*.sh`; do bash $i; done 15 | WORKDIR /root 16 | 17 | RUN sed -i 's/enabled = 1/enabled = 0/g' /etc/yum.repos.d/ubi.repo 18 | RUN yum clean all || true 19 | 20 | EXPOSE 22 21 | 22 | CMD /tmp/startup.sh 23 | -------------------------------------------------------------------------------- /UBI7/resources/hostname-3.13-3.el7.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JacobCallahan/content-host-d/e69726127110646b3066319b974837d3c4128153/UBI7/resources/hostname-3.13-3.el7.x86_64.rpm -------------------------------------------------------------------------------- /UBI7/resources/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | fi 14 | 15 | # Configure our registration auth, if provided 16 | if [ -n "$AUTH" ]; then 17 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 18 | AUTH="--username=$UNAME --password=$PWORD" 19 | else 20 | AUTH="--username=admin --password=changeme" 21 | fi 22 | 23 | # Set the organization to default, if not provided 24 | if [ -z "$ORG" ]; then 25 | ORG="Default_Organization" 26 | fi 27 | 28 | # Register to the sat if an activation key specified 29 | if [ -n "$AK" ]; then 30 | echo "Activation key $AK specified. Registering..." 31 | subscription-manager register --org="$ORG" --activationkey="$AK" 32 | # If an environment is otherwise specified, use it 33 | elif [ -n "$ENV" ]; then 34 | echo "Environment $ENV found. Registering..." 35 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 36 | # If no specifics are provided, register to the library 37 | else 38 | echo "No registration details specified. Registering to $ORG and Library..." 39 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 40 | fi 41 | 42 | # Install katello agent 43 | yum -y install katello-agent 44 | 45 | # if the KILL arg was not passed, then keep the container running 46 | if [ -z "$KILL" ]; then 47 | tail -f /var/log/messages || tail -f /dev/null 48 | fi 49 | -------------------------------------------------------------------------------- /UBI7/setup_scripts/00_hostname.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | yum -y localinstall hostname-3.13-3.el7.x86_64.rpm 4 | -------------------------------------------------------------------------------- /UBI8-init/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/ubi8-init 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | LABEL broker_compatible="True" 4 | 5 | ENV INIT_ENABLED=1 6 | 7 | # set root password 8 | ARG ROOT_PASSWD=change-me 9 | RUN echo "root:${ROOT_PASSWD:-default}" | chpasswd 10 | 11 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 12 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 13 | 14 | # add and process the external resources 15 | ADD resources/* /tmp/ 16 | ADD setup_scripts/* /tmp/setup_scripts/ 17 | 18 | WORKDIR /tmp 19 | RUN chmod +x setup_scripts/*.sh 20 | RUN for i in `ls setup_scripts/*.sh`; do bash $i; done 21 | WORKDIR /root 22 | 23 | RUN sed -i 's/enabled = 1/enabled = 0/g' /etc/yum.repos.d/ubi.repo 24 | RUN dnf clean all 25 | 26 | EXPOSE 22 27 | 28 | -------------------------------------------------------------------------------- /UBI8-init/resources/hostname-3.20-6.el8.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JacobCallahan/content-host-d/e69726127110646b3066319b974837d3c4128153/UBI8-init/resources/hostname-3.20-6.el8.x86_64.rpm -------------------------------------------------------------------------------- /UBI8-init/setup_scripts/00_hostname.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | yum -y localinstall hostname-3.20-6.el8.x86_64.rpm 4 | -------------------------------------------------------------------------------- /UBI8-init/setup_scripts/01_sshd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | dnf -y install openssh-server 3 | mkdir -p /etc/ssh/sshd_config.d 4 | cat <> /etc/ssh/sshd_config.d/99-redhat.conf 5 | PermitRootLogin yes 6 | 7 | EOT 8 | systemctl enable sshd 9 | 10 | -------------------------------------------------------------------------------- /UBI8/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/ubi8/ubi 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | LABEL broker_compatible="True" 4 | 5 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 6 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 7 | 8 | # add and process the external resources 9 | ADD resources/* /tmp/ 10 | ADD setup_scripts/* /tmp/setup_scripts/ 11 | 12 | WORKDIR /tmp 13 | RUN chmod +x *.sh setup_scripts/*.sh 14 | RUN for i in `ls setup_scripts/*.sh`; do bash $i; done 15 | WORKDIR /root 16 | 17 | RUN sed -i 's/enabled = 1/enabled = 0/g' /etc/yum.repos.d/ubi.repo 18 | RUN dnf clean all 19 | 20 | EXPOSE 22 21 | 22 | CMD /tmp/startup.sh 23 | -------------------------------------------------------------------------------- /UBI8/resources/hostname-3.20-6.el8.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JacobCallahan/content-host-d/e69726127110646b3066319b974837d3c4128153/UBI8/resources/hostname-3.20-6.el8.x86_64.rpm -------------------------------------------------------------------------------- /UBI8/resources/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | fi 14 | 15 | # Configure our registration auth, if provided 16 | if [ -n "$AUTH" ]; then 17 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 18 | AUTH="--username=$UNAME --password=$PWORD" 19 | else 20 | AUTH="--username=admin --password=changeme" 21 | fi 22 | 23 | # Set the organization to default, if not provided 24 | if [ -z "$ORG" ]; then 25 | ORG="Default_Organization" 26 | fi 27 | 28 | # Register to the sat if an activation key specified 29 | if [ -n "$AK" ]; then 30 | echo "Activation key $AK specified. Registering..." 31 | subscription-manager register --org="$ORG" --activationkey="$AK" 32 | # If an environment is otherwise specified, use it 33 | elif [ -n "$ENV" ]; then 34 | echo "Environment $ENV found. Registering..." 35 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 36 | # If no specifics are provided, register to the library 37 | else 38 | echo "No registration details specified. Registering to $ORG and Library..." 39 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 40 | fi 41 | 42 | # Install katello agent 43 | yum -y install katello-agent 44 | 45 | # if the KILL arg was not passed, then keep the container running 46 | if [ -z "$KILL" ]; then 47 | tail -f /var/log/messages || tail -f /dev/null 48 | fi 49 | -------------------------------------------------------------------------------- /UBI8/setup_scripts/00_hostname.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | yum -y localinstall hostname-3.20-6.el8.x86_64.rpm 4 | -------------------------------------------------------------------------------- /UBI9-init/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/ubi9-init 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | LABEL broker_compatible="True" 4 | 5 | ENV INIT_ENABLED=1 6 | 7 | # set root password 8 | ARG ROOT_PASSWD=change-me 9 | RUN echo "root:${ROOT_PASSWD:-default}" | chpasswd 10 | 11 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 12 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 13 | 14 | # add and process the external resources 15 | ADD resources/* /tmp/ 16 | ADD setup_scripts/* /tmp/setup_scripts/ 17 | 18 | WORKDIR /tmp 19 | RUN chmod +x setup_scripts/*.sh 20 | RUN for i in `ls setup_scripts/*.sh`; do bash $i; done 21 | WORKDIR /root 22 | 23 | RUN sed -i 's/enabled = 1/enabled = 0/g' /etc/yum.repos.d/ubi.repo 24 | RUN dnf clean all 25 | 26 | EXPOSE 22 27 | 28 | -------------------------------------------------------------------------------- /UBI9-init/resources/hostname-3.23-6.el9.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JacobCallahan/content-host-d/e69726127110646b3066319b974837d3c4128153/UBI9-init/resources/hostname-3.23-6.el9.x86_64.rpm -------------------------------------------------------------------------------- /UBI9-init/setup_scripts/00_hostname.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | yum -y localinstall hostname-3.23-6.el9.x86_64.rpm 4 | -------------------------------------------------------------------------------- /UBI9-init/setup_scripts/01_sshd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | dnf -y install openssh-server 3 | mkdir -p /etc/ssh/sshd_config.d 4 | cat <> /etc/ssh/sshd_config.d/99-redhat.conf 5 | PermitRootLogin yes 6 | 7 | EOT 8 | systemctl enable sshd 9 | 10 | -------------------------------------------------------------------------------- /UBI9/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/ubi9/ubi 2 | LABEL org.opencontainers.image.authors="https://github.com/JacobCallahan" 3 | LABEL broker_compatible="True" 4 | 5 | RUN rm -f /etc/rhsm-host /etc/pki/entitlement-host 6 | RUN echo "{\"virt.host_type\": \"Not Applicable\", \"virt.is_guest\": \"False\"}" > /etc/rhsm/facts/custom.facts 7 | 8 | # add and process the external resources 9 | ADD resources/* /tmp/ 10 | ADD setup_scripts/* /tmp/setup_scripts/ 11 | 12 | WORKDIR /tmp 13 | RUN chmod +x *.sh setup_scripts/*.sh 14 | RUN for i in `ls setup_scripts/*.sh`; do bash $i; done 15 | WORKDIR /root 16 | 17 | RUN sed -i 's/enabled = 1/enabled = 0/g' /etc/yum.repos.d/ubi.repo 18 | RUN dnf clean all 19 | 20 | EXPOSE 22 21 | 22 | CMD /tmp/startup.sh 23 | -------------------------------------------------------------------------------- /UBI9/resources/hostname-3.23-6.el9.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JacobCallahan/content-host-d/e69726127110646b3066319b974837d3c4128153/UBI9/resources/hostname-3.23-6.el9.x86_64.rpm -------------------------------------------------------------------------------- /UBI9/resources/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adding the local entry on /etc/hosts 4 | if [ -n "$LOCAL" ]; then 5 | echo "Adding entry '$LOCAL $SATHOST' on /etc/hosts" 6 | echo "$LOCAL $SATHOST" >>/etc/hosts 7 | fi 8 | 9 | # Add the Satellite's cert 10 | if [ -n "$SATHOST" ]; then 11 | echo "Adding satellite certificate http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm" 12 | rpm -Uvh http://$SATHOST/pub/katello-ca-consumer-latest.noarch.rpm 13 | fi 14 | 15 | # Configure our registration auth, if provided 16 | if [ -n "$AUTH" ]; then 17 | IFS="/" read -r UNAME PWORD <<< "$AUTH" 18 | AUTH="--username=$UNAME --password=$PWORD" 19 | else 20 | AUTH="--username=admin --password=changeme" 21 | fi 22 | 23 | # Set the organization to default, if not provided 24 | if [ -z "$ORG" ]; then 25 | ORG="Default_Organization" 26 | fi 27 | 28 | # Register to the sat if an activation key specified 29 | if [ -n "$AK" ]; then 30 | echo "Activation key $AK specified. Registering..." 31 | subscription-manager register --org="$ORG" --activationkey="$AK" 32 | # If an environment is otherwise specified, use it 33 | elif [ -n "$ENV" ]; then 34 | echo "Environment $ENV found. Registering..." 35 | subscription-manager register --org="$ORG" --environment="$ENV" "$AUTH" 36 | # If no specifics are provided, register to the library 37 | else 38 | echo "No registration details specified. Registering to $ORG and Library..." 39 | subscription-manager register --org="$ORG" --environment="Library" "$AUTH" 40 | fi 41 | 42 | # Install katello agent 43 | yum -y install katello-agent 44 | 45 | # if the KILL arg was not passed, then keep the container running 46 | if [ -z "$KILL" ]; then 47 | tail -f /var/log/messages || tail -f /dev/null 48 | fi 49 | -------------------------------------------------------------------------------- /UBI9/setup_scripts/00_hostname.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | yum -y localinstall hostname-3.23-6.el9.x86_64.rpm 4 | -------------------------------------------------------------------------------- /build-and-push.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | REPO_DIR=${REPO_DIR:-~/content-host-d} 3 | 4 | # Determine if Docker or Podman is available. 5 | if command -v docker &> /dev/null; then 6 | CONTAINER_CMD="docker" 7 | elif command -v podman &> /dev/null; then 8 | CONTAINER_CMD="podman" 9 | else 10 | echo "Neither Docker nor Podman is installed. Exiting." 11 | exit 1 12 | fi 13 | 14 | # Validate arguments were passed and REPO_DIR exists. 15 | if [[ $# -eq 0 ]]; then 16 | echo "No build targets specified. Exiting." 17 | exit 1 18 | elif [[ ! -d ${REPO_DIR} ]]; then 19 | echo "Directory ${REPO_DIR} could not be found. Exiting." 20 | exit 1 21 | fi 22 | 23 | # shellcheck disable=SC2164 24 | cd ${REPO_DIR} 25 | git fetch origin 26 | git checkout master 27 | git reset --hard origin/master 28 | git clean -f 29 | 30 | for var in "${@}" 31 | do 32 | # Verify that the build target folder exists. 33 | if [[ ! -d ${var} ]]; then 34 | echo "Target ${var} not found. Skipping." 35 | continue 36 | fi 37 | 38 | # Copy any user-provided files to the build target folder. 39 | [[ -d resources ]] && cp -r resources ${var} 40 | [[ -d setup_scripts ]] && cp -r setup_scripts ${var} 41 | 42 | BUILD_CMD="${CONTAINER_CMD} build ${var} -t ${var,,}" 43 | 44 | # Pass ROOT_PASSWD to UBI*-init images if set. 45 | [[ ${var} =~ -init ]] && [[ -v ROOT_PASSWD ]] && BUILD_CMD+=" --build-arg ROOT_PASSWD=${ROOT_PASSWD}" 46 | 47 | # Use cgroup v1 for UBI7-init images. 48 | [[ ${var,,} == ubi7-init ]] && BUILD_CMD+=" --annotation 'run.oci.systemd.force_cgroup_v1=/sys/fs/cgroup'" 49 | 50 | eval ${BUILD_CMD} 51 | done 52 | -------------------------------------------------------------------------------- /flood.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import argparse, json, os, sys, time, uuid 3 | from collections import deque 4 | import docker 5 | import logging 6 | 7 | 8 | def merge_dicts(dict1, dict2): 9 | res = dict1.copy() 10 | res.update(dict2) 11 | return res 12 | 13 | 14 | def gen_json(hypervisors, guests): 15 | virtwho = {} 16 | all_guest_list = [] 17 | for i in range(hypervisors): 18 | guest_list = [] 19 | for c in range(guests): 20 | cur_id = str(uuid.uuid4()) 21 | guest_list.append( 22 | { 23 | "guestId": cur_id, 24 | "state": 1, 25 | "attributes": {"active": 1, "virtWhoType": "esx"}, 26 | } 27 | ) 28 | all_guest_list.append(cur_id) 29 | virtwho[str(uuid.uuid4()).replace("-", ".")] = guest_list 30 | return (virtwho, all_guest_list) 31 | 32 | 33 | def rm_container(client, containers, reason="Success"): 34 | del_container = containers[0] 35 | with open("container.log", "a") as log: 36 | log.write( 37 | "***********************************{0}****************************\n".format( 38 | del_container['name'] 39 | ) 40 | ) 41 | log.write(client.logs(del_container['container']['Id']).decode()) 42 | client.remove_container(del_container['container'], v=True, force=True) 43 | del containers[0] 44 | logging.info('Done with {0}: {1}'.format(del_container['name'], reason)) 45 | 46 | 47 | def host_flood(count, tag, name, env_vars, limit, image, network_mode, criteria, rhsm_log_dir): 48 | client = docker.Client(version='1.22') # docker.from_env() 49 | num = 1 50 | containers = deque() 51 | # create our base volume bind 52 | binds = {'/dev/log': {'bind': '/dev/log', 'mode': 'rw'}} 53 | # allow for local storage of rhsm logs 54 | if rhsm_log_dir: 55 | rhsm_log_dir = '' if rhsm_log_dir == '.' else rhsm_log_dir 56 | if not os.path.isabs(rhsm_log_dir): 57 | rhsm_log_dir = os.path.abspath(rhsm_log_dir) 58 | if not os.path.isdir(rhsm_log_dir): 59 | os.makedirs(rhsm_log_dir) 60 | 61 | while num < count or containers: 62 | if len(containers) < limit and num <= count: # check if queue is full 63 | local_file = None 64 | if rhsm_log_dir: 65 | # create our log bind 66 | local_file = '{}/{}{}.log'.format(rhsm_log_dir, name, num) 67 | with open(local_file, 'w'): 68 | pass 69 | binds[local_file] = {'bind': '/var/log/rhsm/rhsm.log', 'mode': 'rw'} 70 | hostname = '{0}{1}'.format(name, num) 71 | container = client.create_container( 72 | image='{0}:{1}'.format(image, tag), 73 | hostname=hostname, 74 | detach=False, 75 | environment=env_vars, 76 | host_config=client.create_host_config(binds=binds), 77 | ) 78 | # destroy the bind for this host, for the next one 79 | if binds.get(local_file or None): 80 | del binds[local_file] 81 | containers.append({'container': container, 'name': hostname}) 82 | client.start(container=container, network_mode=network_mode) 83 | logging.info('Created: {0}'.format(hostname)) 84 | num += 1 85 | 86 | logs = client.logs(containers[0]['container']['Id']) 87 | 88 | if criteria == 'reg': 89 | if 'system has been registered'.encode() in logs: 90 | rm_container(client, containers) 91 | elif 'no enabled repos'.encode() in logs: 92 | rm_container( 93 | client, 94 | containers, 95 | 'No repos enabled. Check registration/subscription status.', 96 | ) 97 | elif criteria == 'age': 98 | if 'Complete!'.encode() in logs: 99 | rm_container(client, containers) 100 | elif 'no enabled repos'.encode() in logs: 101 | rm_container( 102 | client, 103 | containers, 104 | 'No repos enabled. Check registration/subscription status.', 105 | ) 106 | elif 'No package katello-agent available'.encode() in logs: 107 | rm_container(client, containers, 'katello-agent not found.') 108 | else: 109 | if 'No package katello-agent available'.encode() in logs: 110 | rm_container(client, containers, 'katello-agent not found.') 111 | elif 'no enabled repos'.encode() in logs: 112 | rm_container( 113 | client, 114 | containers, 115 | 'No repos enabled. Check registration/subscription status.', 116 | ) 117 | elif time.time() - containers[0].get('delay', time.time()) >= criteria: 118 | rm_container(client, containers) 119 | elif not containers[0].get('delay', False) and 'Complete!'.encode() in logs: 120 | containers[0]['delay'] = time.time() 121 | elif ( 122 | client.inspect_container(containers[0]['container']['Id'])['State'][ 123 | 'Status' 124 | ] 125 | != u'running' 126 | ): 127 | rm_container(client, containers) 128 | 129 | 130 | def virt_flood(tag, limit, image, name, env_vars, network_mode, hypervisors, guests): 131 | virt_data, guest_list = gen_json(hypervisors, guests) 132 | with open('/tmp/temp.json', 'w') as f: 133 | json.dump(virt_data, f) 134 | client = docker.Client(version='1.22') 135 | temphost = 'meeseeks-{}'.format(str(uuid.uuid4())) 136 | logging.info( 137 | "Submitting virt-who report. Note: this will create a host: '{}'.".format( 138 | temphost 139 | ) 140 | ) 141 | client.pull('jacobcallahan/genvirt') 142 | container = client.create_container( 143 | image='jacobcallahan/genvirt', 144 | hostname=temphost, 145 | detach=False, 146 | environment=env_vars, 147 | volumes='/tmp/temp.json', 148 | host_config=client.create_host_config( 149 | binds={'/tmp/temp.json': {'bind': '/tmp/temp.json', 'mode': 'ro'}} 150 | ), 151 | ) 152 | client.start(container=container, network_mode=network_mode) 153 | while 'Done!'.encode() not in client.logs(container): 154 | time.sleep(2) 155 | client.remove_container(container, v=True, force=True) 156 | os.remove('/tmp/temp.json') 157 | if sys.version_info.major < 3: 158 | _ = raw_input("Pausing for you to attach subscriptions to the new hypervisors.") 159 | else: 160 | _ = input("Pausing for you to attach subscriptions to the new hypervisors.") 161 | 162 | logging.info("Starting guest creation.") 163 | active_hosts = [] 164 | while guest_list or active_hosts: 165 | if guest_list and len(active_hosts) < limit: 166 | guest = guest_list.pop(0) 167 | hostname = '{}{}'.format(name, guest.split('-')[4]) 168 | container = client.create_container( 169 | image='{0}:{1}'.format(image, tag), 170 | hostname=hostname, 171 | detach=False, 172 | environment=merge_dicts(env_vars, {'UUID': guest}), 173 | ) 174 | active_hosts.append({'container': container, 'name': hostname}) 175 | client.start(container=container, network_mode=network_mode) 176 | logging.info( 177 | 'Created Guest: {}. {} left in queue.'.format(hostname, len(guest_list)) 178 | ) 179 | 180 | logs = client.logs(active_hosts[0]['container']['Id']) 181 | # We'll wait for 30 seconds after attempting to auto-attach 182 | if 'no enabled repos'.encode() in logs: 183 | rm_container(client, active_hosts) 184 | elif 'No package katello-agent available'.encode() in logs: 185 | rm_container(client, active_hosts) 186 | elif time.time() - active_hosts[0].get('delay', time.time()) >= 30: 187 | rm_container(client, active_hosts) 188 | elif not active_hosts[0].get('delay', False) and 'auto-attach'.encode() in logs: 189 | active_hosts[0]['delay'] = time.time() 190 | elif ( 191 | client.inspect_container(active_hosts[0]['container']['Id'])['State'][ 192 | 'Status' 193 | ] 194 | != u'running' 195 | ): 196 | rm_container(client, active_hosts) 197 | 198 | 199 | if __name__ == '__main__': 200 | logging.basicConfig( 201 | filename='flood.log', 202 | format='[%(levelname)s %(asctime)s] %(message)s', 203 | datefmt='%m-%d-%Y %I:%M:%S', 204 | level=logging.INFO, 205 | ) 206 | parser = argparse.ArgumentParser() 207 | parser.add_argument( 208 | "-i", 209 | "--image", 210 | type=str, 211 | default="ch-d", 212 | help="The name of the image to use, defaults to 'ch-d'.", 213 | ) 214 | parser.add_argument( 215 | "-t", 216 | "--tag", 217 | type=str, 218 | default="rhel7", 219 | help="The image tag you want the container based on. ch-d:", 220 | ) 221 | parser.add_argument( 222 | "-m", 223 | "--network-mode", 224 | type=str, 225 | default=None, 226 | help="Container network mode to use.", 227 | ) 228 | parser.add_argument( 229 | "-s", 230 | "--satellite", 231 | type=str, 232 | required=True, 233 | help="The hostname of the target Satellite.", 234 | ) 235 | parser.add_argument( 236 | "-n", 237 | "--name", 238 | type=str, 239 | default="flood", 240 | help="The base hostname to use for the containers.", 241 | ) 242 | parser.add_argument( 243 | "-k", "--key", type=str, help="The Activation Key to use for registration." 244 | ) 245 | parser.add_argument( 246 | "-o", 247 | "--organization", 248 | type=str, 249 | help="The organization to " 250 | " register hosts to(defaults to 'Default_Organization'.", 251 | ) 252 | parser.add_argument( 253 | "-e", 254 | "--environment", 255 | type=str, 256 | help="The location to register hosts to " "(defaults to 'Default_Location'.", 257 | ) 258 | parser.add_argument( 259 | "-a", 260 | "--auth", 261 | type=str, 262 | help="Specify a different username and password " 263 | "in the format: username/password (defaults to 'admin/changeme'.", 264 | ) 265 | parser.add_argument( 266 | "-c", 267 | "--count", 268 | type=int, 269 | default=10, 270 | help="The number of docker content hosts to create.", 271 | ) 272 | parser.add_argument( 273 | "--hypervisors", 274 | type=int, 275 | help="The number of hypervisors to create." 276 | " This is only to be used with the 'guests' tag", 277 | ) 278 | parser.add_argument( 279 | "--guests", 280 | type=int, 281 | help="The number of guests per hypervisor to create." 282 | " This is only to be used with the 'hypervisors' tag", 283 | ) 284 | parser.add_argument( 285 | "--limit", 286 | type=int, 287 | default=1000, 288 | help="The maximum number of simultaneous docker content hosts.", 289 | ) 290 | parser.add_argument( 291 | "--exit-criteria", 292 | type=str, 293 | help="The criteria to kill the host " 294 | "(registration, katello-agent,