Hi Paul, Thanks for the example. So, your script accepts input for things like OS version/environment/CPU and then reads a CSV which contains things like the hostname/IP/location/etc? Are you executing separate hammer commands to retrieve the ID of some properties (like location, compute resource ID, etc)?
If you could share a stripped down/minimalist version of your script, I think everyone would really appreciate it. Thanks! Josh On Mon, Nov 21, 2016 at 2:30 PM, Paul Seymour <[email protected]> wrote: > Hi Josh, > > I cannot give you the full details as my company doesn't allow that sort > of thing. But 1st cut of this loops around a CSV input file to create hosts > and allocate them to the correct ESX compute resource. We input OS version, > environment (Dev, UAT, Prod etc) the amount of CPU/RAM/Disk size. > > It does some hammer commands to get some of the ID's etc from some more > basic inputs like OS version (6 or 7 and the media etc as most are held in > deterministic hostgroups - i.e. DEV-RHEL7) but the command that is run to > allocate hosts and then build them is:- > > hammer --username "${SATUSER}" --password "${SATPWD}" host create \ > --name="${NAME}" \ > --organization-id=1 \ > --location-id="${LOCATION_ID}" \ > --hostgroup-id="${HOSTGROUP_ID}" \ > --compute-resource-id="${COMPUTE_RESOURCE_ID}" \ > --compute-profile-id='4' \ > --environment-id="${ENVIRONMENT_ID}" \ > --managed=true \ > --partition-table-id=83 \ > --medium-id="${MEDIUM_ID}" \ > --domain-id="${DOMAIN_ID}" \ > --root-pass='template' \ > --architecture="${ARCHITECTURE}" \ > --compute-resource="${COMPUTE_RESOURCE}" \ > --provision-method=build \ > --subnet-id="${SUBNET_ID}" \ > --interface="identifier=\"eth0\",primary=true,provision= > true,managed=true,virtual=false,type=\"Nic::Managed\", > compute_type=\"${INTTYPE}\",ip=${IP},subnet_id=${SUBNET_ > ID},compute_network=\"${ESXNETWORK}\"" \ > --compute-attributes="cluster=\"${ESXCLUSTER}\",cpus=${ > CPUCOUNT},corespersocket=${CORECOUNT},path=\"${ESXPATH}\" > ,memory_mb=${MEMMB},guest_id=${GUEST_ID},start=1,hardware_ > version=vmx-10,scsi_controller_type=\"${SCSICTRL}\",memoryHotAddEnabled=1,cpuHotAddEnabled=1" > \ > --volume="datastore=${ESXDATASTORE},name='\''Hard > disk'\'',size_gb=${DISKSIZE},thin=true,eager_zero=false" \ > --operatingsystem-id=${OSID} \ > --puppet-proxy-id=1 \ > --puppet-ca-proxy-id=1 \ > --owner-id="${SATUSERID}" \ > --build=true \ > --comment="Build via script on $(date)" \ > --ip="${IP}" > > Hope this helps a little if you need more help I can expand as much as I > can. > > Cheers > Paul > > On Monday, 21 November 2016 18:54:45 UTC, Josh wrote: >> >> Just curious if anyone here has managed to fully provision a VMWare VM >> using Hammer (selecting datastores, VM resources, etc)? If so, could you >> share an example syntax? >> > -- > You received this message because you are subscribed to the Google Groups > "Foreman users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Foreman users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/foreman-users. For more options, visit https://groups.google.com/d/optout.
