Sync last changes
This commit is contained in:
27
utils/sample_inv.sh
Executable file
27
utils/sample_inv.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
HOSTS=${1:-1}
|
||||
|
||||
RUN_DATE=`date`
|
||||
|
||||
BASE_URL="tower2.thezengarden.net"
|
||||
#AAP_INVENTORY=9
|
||||
AAP_INVENTORY=27
|
||||
POST_PAYLOAD_PATH="post.add_host"
|
||||
POST_PAYLOAD_TYPE="application/json"
|
||||
|
||||
#TOWER_TOKEN="jQwHURhs9fNNyombPLEAK8a2vRmmBQ"
|
||||
TOWER_TOKEN="YtLStVtkMGKxnWinslNiqDgYwZqKfM"
|
||||
|
||||
|
||||
for i in $(seq $HOSTS)
|
||||
do
|
||||
time curl -s -k -H "Authorization: Bearer ${TOWER_TOKEN}" \
|
||||
-H "Content-type: ${POST_PAYLOAD_TYPE}" \
|
||||
-X POST \
|
||||
-d "{\"name\": \"sample-host-${i}\", \"description\": \"added via sample_inv.sh\"}" \
|
||||
"https://${BASE_URL}/api/v2/inventories/${AAP_INVENTORY}/hosts/" | jq '{created_time:.["created"], hostname:.["name"], inventory:.["summary_fields"]["inventory"]["name"]}'
|
||||
echo
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user