mirror of
https://github.com/armbian/actions.git
synced 2026-01-06 10:36:19 -08:00
Add support for Netbox API parameter
This commit is contained in:
@@ -29,6 +29,9 @@ inputs:
|
||||
netbox:
|
||||
description: NetboxID
|
||||
required: true
|
||||
netboxapi:
|
||||
description: NetboxAPI
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
@@ -80,10 +83,10 @@ runs:
|
||||
for server_id in ${{ inputs.failoverserver }}; do
|
||||
unset REGION LATITUDE LONGITUDE PHYSICAL TIME_ZONE UPLOAD
|
||||
# read virtual machine
|
||||
COMMAND=$(curl -sH "Authorization: Token ${{ inputs.netbox }}" -H "Accept: application/json; indent=4" "https://stuff.armbian.com/netbox/api/virtualization/virtual-machines/${server_id}/" | jq)
|
||||
COMMAND=$(curl -sH "Authorization: Token ${{ inputs.netbox }}" -H "Accept: application/json; indent=4" "${{ inputs.netboxapi }}/api/virtualization/virtual-machines/${server_id}/" | jq)
|
||||
IFS=',' read -r SITE_ID NAME DL_PATH_DEBS DL_PATH_IMAGES WEIGHT <<<$(echo $COMMAND | jq '.site.id,.name,.custom_fields["download_path_debs"],.custom_fields["download_path_images"],.custom_fields["weight"]' | sed 's/$/,/' | xargs | sed 's/, /,/g')
|
||||
# site data
|
||||
COMMAND=$(curl -sH "Authorization: Token ${{ inputs.netbox }}" -H "Accept: application/json; indent=4" "https://stuff.armbian.com/netbox/api/dcim/sites/${SITE_ID}/" | jq)
|
||||
COMMAND=$(curl -sH "Authorization: Token ${{ inputs.netbox }}" -H "Accept: application/json; indent=4" "${{ inputs.netboxapi }}/api/dcim/sites/${SITE_ID}/" | jq)
|
||||
IFS=',' read REGION LATITUDE LONGITUDE PHYSICAL TIME_ZONE UPLOAD DOWNLOAD_EXCLUDE <<<$(echo $COMMAND | jq -r '.region.name,.latitude,.longitude,.physical_address,.time_zone,.custom_fields["upload_speed"],.custom_fields["download_exclude"]' | sed 's/$/,/' | xargs | sed 's/, /,/g')
|
||||
echo "" >> dlrouter-${FILENAME}.yaml
|
||||
|
||||
|
||||
Reference in New Issue
Block a user