Last active
March 26, 2025 15:41
-
-
Save parthaa/da3aba64d0dc5023de642056a1c33522 to your computer and use it in GitHub Desktop.
Chat Gpt generated sat setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set variables | |
ORG="Pulp_Org" | |
CONTENT_VIEW="Pulp_Content_View" | |
ACTIVATION_KEY="Default_CVE_Key" | |
USERNAME="admin" | |
PASSWORD="changeme" | |
# Create Organization | |
echo "Creating Organization..." | |
hammer --username "$USERNAME" --password "$PASSWORD" organization create --name "$ORG" --label "pulp_org" --description "Organization for Pulp Project Repositories" | |
# Import Subscription Manifest | |
echo "Importing Subscription Manifest..." | |
hammer --username "$USERNAME" --password "$PASSWORD" subscription upload --organization "$ORG" --file "manifest.zip" | |
# Create Activation Key for the default CVE | |
echo "Creating Activation Key..." | |
hammer --username "$USERNAME" --password "$PASSWORD" activation-key create --name "$ACTIVATION_KEY" --organization "$ORG" --lifecycle-environment "Library" --content-view "Default Organization View" | |
# Create Lifecycle Environments | |
echo "Creating Lifecycle Environments..." | |
hammer --username "$USERNAME" --password "$PASSWORD" lifecycle-environment create --name "Development" --organization "$ORG" --prior "Library" | |
hammer --username "$USERNAME" --password "$PASSWORD" lifecycle-environment create --name "Production" --organization "$ORG" --prior "Development" | |
# Create YUM repositories from Pulp Fixtures | |
echo "Creating YUM repositories..." | |
hammer --username "$USERNAME" --password "$PASSWORD" repository create --name "Pulp_Fedora_Modules" --organization "$ORG" --content-type "yum" --publish-via-http true --url "https://fixtures.pulpproject.org/rpm-with-modules/" | |
hammer --username "$USERNAME" --password "$PASSWORD" repository create --name "Pulp_Busybox" --organization "$ORG" --content-type "yum" --publish-via-http true --url "https://fixtures.pulpproject.org/rpm-busybox/" | |
hammer --username "$USERNAME" --password "$PASSWORD" repository create --name "Pulp_Package_Repo" --organization "$ORG" --content-type "yum" --publish-via-http true --url "https://fixtures.pulpproject.org/rpm-packages/" | |
# Create File repositories from Pulp Fixtures | |
echo "Creating File repositories..." | |
hammer --username "$USERNAME" --password "$PASSWORD" repository create --name "Pulp_File_Content" --organization "$ORG" --content-type "file" --publish-via-http true --url "https://fixtures.pulpproject.org/file-content/" | |
hammer --username "$USERNAME" --password "$PASSWORD" repository create --name "Pulp_File_Large" --organization "$ORG" --content-type "file" --publish-via-http true --url "https://fixtures.pulpproject.org/file-large/" | |
# Create Ansible Collection repositories from Pulp Fixtures | |
echo "Creating Ansible Collection repositories..." | |
hammer --username "$USERNAME" --password "$PASSWORD" repository create --name "Pulp_Ansible_Core" --organization "$ORG" --content-type "ansible_collection" --publish-via-http true --url "https://fixtures.pulpproject.org/ansible/" | |
hammer --username "$USERNAME" --password "$PASSWORD" repository create --name "Pulp_Ansible_Extras" --organization "$ORG" --content-type "ansible_collection" --publish-via-http true --url "https://fixtures.pulpproject.org/ansible-v2/" | |
# Enable RHEL 9 BaseOS & AppStream Repositories | |
echo "Enabling RHEL 9 repositories..." | |
hammer --username "$USERNAME" --password "$PASSWORD" repository-set enable --organization "$ORG" --product "Red Hat Enterprise Linux for x86_64" --basearch "x86_64" --releasever "9" --name "Red Hat Enterprise Linux 9 for x86_64 - BaseOS RPMs" | |
hammer --username "$USERNAME" --password "$PASSWORD" repository-set enable --organization "$ORG" --product "Red Hat Enterprise Linux for x86_64" --basearch "x86_64" --releasever "9" --name "Red Hat Enterprise Linux 9 for x86_64 - AppStream RPMs" | |
# Synchronize repositories | |
echo "Syncing repositories..." | |
for repo in "Pulp_Fedora_Modules" "Pulp_Busybox" "Pulp_Package_Repo" "Pulp_File_Content" "Pulp_File_Large" "Pulp_Ansible_Core" "Pulp_Ansible_Extras" \ | |
"Red Hat Enterprise Linux 9 for x86_64 - BaseOS RPMs" "Red Hat Enterprise Linux 9 for x86_64 - AppStream RPMs" | |
do | |
hammer --username "$USERNAME" --password "$PASSWORD" repository synchronize --name "$repo" --organization "$ORG" | |
done | |
# Create Content View | |
echo "Creating Content View..." | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view create --name "$CONTENT_VIEW" --organization "$ORG" --description "Content View with Pulp Project Fixtures" | |
# Add repositories and create Content View Versions | |
echo "Creating Content View Versions..." | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view add-repository --name "$CONTENT_VIEW" --organization "$ORG" --repository "Pulp_Fedora_Modules" | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view add-repository --name "$CONTENT_VIEW" --organization "$ORG" --repository "Pulp_Busybox" | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view publish --name "$CONTENT_VIEW" --organization "$ORG" --description "Version 1 - Pulp YUM Repos" | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view add-repository --name "$CONTENT_VIEW" --organization "$ORG" --repository "Pulp_Package_Repo" | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view add-repository --name "$CONTENT_VIEW" --organization "$ORG" --repository "Pulp_File_Content" | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view publish --name "$CONTENT_VIEW" --organization "$ORG" --description "Version 2 - Pulp YUM + File Repos" | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view add-repository --name "$CONTENT_VIEW" --organization "$ORG" --repository "Pulp_Ansible_Core" | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view publish --name "$CONTENT_VIEW" --organization "$ORG" --description "Version 3 - Pulp YUM + File + Ansible Core" | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view add-repository --name "$CONTENT_VIEW" --organization "$ORG" --repository "Pulp_File_Large" | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view add-repository --name "$CONTENT_VIEW" --organization "$ORG" --repository "Pulp_Ansible_Extras" | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view publish --name "$CONTENT_VIEW" --organization "$ORG" --description "Version 4 - All Pulp Repositories" | |
# Promote Content View versions to Lifecycle Environments | |
echo "Promoting Content View Versions..." | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view version promote --content-view "$CONTENT_VIEW" --organization "$ORG" --to-lifecycle-environment "Development" | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view version promote --content-view "$CONTENT_VIEW" --organization "$ORG" --to-lifecycle-environment "Production" | |
# Add RHEL 9 repositories to Content View | |
echo "Adding RHEL 9 repositories to Content View..." | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view add-repository --name "$CONTENT_VIEW" --organization "$ORG" --repository "Red Hat Enterprise Linux 9 for x86_64 - BaseOS RPMs" | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view add-repository --name "$CONTENT_VIEW" --organization "$ORG" --repository "Red Hat Enterprise Linux 9 for x86_64 - AppStream RPMs" | |
# Publish two more Content View Versions with RHEL 9 | |
echo "Publishing Content View Versions with RHEL 9..." | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view publish --name "$CONTENT_VIEW" --organization "$ORG" --description "Version 5 - Adding RHEL 9 BaseOS and AppStream" | |
hammer --username "$USERNAME" --password "$PASSWORD" content-view publish --name "$CONTENT_VIEW" --organization "$ORG" --description "Version 6 - Final Version with all Pulp and RHEL 9" | |
echo "Setup Complete: Organization, Activation Key, Repositories, Content Views, and Lifecycle Environments!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
give me a bash script using hammer and satellite that creates me an organization, an activation key for the default cve, 3 yum repositories, 2 file repositories, 2 ansible collections repositories, a content view, 4 content view versions, 2 lifecycle environment with different combinations of repositories. Use the repositories listed here => https://fixtures.pulpproject.org/ . Also promote some of the content view versions to the new lifecycle environments. Finally import manifest manifest.zip, enable Base OS and App Stream for RHEL 9, sync, add to content view , publish and generate 2 more content view versions. use "admin" as username and password "changeme" for each of the hammer commands