Skip to content

Instantly share code, notes, and snippets.

@safeaim
Last active January 10, 2019 19:27
Show Gist options
  • Save safeaim/bdd2a15606985c18df9e95d98a7c640a to your computer and use it in GitHub Desktop.
Save safeaim/bdd2a15606985c18df9e95d98a7c640a to your computer and use it in GitHub Desktop.
vRA - Publish vRA blueprints.json
# Get all your blueprints
curl -X GET \
https://$VRAURL/composition-service/api/blueprintdocuments/ \
-H 'Accept: application/json' \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
# Get a blueprint
curl -X GET \
https://$VRAURL/composition-service/api/blueprintdocuments/MyDevBlueprint \
-H 'Accept: application/json' \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
# This is the result from the single blueprint
'{
"status": "PUBLISHED",
"layout": {
"MyDevBlueprint": "0,0"
},
"id": "MyDevBlueprint",
"name": "MyDevBlueprint",
"description": "My Dev Blueprint",
"propertyGroups": [],
"properties": null,
"components": {
"MyDevBlueprint": {
"type": "Infrastructure.CatalogItem.Machine.Virtual.vSphere",
"propertyGroups": [
"NetworkDictionary",
],
"dependsOn": [],
"data": {
"provisioning_workflow": {
"fixed": {
"id": "CloneWorkflow",
"label": "CloneWorkflow"
}
},
"source_machine": {
"fixed": {
"id": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"label": "windows-2016-gold-template"
}
},
"memory": {
"default": 8192,
"min": 8192,
"max": 8192
},
"disks": [
{
"is_clone": true,
"initial_location": "",
"volumeId": 0,
"id": 1536150165221,
"label": "Hard disk 1",
"custom_properties": null,
"userCreated": false,
"storage_reservation_policy": "",
"capacity": 100
}
],
"blueprint_type": {
"fixed": "1"
},
"cpu": {
"default": 2,
"min": 2,
"max": 2
},
"description": "My Dev ",
"storage": {
"default": 100,
"min": 100,
"max": 100
},
"source_machine_name": {
"fixed": "windows-2016-gold-template"
},
"guest_customization_specification": "MyGuestCustomSpec",
"FRITTNAVN": {
"default": "",
"visible": true,
"secured": false,
"required": true
},
"_cluster": {
"default": 1,
"min": 1,
"max": 1
},
"security_groups": [],
"reservation_policy": {
"id": "esx-cluster",
"label": "esx-cluster"
},
"max_network_adapters": {},
"max_volumes": {},
"action": {
"fixed": "FullClone"
},
"security_tags": [],
"allow_storage_policies": {
"fixed": false
}
},
"componentProfiles": []
}
}
}'
# Change status in the JSON-blob to DRAFT, and you're good to go
curl -X PUT \
https://$VRAURL/composition-service/api/blueprintdocuments/MyDevBlueprint \
-H 'Accept: application/json' \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"status": "DRAFT",
"layout": {
"MyDevBlueprint": "0,0"
},
"id": "MyDevBlueprint",
"name": "MyDevBlueprint",
"description": "My Dev Blueprint",
"propertyGroups": [],
"properties": null,
"components": {
"MyDevBlueprint": {
"type": "Infrastructure.CatalogItem.Machine.Virtual.vSphere",
"propertyGroups": [
"NetworkDictionary",
],
"dependsOn": [],
"data": {
"provisioning_workflow": {
"fixed": {
"id": "CloneWorkflow",
"label": "CloneWorkflow"
}
},
"source_machine": {
"fixed": {
"id": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"label": "windows-2016-gold-template"
}
},
"memory": {
"default": 8192,
"min": 8192,
"max": 8192
},
"disks": [
{
"is_clone": true,
"initial_location": "",
"volumeId": 0,
"id": 1536150165221,
"label": "Hard disk 1",
"custom_properties": null,
"userCreated": false,
"storage_reservation_policy": "",
"capacity": 100
}
],
"blueprint_type": {
"fixed": "1"
},
"cpu": {
"default": 2,
"min": 2,
"max": 2
},
"description": "My Dev ",
"storage": {
"default": 100,
"min": 100,
"max": 100
},
"source_machine_name": {
"fixed": "windows-2016-gold-template"
},
"guest_customization_specification": "MyGuestCustomSpec",
"FRITTNAVN": {
"default": "",
"visible": true,
"secured": false,
"required": true
},
"_cluster": {
"default": 1,
"min": 1,
"max": 1
},
"security_groups": [],
"reservation_policy": {
"id": "esx-cluster",
"label": "esx-cluster"
},
"max_network_adapters": {},
"max_volumes": {},
"action": {
"fixed": "FullClone"
},
"security_tags": [],
"allow_storage_policies": {
"fixed": false
}
},
"componentProfiles": []
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment