Hammer CLI syntax for RH403-RHS6.2.1-en-1-20161027 Updated 11/30/2016 hammer --username admin --password redhat shell ================================================== Chapter 1 ---------- p18 Guided Exercise: Installing and Configuring Satellite Server [root@satellite ~]# systemctl enable firewalld firewall-cmd --permanent --add-service=RH-Satellite-6 firewall-cmd --permanent --add-port="53/udp" --add-port="53/tcp" --add-port="67/udp" --add-port="68/udp" --add-port="69/udp" firewall-cmd --reload cd /tmp; wget http://content.example.com/rhsat6.2.1/x86_64/isos/satellite-6.2.1-rhel-7-x86_64-dvd.iso; cd mkdir /media/iso mount -o loop /tmp/satellite-6.2.1-rhel-7-x86_64-dvd.iso /media/iso cd /media/iso; ./install_packages; cd; umount /media/iso satellite-installer --scenario satellite --foreman-admin-username admin --foreman-admin-password redhat ---------- p27 Guided Exercise: Synchronizing Red Hat Content [root@satellite ~]# wget http://classroom.example.com/materials/manifest_acme.zip ***** Set Red Hat Provider CDN URL to http://content.example.com/rhsat6.2.1/cdn hammer> subscription upload --file /root/manifest_acme.zip --organization "Default Organization" repository-set enable --organization "Default Organization" --product "Red Hat Enterprise Linux Server" --name "Red Hat Satellite Tools 6.2 (for RHEL 7 Server) (RPMs)" --basearch "x86_64" repository synchronize --async --organization "Default Organization" --product "Red Hat Enterprise Linux Server" --name "Red Hat Satellite Tools 6.2 for RHEL 7 Server RPMs x86_64" ---------- p34 Guided Exercise: Installing ad Configuring a Satellite Capsule Server [root@satellite ~]# capsule-certs-generate --capsule-fqdn capsule.lab.example.com --certs-tar ~/capsule.example.com-certs.tar scp /root/capsule.example.com-certs.tar root@capsule.lab.example.com:. [root@capsule ~]# firewall-cmd --permanent --add-port="53/udp" --add-port="53/tcp" --add-port="67/udp"\ --add-port="69/udp" --add-port="80/tcp" --add-port="443/ tcp" --add-port="5647/tcp"\ --add-port="8140/tcp" --add-port="8443/tcp" --add-port="9090/tcp" firewall-cmd --reload systemctl enable firewalld yum -y localinstall http://satellite.lab.example.com/pub/katello-ca-consumer-latest.noarch.rpm subscription-manager register --org "Default_Organization" cd /tmp; wget http://content.example.com/rhsat6.2.1/x86_64/isos/satellite-capsule-6.2.1-rhel-7-x86_64-dvd.iso mkdir /media/iso mount -o loop /tmp/satellite-capsule-6.2.1-rhel-7-x86_64-dvd.iso /media/iso cp /media/iso/media.repo /etc/yum.repos.d/capsule.repo chmod 644 /etc/yum.repos.d/capsule.repo vi /etc/yum.repos.d/capsule.repo [Sat6.2Capsule] baseurl=file:///media/iso [root@capsule ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release yum install -y satellite-capsule ***** satellite-installer --scenario capsule ---------- p38 Lab: Installing Red Hat Satellite 6 ***** SKIP THIS LAB but run grading script [root@workstation ~]# lab installation grade ================================================== Chapter 2 ---------- p53 Guided Exercise: Creating Organizations and Locations hammer> organization create --name Operations --description Operations location create --name Boston location add-organization --name Boston --organization Operations ---------- p59 Guide Exercise: Managing Users and Roles hammer> user create --login jack --auth-source-id 1 --mail jack@example.com --password redhat --locations Boston --organizations Operations user add-role --login jack --role Manager user create --login jill --auth-source-id 1 --mail jill@example.com --password redhat --locations Boston --organizations Operations user add-role --login jill --role Viewer ---------- p63 Guided Exercise: Creating Host Collections hammer> host-collection create --name OpsServers --description "Operations server systems" --organization Operations ---------- p64 Lab: Managing Users and Hosts Across Organizations and Locations hammer> organization create --name Finance --description Finance location create --name "San Francisco" location create --name Tokyo location add-organization --name "San Francisco" --organization Finance location add-organization --name Tokyo --organization Finance user create --login ito --auth-source-id 1 --mail ito@example.com --password redhat --locations Tokyo --organizations Finance user add-role --login ito --role Manager user create --login linda --auth-source-id 1 --mail linda@example.com --password redhat --locations "San Francisco" --organizations Finance user add-role --login linda --role Viewer host-collection create --name FinServers --description "Finance server systems" --organization Finance host-collection create --name FinDesktops --description "Finance desktop systems" --organization Finance [root@workstation ~]# lab administration grade ================================================== Chapter 3 ---------- p77 Guided Exercise: Registering Hosts to Satellite Server [root@satellite ~]# wget http://classroom.example.com/materials/manifest_operations.zip hammer> subscription upload --file /root/manifest_operations.zip --organization "Operations" ***** Set Red Hat Provider CDN URL to http://content.example.com/rhsat6.2.1/cdn repository-set enable --name "Red Hat Satellite Tools 6.2 (for RHEL 7 Server) (RPMs)" --product "Red Hat Enterprise Linux Server" --basearch "x86_64" --organization Operations repository synchronize --async --name "Red Hat Satellite Tools 6.2 for RHEL 7 Server RPMs x86_64" --product "Red Hat Enterprise Linux Server" --organization Operations repository-set enable --name "Red Hat Enterprise Linux 7 Server (RPMs)" --product "Red Hat Enterprise Linux Server" --releasever 7Server --basearch x86_64 --organization Operations repository synchronize --async --name "Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server" --product "Red Hat Enterprise Linux Server" --organization Operations [root@servera ~]# yum -y localinstall http://satellite.lab.example.com/pub/katello-ca-consumer-latest.noarch.rpm subscription-manager clean subscription-manager register --org Operations hammer> content-host update --name servera.lab.example.com --release-ver 7Server --host-collections OpsServers --organization Operations ***** Enable Product Content on Content Host for RHEL 7 repository (no hammer command to do this?) [root@servera ~]# subscription-manager refresh subscription-manager repos --list yum install -y katello-agent subscription-manager unregister ---------- p84 Guided Exercise: Registering and Configuring Hosts with Activation Keys hammer> activation-key create --name OperationsServers --unlimited-hosts --lifecycle-environment Library --content-view "Default Organization View" --organization Operations activation-key update --name OperationsServers --release-version 7Server --organization Operations ***** Process next 2 commands manually to determine Subscription ID subscription list --search "Red Hat Enterprise Linux Server, Standard (Physical or Virtual Nodes)" --organization Operations activation-key add-subscription --name OperationsServers --organization Operations --subscription-id activation-key add-host-collection --name OperationsServers --host-collection OpsServers --organization Operations activation-key content-override --name OperationsServers --content-label rhel-7-server-satellite-tools-6.2-rpms --value 1 --organization Operations [root@servera ~]# yum -y localinstall http://satellite.lab.example.com/pub/katello-ca-consumer-latest.noarch.rpm subscription-manager register --org Operations --activationkey OperationsServers yum install -y katello-agent ---------- p87 Lab: Registering Clients to Satellite Server [root@satellite ~]# wget http://classroom.example.com/materials/manifest_finance.zip hammer> subscription upload --file /root/manifest_finance.zip --organization "Finance" ***** Set Red Hat Provider CDN URL to http://content.example.com/rhsat6.2.1/cdn repository-set enable --name "Red Hat Satellite Tools 6.2 (for RHEL 7 Server) (RPMs)" --product "Red Hat Enterprise Linux Server" --basearch "x86_64" --organization Finance repository synchronize --async --name "Red Hat Satellite Tools 6.2 for RHEL 7 Server RPMs x86_64" --product "Red Hat Enterprise Linux Server" --organization Finance repository-set enable --name "Red Hat Enterprise Linux 7 Server (RPMs)" --product "Red Hat Enterprise Linux Server" --releasever 7Server --basearch x86_64 --organization Finance repository synchronize --async --name "Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server" --product "Red Hat Enterprise Linux Server" --organization Finance activation-key create --name FinanceServers --unlimited-hosts --lifecycle-environment Library --content-view "Default Organization View" --organization Finance activation-key update --name FinanceServers --release-version 7Server --organization Finance ***** Process next 2 commands manually to determine Subscription ID subscription list --search "Red Hat Enterprise Linux Server, Standard (Physical or Virtual Nodes)" --organization Finance activation-key add-subscription --name FinanceServers --organization Finance --subscription-id activation-key add-host-collection --name FinanceServers --host-collection FinServers --organization Finance activation-key content-override --name FinanceServers --content-label rhel-7-server-satellite-tools-6.2-rpms --value 1 --organization Finance [root@serverb ~]# yum -y localinstall http://satellite.lab.example.com/pub/katello-ca-consumer-latest.noarch.rpm subscription-manager clean subscription-manager register --org Finance --activationkey FinanceServers yum install -y katello-agent [student@workstation ~]# lab client grade ================================================== Chapter 4 ---------- p100 Guided Exercise: Automating Content Synchronization with Sync Plans hammer> sync-plan create --name Daily --description "Daily synchronization" --interval daily --sync-date "2016-12-31 01:00:00" --enabled true --organization Operations product set-sync-plan --name "Red Hat Enterprise Linux Server" --sync-plan Daily --organization Operations ---------- p104 Guided Exercise: Creating Environment Paths and Life-Cycle Environments hammer> lifecycle-environment create --description Development --name Dev --prior Library --organization Operations lifecycle-environment create --description "Quality Assurance" --name QA --prior Dev --organization Operations lifecycle-environment create --description Production --name Prod --prior QA --organization Operations ---------- p107 Guided Exercise: Creating Filtered Content Views hammer> content-view create --name Base --label Base --description "Base package group" --organization Operations content-view add-repository --name Base --product "Red Hat Enterprise Linux Server" --repository "Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server" --organization Operations content-view filter create --name "Base package group" --content-view Base --type "package_group" --inclusion true --description "Base package group only" --organization Operations ***** What is the command to add the Base package group to the filter? Add it through the GUI. ---------- p115 Guided Exercise: Publishing and Promoting Content Views hammer> content-view publish --name Base --organization Operations content-view version promote --content-view Base --to-lifecycle-environment Dev --organization Operations [root@servera ~]# subscription-manager repos --list yum repolist hammer> content-host update --name servera.lab.example.com --content-view Base --organization Operations content-host update --name servera.lab.example.com --lifecycle-environment Dev --organization Operations [root@servera ~]# subscription-manager refresh yum clean all subscription-manager repos --list yum repolist ---------- p121 Guided Exercise: Applying Errata to Content Hosts hammer> host errata apply --async --host servera.lab.example.com --errata-ids RHBA-2015:2118 ---------- p122 Lab: Managing Software Development Through the Software Development Life Cycle hammer> sync-plan create --name Weekly --description "Weekly synchronization" --interval weekly --sync-date "2016-12-31 01:00:00" --enabled true --organization Finance product set-sync-plan --name "Red Hat Enterprise Linux Server" --sync-plan Weekly --organization Finance lifecycle-environment create --description Development --name Dev --prior Library --organization Finance lifecycle-environment create --description "Quality Assurance" --name QA --prior Dev --organization Finance lifecycle-environment create --description Production --name Prod --prior QA --organization Finance content-view create --name "Security Errata" --label Security_Errata --description "Security errata by date" --organization Finance content-view add-repository --name "Security Errata" --product "Red Hat Enterprise Linux Server" --repository "Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server" --organization Finance content-view filter create --name "Security Errata By Date" --content-view "Security Errata" --type erratum --inclusion true --description "Security errata by date" --organization Finance ***** What is the command to add selected errata to the filter? Add it through the GUI, had to select date ranges and selct errata, different than the exact instructions in book. content-view publish --async --name "Security Errata" --organization Finance content-view version promote --async --content-view "Security Errata" --to-lifecycle-environment Dev --organization Finance content-view version promote --async --content-view "Security Errata" --to-lifecycle-environment QA --organization Finance content-view version promote --async --content-view "Security Errata" --to-lifecycle-environment Prod --organization Finance content-host update --name serverb.lab.example.com --content-view "Security Errata" --organization Finance content-host update --name serverb.lab.example.com --lifecycle-environment Dev --organization Finance [root@serverb ~]# subscription-manager refresh yum clean all yum list updates [student@workstation ~]# lab sdlc grade [root@serverb ~]# subscription-manager unregister ================================================== Chapter 5 ---------- p139 Guided Exercise: preparing for RPM packaging ---------- p146 Guided Exercise: Assembling RPM Packages ---------- p161 Guided Exercise: Packaging Compiled Software ---------- p167 Lab: Building RPM Packages ================================================== Chapter 6 ---------- p183 Guided Exercise: Creating Custom Prodcuts and Repositories [root@satellite ~]# wget http://classroom.example.com/materials/hwinfo-1.0-1.el7.x86_64.rpm wget http://classroom.example.com/materials/osinfo-1.0-1.el7.x86_64.rpm hammer> product create --name "Custom Software" --description "Custom Software" --organization Operations repository create --name "Admin Tools" --product "Custom Software" --content-type yum --publish-via-http true --organization Operations repository upload-content --name "Admin Tools" --product "Custom Software" --path /root/hwinfo-1.0-1.el7.x86_64.rpm --organization Operations repository upload-content --name "Admin Tools" --product "Custom Software" --path /root/osinfo-1.0-1.el7.x86_64.rpm --organization Operations ---------- p187 Guided Exercise: Creating Products with Repository Discovery hammer> product create --name "DVDs" --organization Operations repository create --name "rhel7.1 x86_64 dvd" --product "DVDs" --content-type yum --publish-via-http true --url http://content.example.com:/rhel7.1/x86_64/dvd/ --organization Operations repository synchronize --async --name "rhel7.1 x86_64 dvd" --product "DVDs" --organization Operations ---------- p193 Guided Exercise: Adinistering Custom Products and Repositories [root@satellite ~]# wget http://classroom.example.com/materials/EXAMPLE-RPM-GPG-KEY hammer> gpg create --name "Example Software" --key /root/EXAMPLE-RPM-GPG-KEY --organization Operations repository update --name "rhel7.1 x86_64 dvd" --product "DVDs" --gpg-key "Example Software" --organization Operations ***** Process next 2 commands manually to determine Subscription ID subscription list --search "Custom Software" --organization Operations activation-key add-subscription --name OperationsServers --organization Operations --subscription-id activation-key content-override --name OperationsServers --content-label rhel-7-server-satellite-tools-6.2-rpms --value 1 --organization Operations [root@servera ~]# yum clean all subscription-manager unregister yum -y localinstall http://satellite.lab.example.com/pub/katello-ca-consumer-latest.noarch.rpm subscription-manager register --org Operations --activationkey OperationsServers yum install -y katello-agent yum install -y osinfo ---------- p196 Lab: Deploying Custom Software Using Red Hat Satellite [root@satellite ~]# wget http://classroom.example.com/materials/bkp-1.0-1.el7.x86_64.rpm hammer> gpg create --name "Example Software" --key /root/EXAMPLE-RPM-GPG-KEY --organization Finance product create --name "Custom Software" --description "Custom Software" --organization Finance product update --name "Custom Software" --gpg-key "Example Software" --organization Finance repository create --name "Admin Tools" --product "Custom Software" --content-type yum --publish-via-http true --organization Finance repository upload-content --name "Admin Tools" --product "Custom Software" --path /root/bkp-1.0-1.el7.x86_64.rpm --organization Finance [root@satellite ~]# foreman-rake katello:reindex hammer> ***** Process next 2 commands manually to determine Subscription ID subscription list --search "Custom Software" --organization Finance activation-key add-subscription --name FinanceServers --organization Finance --subscription-id activation-key content-override --name FinanceServers --content-label rhel-7-server-satellite-tools-6.2-rpms --value 1 --organization Finance [root@serverb ~]# subscription-manager unregister yum -y localinstall http://satellite.lab.example.com/pub/katello-ca-consumer-latest.noarch.rpm subscription-manager clean subscription-manager register --org Finance --activationkey FinanceServers yum install -y katello-agent yum install -y bkp [student@workstation ~]# lab customsw grade ================================================== Chapter 7 ---------- p214 Guided Exercise: Seeing How Puppet Works [root@servera ~]# yum install -y puppet ---------- p221 Guided Exercise: Working with Puppet Classes ---------- p228 Guided Exercise: Creating a Puppet Repository [root@satellite ~]# wget http://classroom.example.com/materials/puppet/rht-chrony-0.1.0.tar.gz wget http://classroom.example.com/materials/puppet/puppetlabs-stdlib-4.1.0.tar.gz hammer> product create --name "Operations Product" --organization Operations repository create --name "Operations Modules" --product "Operations Product" --content-type puppet --publish-via-http true --organization Operations repository upload-content --name "Operations Modules" --product "Operations Product" --path /root/rht-chrony-0.1.0.tar.gz --organization Operations repository upload-content --name "Operations Modules" --product "Operations Product" --path /root/puppetlabs-stdlib-4.1.0.tar.gz --organization Operations ---------- p230 Lab: managing System Configurations with Puppet hammer> product create --name "Finance Product" --organization Finance repository create --name "Finance Modules" --product "Finance Product" --content-type puppet --publish-via-http true --organization Finance repository upload-content --name "Finance Modules" --product "Finance Product" --path /root/rht-chrony-0.1.0.tar.gz --organization Finance repository upload-content --name "Finance Modules" --product "Finance Product" --path /root/puppetlabs-stdlib-4.1.0.tar.gz --organization Finance [student@workstation ~]# lab puppet-master grade ================================================== Chapter 8 ---------- p239 Guided Exercise: Connecting Puppet Clients hammer> content-view create --name "Operations Content" --description "Content view for Operations servers" --organization Operations content-view add-repository --name "Operations Content" --product "Red Hat Enterprise Linux Server" --repository "Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server" --organization Operations content-view add-repository --name "Operations Content" --product "Red Hat Enterprise Linux Server" --repository "Red Hat Satellite Tools 6.2 for RHEL 7 Server RPMs x86_64" --organization Operations content-view puppet-module add --name chrony --author rht --content-view "Operations Content" --organization Operations content-view puppet-module add --name stdlib --author puppetlabs --content-view "Operations Content" --organization Operations content-view publish --async --name "Operations Content" --organization Operations content-view version promote --async --content-view "Operations Content" --to-lifecycle-environment Dev --organization Operations environment update --name KT_Operations_Library_Operations_Content_6 --locations Boston environment update --name KT_Operations_Library_Operations_Content_6 --locations "Default Location" environment update --name KT_Operations_Dev_Operations_Content_6 --locations Boston environment update --name KT_Operations_Dev_Operations_Content_6 --locations "Default Location" activation-key create --name "Operations Host" --unlimited-hosts --description "Activation key that registers Operations hosts" --lifecycle-environment Dev --content-view "Operations Content" --organization Operations activation-key update --name "Operations Host" --release-version 7Server --auto-attach false --organization Operations ***** Process next 2 commands manually to determine Subscription ID subscription list --search "Red Hat Enterprise Linux Server, Standard (Physical or Virtual Nodes)" --organization Operations activation-key add-subscription --name "Operations Host" --organization Operations --subscription-id subscription list --search "Operations Product" --organization Operations activation-key add-subscription --name "Operations Host" --organization Operations --subscription-id activation-key content-override --name "Operations Host" --content-label rhel-7-server-satellite-tools-6.2-rpms --value 1 --organization Operations [root@servera ~]# yum clean all subscription-manager unregister yum -y localinstall http://satellite.lab.example.com/pub/katello-ca-consumer-latest.noarch.rpm subscription-manager register --org Operations --activationkey "Operations Host" yum repolist yum install -y puppet katello-agent echo 'server=satellite.lab.example.com' >>/etc/puppet/puppet.conf puppet agent --test --noop ***** How to sign host certificate? Have to do it through the GUI: Infrastructure > Capsules. puppet agent --test --noop ***** Ignore Error in red. ---------- p246 Guided Exercise: Standardizing Configurations with Host Groups ***** Create the configuration group "NTP Classes" using the GUI: Configure > Config groups. hammer> hostgroup create --name "Operations Host Group" --lifecycle-environment Dev --content-view "Operations Content" --puppet-environment KT_Operations_Dev_Operations_Content_6 --content-source-id 1 --puppet-ca-proxy-id 1 --puppet-proxy-id 1 satellite.lab.example.com --organization Operations ---------- p252 Guided Exercise: using Class Parameters to Configure Systems ---------- p258 Lab: Standardizing System Configuration with Red Hat Satellite 6 ================================================== Chapter 9 ---------- p279 Guided Exercise: Configuring provisioning Services, Domain, and Subnet on Satellite Server ---------- p286 Guided Exercise: Configuring Operating System Resources for Provisioning ---------- p294 Guided Exercise: PXE Provisioning with Satellite Server ---------- p297 Lab: Configuring and Provisioning with PXE ================================================== Chapter 10 ---------- p307 Guided Exercise: Provisioning Hosts for Software and Configuration Management ---------- p314 Guided Exercise: Discovering Bare-metal Hosts ---------- p317 Lab: Configuring Satellite Server for Enterprise Deployment