Search

Appendix A. Initialization script for provisioning examples

download PDF

If you have not followed the examples in Managing content, you can use the following initialization script to create an environment for provisioning examples.

Procedure

  1. Create a script file (content-init.sh) and include the following:

    #!/bin/bash
    
    MANIFEST=$1
    
    # Import the content from Red Hat CDN
    hammer organization create \
    --name "ACME" \
    --label "ACME" \
    --description "My example organization for managing content"
    
    hammer subscription upload \
    --file ~/$MANIFEST \
    --organization "ACME"
    
    hammer repository-set enable \
    --name "Red Hat Enterprise Linux 7 Server (RPMs)" \
    --releasever "7Server" \
    --basearch "x86_64" \
    --product "Red Hat Enterprise Linux Server" \
    --organization "ACME"
    
    hammer repository-set enable \
    --name "Red Hat Enterprise Linux 7 Server (Kickstart)" \
    --releasever "7Server" \
    --basearch "x86_64" \
    --product "Red Hat Enterprise Linux Server" \
    --organization "ACME"
    
    hammer repository-set enable \
    --name "Red Hat Satellite Client 6 (for RHEL 7 Server) (RPMs)" \
    --basearch "x86_64" \
    --product "Red Hat Enterprise Linux Server" \
    --organization "ACME"
    
    hammer product synchronize --name "Red Hat Enterprise Linux Server" \
    --organization "ACME"
    
    # Create your application lifecycle
    hammer lifecycle-environment create \
    --name "Development" \
    --description "Environment for ACME's Development Team" \
    --prior "Library" \
    --organization "ACME"
    
    hammer lifecycle-environment create \
    --name "Testing" \
    --description "Environment for ACME's Quality Engineering Team" \
    --prior "Development" \
    --organization "ACME"
    
    hammer lifecycle-environment create \
    --name "Production" \
    --description "Environment for ACME's Product Releases" \
    --prior "Testing" \
    --organization "ACME"
    
    # Create and publish your content view
    hammer content-view create \
    --name "Base" \
    --description "Base operating system" \
    --repositories "Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server,Red Hat Satellite Client 6 for RHEL 7 Server RPMs x86_64" \
    --organization "ACME"
    
    hammer content-view publish \
    --name "Base" \
    --description "My initial content view for my operating system" \
    --organization "ACME"
    
    hammer content-view version promote \
    --content-view "Base" \
    --version 1 \
    --to-lifecycle-environment "Development" \
    --organization "ACME"
    
    hammer content-view version promote \
    --content-view "Base" \
    --version 1 \
    --to-lifecycle-environment "Testing" \
    --organization "ACME"
    
    hammer content-view version promote \
    --content-view "Base" \
    --version 1 \
    --to-lifecycle-environment "Production" \
    --organization "ACME"
  2. Set executable permissions on the script:

    # chmod +x content-init.sh
  3. Download a copy of your Red Hat Subscription Manifest from the Red Hat Customer Portal and run the script on the manifest:

    # ./content-init.sh manifest_98f4290e-6c0b-4f37-ba79-3a3ec6e405ba.zip

    This imports the necessary Red Hat content for the provisioning examples in this guide.

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.