Managing hosts Red Hat Satellite 6.16 Register hosts to Satellite, configure host groups and collections, set up remote execution, manage packages on hosts, monitor hosts, and more Red Hat Satellite Documentation Team satellite-doc-list@redhat.com

Commands:
hammer host create --ask-root-password yes --hostgroup " My_Host_Group " --interface="primary=true, provision=true, mac= My_MAC_Address , ip= My_IP_Address " --location " My_Location " --name " My_Host_Name " --organization " My_Organization "
subscription-manager syspurpose set usage ' Production ' subscription-manager syspurpose set role ' Red Hat Enterprise Linux Server ' subscription-manager syspurpose add addons ' your_addon '
subscription-manager syspurpose
hammer host delete --id My_Host_ID --location-id My_Location_ID --organization-id My_Organization_ID
mkdir /etc/puppetlabs/code/environments/ example_environment
hammer hostgroup create --name "Base" --architecture "My_Architecture" --content-source-id _My_Content_Source_ID_ --content-view "_My_Content_View_" --domain "_My_Domain_" --lifecycle-environment "_My_Lifecycle_Environment_" --locations "_My_Location_" --medium-id _My_Installation_Medium_ID_ --operatingsystem "_My_Operating_System_" --organizations "_My_Organization_" --partition-table "_My_Partition_Table_" --puppet-ca-proxy-id _My_Puppet_CA_Proxy_ID_ --puppet-environment "_My_Puppet_Environment_" --puppet-proxy-id _My_Puppet_Proxy_ID_ --root-pass "My_Password" --subnet "_My_Subnet_"
MAJOR=" My_Major_Operating_System_Version " ARCH=" My_Architecture " ORG=" My_Organization " LOCATIONS=" My_Location " PTABLE_NAME=" My_Partition_Table " DOMAIN=" My_Domain " hammer --output csv --no-headers lifecycle-environment list --organization "USD{ORG}" | cut -d ',' -f 2 | while read LC_ENV; do [[ USD{LC_ENV} == "Library" ]] && continue hammer hostgroup create --name "rhel-USD{MAJOR}server-USD{ARCH}-USD{LC_ENV}" --architecture "USD{ARCH}" --partition-table "USD{PTABLE_NAME}" --domain "USD{DOMAIN}" --organizations "USD{ORG}" --query-organization "USD{ORG}" --locations "USD{LOCATIONS}" --lifecycle-environment "USD{LC_ENV}" done
systemctl enable --now chronyd
chkconfig --add ntpd chkconfig ntpd on service ntpd start
cp My_SSL_CA_file .pem /etc/pki/ca-trust/source/anchors
update-ca-trust
mkdir /etc/puppetlabs/code/environments/ example_environment
curl -O http:// satellite.example.com /pub/bootstrap.py
chmod +x bootstrap.py
/usr/libexec/platform-python bootstrap.py -h
./bootstrap.py -h
/usr/libexec/platform-python bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key "
./bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key "
rm bootstrap.py
ROLE='Bootstrap' hammer role create --name "USDROLE" hammer filter create --role "USDROLE" --permissions view_organizations hammer filter create --role "USDROLE" --permissions view_locations hammer filter create --role "USDROLE" --permissions view_domains hammer filter create --role "USDROLE" --permissions view_hostgroups hammer filter create --role "USDROLE" --permissions view_hosts hammer filter create --role "USDROLE" --permissions view_architectures hammer filter create --role "USDROLE" --permissions view_ptables hammer filter create --role "USDROLE" --permissions view_operatingsystems hammer filter create --role "USDROLE" --permissions create_hosts
hammer user add-role --id user_id --role Bootstrap
/usr/libexec/platform-python bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --force
bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --force
/usr/libexec/platform-python bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --legacy-purge --legacy-login rhn-user
bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --legacy-purge --legacy-login rhn-user
/usr/libexec/platform-python bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --skip-puppet
bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --skip-puppet
/usr/libexec/platform-python bootstrap.py --server satellite.example.com --organization=" My_Organization " --activationkey=" My_Activation_Key " --skip-foreman
bootstrap.py --server satellite.example.com --organization=" My_Organization " --activationkey=" My_Activation_Key " --skip-foreman
/usr/libexec/platform-python bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --download-method https
bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --download-method https
/usr/libexec/platform-python bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --ip 192.x.x.x
bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --ip 192.x.x.x
/usr/libexec/platform-python bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --rex --rex-user root
bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --rex --rex-user root
/usr/libexec/platform-python bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --add-domain
bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --add-domain
hammer settings set --name create_new_host_when_facts_are_uploaded --value false hammer settings set --name create_new_host_when_report_is_uploaded --value false
/usr/libexec/platform-python bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --fqdn node100.example.com
bootstrap.py --login= admin --server satellite.example.com --location=" My_Location " --organization=" My_Organization " --hostgroup=" My_Host_Group " --activationkey=" My_Activation_Key " --fqdn node100.example.com
yum install katello-host-tools-tracer
katello-tracer-upload
dnf install puppet-agent
yum install puppet-agent
. /etc/profile.d/puppet-agent.sh
puppet config set server satellite.example.com --section agent puppet config set environment My_Puppet_Environment --section agent
puppet resource service puppet ensure=running enable=true
puppet ssl bootstrap
puppet ssl bootstrap
dnf install http:// satellite.example.com /pub/katello-ca-consumer-latest.noarch.rpm
hammer host create --ask-root-password yes --hostgroup My_Host_Group --ip= My_IP_Address --mac= My_MAC_Address --managed true --interface="identifier= My_NIC_1, mac=_My_MAC_Address_1 , managed=true, type=Nic::Managed, domain_id= My_Domain_ID , subnet_id= My_Subnet_ID " --interface="identifier= My_NIC_2 , mac= My_MAC_Address_2 , managed=true, type=Nic::Managed, domain_id= My_Domain_ID , subnet_id= My_Subnet_ID " --interface="identifier= bondN , ip= My_IP_Address_2 , type=Nic::Bond, mode=active-backup, attached_devices=[ My_NIC_1 , My_NIC_2 ], managed=true, domain_id= My_Domain_ID , subnet_id= My_Subnet_ID " --location " My_Location " --name " My_Host_Name " --organization " My_Organization " --subnet-id= My_Subnet_ID
satellite-installer --foreman-proxy-bmc-default-provider=ipmitool --foreman-proxy-bmc=true
https:// satellite.example.com /unattended/public/foreman_ca_refresh
curl --head https:// satellite.example.com
curl --head https:// capsule.example.com:9090 /features
https:// satellite.example.com /unattended/public/foreman_ca_refresh
curl --head https:// satellite.example.com
curl --head https:// capsule.example.com:9090 /features
curl -o "satellite_ca_cert.crt" https:// satellite.example.com /unattended/public/foreman_raw_ca
cp -u satellite_ca_cert.crt /etc/rhsm/ca/katello-server-ca.pem
cp satellite_ca_cert.crt /etc/pki/ca-trust/source/anchors
update-ca-trust
curl --head https:// satellite.example.com
curl --head https:// capsule.example.com:9090 /features
satellite-installer --enable-foreman-plugin-remote-execution-cockpit --reset-foreman-plugin-remote-execution-cockpit-ensure
satellite-installer --foreman-plugin-remote-execution-cockpit-ensure absent
satellite-installer --foreman-proxy-plugin-remote-execution-script-cockpit-integration false
hammer report-template list
hammer report-template generate --id My_Template_ID
hammer report-template generate --inputs "Days from Now=no limit" --name "Subscription - General Report"
hammer report-template generate --inputs "Days from Now=60" --name "Subscription - General Report"
hammer report-template list
hammer report-template dump --id My_Template_ID > example_export .erb
curl --insecure --user My_User_Name : My_Password --request GET --config https:// satellite.example.com /api/report_templates | json_reformat
{ "total": 6, "subtotal": 6, "page": 1, "per_page": 20, "search": null, "sort": { "by": null, "order": null }, "results": [ { "created_at": "2019-11-20 17:49:52 UTC", "updated_at": "2019-11-20 17:49:52 UTC", "name": "Applicable errata", "id": 112 }, { "created_at": "2019-11-20 17:49:52 UTC", "updated_at": "2019-11-20 17:49:52 UTC", "name": "Applied Errata", "id": 113 }, { "created_at": "2019-11-30 16:15:24 UTC", "updated_at": "2019-11-30 16:15:24 UTC", "name": "Hosts - complete list", "id": 158 }, { "created_at": "2019-11-20 17:49:52 UTC", "updated_at": "2019-11-20 17:49:52 UTC", "name": "Host statuses", "id": 114 }, { "created_at": "2019-11-20 17:49:52 UTC", "updated_at": "2019-11-20 17:49:52 UTC", "name": "Registered hosts", "id": 115 }, { "created_at": "2019-11-20 17:49:52 UTC", "updated_at": "2019-11-20 17:49:52 UTC", "name": "Subscriptions", "id": 116 } ] }
curl --insecure --output /tmp/_Example_Export_Template .erb_ --user admin:password --request GET --config https:// satellite.example.com /api/report_templates/ My_Template_ID /export
cat Example_Template .json { "name": " Example Template Name ", "template": " Enter ERB Code Here " }
name: Hosts - complete list
template:  <%# name: Hosts - complete list snippet: false template_inputs: - name: host required: false input_type: user advanced: false value_type: plain resource_type: Katello::ActivationKey model: ReportTemplate -%> <% load_hosts(search: input('host')).each_record do |host| -%> <% report_row( 'Server FQDN': host.name ) -%> <% end -%> <%= report_render %> 
curl --insecure --user My_User_Name : My_Password --data @ Example_Template .json --header "Content-Type:application/json" --request POST --config https:// satellite.example.com /api/report_templates/import
curl --insecure --user My_User_Name : My_Password --request GET --config https:// satellite.example.com /api/report_templates | json_reformat
hammer host-collection create --name " My_Host_Collection " --organization " My_Organization "
hammer host-collection add-host --host-ids My_Host_ID_1 --id My_Host_Collection_ID
hammer host-collection add-host --host-ids My_Host_ID_1 , My_Host_ID_2 --id My_Host_Collection_ID
subscription-manager refresh
name = Reboot and host.name = staging.example.com name = Reboot and host.name ~ *.staging.example.com name = "Restart service" and host_group.name = webservers
satellite-installer --foreman-proxy-plugin-remote-execution-script-mode=ssh
dnf install katello-pull-transport-migrate
yum install katello-pull-transport-migrate
systemctl status yggdrasild
hammer job-template create --file " Path_to_My_Template_File " --job-category " My_Category_Name " --name " My_Template_Name " --provider-type SSH
curl --header 'Content-Type: application/json' --request GET https:// satellite.example.com /ansible/api/v2/ansible_playbooks/fetch?proxy_id= My_Capsule_ID
curl --data '{ "playbook_names": [" My_Playbook_Name "] }' --header 'Content-Type: application/json' --request PUT https:// satellite.example.com /ansible/api/v2/ansible_playbooks/sync?proxy_id= My_Capsule_ID
curl -X PUT -H 'Content-Type: application/json' https:// satellite.example.com /ansible/api/v2/ansible_playbooks/sync?proxy_id= My_Capsule_ID
hammer settings set --name=remote_execution_fallback_proxy --value=true
hammer settings set --name=remote_execution_global_proxy --value=true
mkdir /My_Remote_Working_Directory
chcon --reference=/var/tmp /My_Remote_Working_Directory
satellite-installer --foreman-proxy-plugin-remote-execution-script-remote-working-dir /My_Remote_Working_Directory
mkdir /My_Remote_Working_Directory
systemctl edit yggdrasild
Environment=FOREMAN_YGG_WORKER_WORKDIR= /My_Remote_Working_Directory
systemctl restart yggdrasild
ssh-copy-id -i ~foreman-proxy/.ssh/id_rsa_foreman_proxy.pub root@client.example.com
ssh -i ~foreman-proxy/.ssh/id_rsa_foreman_proxy root@client.example.com
ssh-keygen -p -f ~foreman-proxy/.ssh/id_rsa_foreman_proxy
mkdir ~/.ssh
curl https:// capsule.example.com :9090/ssh/pubkey >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
<%= snippet 'remote_execution_ssh_keys' %>
id -u foreman-proxy
umask 077
mkdir -p "/var/kerberos/krb5/user/ My_User_ID "
cp My_Client.keytab /var/kerberos/krb5/user/ My_User_ID /client.keytab
chown -R foreman-proxy:foreman-proxy "/var/kerberos/krb5/user/ My_User_ID "
chmod -wx "/var/kerberos/krb5/user/ My_User_ID /client.keytab"
restorecon -RvF /var/kerberos/krb5
satellite-installer --foreman-proxy-plugin-remote-execution-script-ssh-kerberos-auth true
hostgroup_fullname ~ " My_Host_Group *"
hammer settings set --name=remote_execution_global_proxy --value=false
hammer job-template list
hammer job-template info --id My_Template_ID
hammer job-invocation create --inputs My_Key_1 =" My_Value_1 ", My_Key_2 =" My_Value_2 ",... --job-template " My_Template_Name " --search-query " My_Search_Query "
satellite-installer --foreman-proxy-plugin-remote-execution-script-mqtt-rate-limit MAX_JOBS_NUMBER
satellite-installer --foreman-proxy-plugin-remote-execution-script-mqtt-rate-limit 200
global_status = ok
global_status = error or global_status = warning
status.pending > 0
status.restarted > 0
status.interesting = true
curl https:// satellite.example.com /api/job_invocations -H "content-type: application/json" -X POST -d @ Path_To_My_API_Request_Body -u My_Username : My_Password | python3 -m json.tool
{ "job_invocation" : { "concurrency_control" : { "concurrency_level" : 100 }, "feature" : "katello_package_install", "inputs" : { "package" : "nano vim" }, "scheduling" : { "start_at" : "2023-09-21T19:00:00+00:00", "start_before" : "2023-09-23T00:00:00+00:00" }, "search_query" : "*", "ssh" : { "effective_user" : "My_Username", "effective_user_password" : "My_Password" }, "targeting_type" : "dynamic_query" } }
curl https:// satellite.example.com /api/job_invocations -H "content-type: application/json" -X POST -d @ Path_To_My_API_Request_Body -u My_Username : My_Password | python3 -m json.tool
{ "job_invocation" : { "concurrency_control" : { "concurrency_level" : 100 }, "feature" : "katello_package_update", "inputs" : { "package" : "nano vim" }, "scheduling" : { "start_at" : "2023-09-21T19:00:00+00:00", "start_before" : "2023-09-23T00:00:00+00:00" }, "search_query" : "*", "ssh" : { "effective_user" : "My_Username", "effective_user_password" : "My_Password" }, "targeting_type" : "dynamic_query" } }
curl https:// satellite.example.com /api/job_invocations -H "content-type: application/json" -X POST -d @ Path_To_My_API_Request_Body -u My_Username : My_Password | python3 -m json.tool
{ "job_invocation" : { "concurrency_control" : { "concurrency_level" : 100 }, "feature" : "katello_package_remove", "inputs" : { "package" : "nano vim" }, "scheduling" : { "start_at" : "2023-09-21T19:00:00+00:00", "start_before" : "2023-09-23T00:00:00+00:00" }, "search_query" : "*", "ssh" : { "effective_user" : "My_Username", "effective_user_password" : "My_Password" }, "targeting_type" : "dynamic_query" } }
rpm --query yggdrasil
systemctl status yggdrasil com.redhat.Yggdrasil1.Worker1.foreman
dnf install foreman_ygg_migration
systemctl status yggdrasil com.redhat.Yggdrasil1.Worker1.foreman
<% if @host.operatingsystem.family == "Redhat" && @host.operatingsystem.major.to_i > 6 -%> systemctl <%= input("action") %> <%= input("service") %> <% else -%> service <%= input("service") %> <%= input("action") %> <% end -%>
echo <%= @host.name %>
host.example.com
<% server_name = @host.fqdn %> <%= server_name %>
host.example.com
<%= @ example_incorrect_variable .fqdn -%>
undefined method `fqdn' for nil:NilClass
<%= "line1" %> <%= "line2" %>
line1 line2
<%= "line1" -%> <%= "line2" %>
line1line2
<%= @host.fqdn -%> <%= @host.ip -%>
host.example.com10.10.181.216
<%# A comment %>
<%- load_hosts.each do |host| -%> <%- if host.build? %> <%= host.name %> build is in progress <%- end %> <%- end %>
<%= input('cpus') %>
<%- load_hosts().each_record do |host| -%> <%= host.name %>
<% load_hosts(search: input(' Example_Host ')).each_record do |host| -%> <%= host.name %> <% end -%>
<%- load_hosts(search: input(' Example_Host ')).each_record do |host| -%> <%- report_row( 'Server FQDN': host.name ) -%> <%- end -%> <%= report_render -%>
Server FQDN host1.example.com host2.example.com host3.example.com host4.example.com host5.example.com host6.example.com
<%- load_hosts(search: input('host')).each_record do |host| -%> <%- report_row( 'Server FQDN': host.name, 'IP': host.ip ) -%> <%- end -%> <%= report_render -%>
Server FQDN,IP host1.example.com , 10.8.30.228 host2.example.com , 10.8.30.227 host3.example.com , 10.8.30.226 host4.example.com , 10.8.30.225 host5.example.com , 10.8.30.224 host6.example.com , 10.8.30.223
<%= report_render -%>
truthy?("true") => true truthy?(1) => true truthy?("false") => false truthy?(0) => false
falsy?("true") => false falsy?(1) => false falsy?("false") => true falsy?(0) => true
<% @host.ip.split('.').last %>
<% load_hosts().each_record do |host| -%> <% if @host.name == " host1.example.com " -%> <% result="positive" -%> <% else -%> <% result="negative" -%> <% end -%> <%= result -%>
host1.example.com positive
<%= @host.interfaces -%>
<Nic::Base::ActiveRecord_Associations_CollectionProxy:0x00007f734036fbe0>
[] each find_in_batches first map size to_a
alias? attached_devices attached_devices_identifiers attached_to bond_options children_mac_addresses domain fqdn identifier inheriting_mac ip ip6 link mac managed? mode mtu nic_delay physical? primary provision shortname subnet subnet6 tag virtual? vlanid
<% load_hosts().each_record do |host| -%> <% host.interfaces.each do |iface| -%> iface.alias?: <%= iface.alias? %> iface.attached_to: <%= iface.attached_to %> iface.bond_options: <%= iface.bond_options %> iface.children_mac_addresses: <%= iface.children_mac_addresses %> iface.domain: <%= iface.domain %> iface.fqdn: <%= iface.fqdn %> iface.identifier: <%= iface.identifier %> iface.inheriting_mac: <%= iface.inheriting_mac %> iface.ip: <%= iface.ip %> iface.ip6: <%= iface.ip6 %> iface.link: <%= iface.link %> iface.mac: <%= iface.mac %> iface.managed?: <%= iface.managed? %> iface.mode: <%= iface.mode %> iface.mtu: <%= iface.mtu %> iface.physical?: <%= iface.physical? %> iface.primary: <%= iface.primary %> iface.provision: <%= iface.provision %> iface.shortname: <%= iface.shortname %> iface.subnet: <%= iface.subnet %> iface.subnet6: <%= iface.subnet6 %> iface.tag: <%= iface.tag %> iface.virtual?: <%= iface.virtual? %> iface.vlanid: <%= iface.vlanid %> <%- end -%>
host1.example.com iface.alias?: false iface.attached_to: iface.bond_options: iface.children_mac_addresses: [] iface.domain: iface.fqdn: host1.example.com iface.identifier: ens192 iface.inheriting_mac: 00:50:56:8d:4c:cf iface.ip: 10.10.181.13 iface.ip6: iface.link: true iface.mac: 00:50:56:8d:4c:cf iface.managed?: true iface.mode: balance-rr iface.mtu: iface.physical?: true iface.primary: true iface.provision: true iface.shortname: host1.example.com iface.subnet: iface.subnet6: iface.tag: iface.virtual?: false iface.vlanid:
<% pm_set = @host.puppetmaster.empty? ? false : true puppet_enabled = pm_set || host_param_true?('force-puppet') puppetlabs_enabled = host_param_true?('enable-puppetlabs-repo') %>
<% os_major = @host.operatingsystem.major.to_i os_minor = @host.operatingsystem.minor.to_i %> <% if ((os_minor < 2) && (os_major < 14)) -%> <% end -%>
<%= indent 4 do snippet 'subscription_manager_registration' end %>
<% subnet = @host.subnet %> <% if subnet.respond_to?(:dhcp_boot_mode?) -%> <%= snippet 'kickstart_networking_setup' %> <% end -%>
'Serial': host.facts['dmi::system::serial_number'], 'Encrypted': host.facts['luks_stat'],
<%- report_row( 'Host': host.name, 'Operating System': host.operatingsystem, 'Kernel': host.facts['uname::release'], 'Environment': host.single_lifecycle_environment ? host.single_lifecycle_environment.name : nil, 'Erratum': erratum.errata_id, 'Type': erratum.errata_type, 'Published': erratum.issued, 'Applicable since': erratum.created_at, 'Severity': erratum.severity, 'Packages': erratum.package_names, 'CVEs': erratum.cves, 'Reboot suggested': erratum.reboot_suggested, ) -%>
<%= render_template 'Package Action - SSH Default', :action => 'install', :package => 'nginx' %> <%= render_template 'Service Action - SSH Default', :action => 'start', :service_name => 'nginx' %>
<%= render_template 'Package Action - SSH Default', :action => 'install', :package => input("package") %>
restorecon -RvF <%= input("directory") %>
<%= render_template("Run Command - restorecon", :directory => "/home") %>
<%= render_template("Power Action - SSH Default", :action => "restart") %>