Bug 1468906 - [RFE] [6.3] Creating hostgroups script
[RFE] [6.3] Creating hostgroups script
Status: CLOSED NOTABUG
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Docs Hammer CLI Guide (Show other bugs)
6.2.10
x86_64 Linux
medium Severity medium (vote)
: Beta
: 6.X
Assigned To: Sergei Petrosian
Stephen Wadeley
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-09 12:55 EDT by Shadd
Modified: 2017-08-31 10 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-31 09:21:19 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Example on Creating Multiple Host Groups (985 bytes, text/plain)
2017-08-31 10:14 EDT, Sergei Petrosian
no flags Details

  None (edit)
Description Shadd 2017-07-09 12:55:20 EDT
Document URL: 
https://access.redhat.com/documentation/en-us/red_hat_satellite/6.2/html-single/hammer_cli_guide/#sect-CLI_Guide-Creating_a_Host_Group

Section Number and Name: 
6.1. Creating a Host Group

Describe the issue:
Only useful if a customer wants a single Environment 
If ran as is Parent_ID and HgID can provide multiple ids and the script is not in a loop  so it fails with to many variables 

Suggestions for improvement: 
Verify correct variables are in /root/.bashrc or add them into script
ARCH=
DOMAIN=
PROXYID=
NETNAME=
CAID=
MEDID=
ORGID=
LOCID=
OSID=
PARTTABLEID=

source /root/.bashrc

Set variables for loop

ENVIROMENT=$(hammer environment list |awk -F "|" {'print $2'}|grep -v -|grep -v NAME |sed 's/ //g' |grep -v production)
LEL=$(hammer lifecycle-environment list --organization $ORG |awk -F "|" {'print $2'}|grep -v - |grep -v NAME)

for loop to add hostgroups
for i in $ENVIROMENT; do for j in $(hammer --csv environment list |awk -F "," {'print $2'}| awk -F "_" {'print $3'}); do hammer hostgroup create --name rhel-7-"$j" --environment "$i" --architecture "$ARCH" --domain "$DOMAIN" --subnet "$NETNAME" --puppet-proxy-id "$PROXYID" --puppet-ca-proxy-id "$CAID" --medium-id "$MEDID" --organization-ids "$ORGID" --location-ids "$LOCID" --operatingsystem-id "$OSID" --partition-table-id $PARTTABLEID ; done; done


Additional information:
Comment 1 Andrew Dahms 2017-07-13 01:37:40 EDT
Assigning to Sergei for review.
Comment 4 Shadd 2017-08-30 13:43:42 EDT
What info can I provide to close this ticket?
Comment 7 Sergei Petrosian 2017-08-31 10:14 EDT
Created attachment 1320608 [details]
Example on Creating Multiple Host Groups

Find working document with the example of script on creating multiple host groups in the attachment.

Note You need to log in before you can comment on or make changes to this bug.