Naast het installeren van de SaltStack Config-server moet vRealize Suite Lifecycle Manager extra taken uitvoeren ter ondersteuning van de integratie met vRealize Automation.
Als vRealize Suite Lifecycle Manager de SaltStack Config-service installeert, wordt de SaltStack Config-server als integratieserviceaccount aan vRealize Automation toegevoegd en wordt een nieuwe vRealize Automation-eigenschapsgroep gemaakt met het adres en de vingerafdruk van de Salt-master.
De volgende codefragmenten bieden een kijk achter de schermen van de API-aanroepen die vRealize Suite Lifecycle Manager gebruikt wanneer de SaltStack Config-service voor vRealize Automation wordt geïnstalleerd en geconfigureerd.
Een SaltStack-integratieaccount maken
POST https://<vRA_hostname>/provisioning/uerp/provisioning/mgmt/endpoints?enhance Collapse source curl --location --request POST 'https://<vRA_hostname>/provisioning/uerp/provisioning/mgmt/endpoints?enhance' \ --header 'Authorization: Bearer <token>' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data-raw '{ "endpointProperties": { "privateKeyId":"<SaltStackConfigServer_Username>", "privateKey":"<SaltStackConfigServer_Password>", "hostName": "<SaltStackConfigServer_Hostname>" }, "customProperties": { "isExternal":"true" }, "endpointType":"saltstack", "name":"SaltStack Configuration Server" }'
Een lijst met SaltStack-integratieaccounts krijgen
GET https://<vRA_hostname>/provisioning/uerp/provisioning/mgmt/endpoints?expand&external&$filter=(endpointType eq 'saltstack' and customProperties.isExternal eq 'true')&$orderby=name asc&$top=20&$skip=0 Collapse source curl --location --request GET 'https://<vRA_hostname>/provisioning/uerp/provisioning/mgmt/endpoints?expand&external&$filter=(endpointType%20eq%20%27saltstack%27%20and%20customProperties.isExternal%20eq%20%27true%27)&$orderby=name%20asc&$top=20&$skip=0' \ --header 'Authorization: <token>' URL: GET https://tenant1-200.lcm-34-209.sqa.local/provisioning/uerp/provisioning/mgmt/endpoints?expand&external&$filter=(endpointType eq 'saltstack' and customProperties.isExternal eq 'true')&$orderby=name asc&$top=20&$skip=0
Een SaltStack-integratieaccount verwijderen
DELETE https://<vRA_HostName>/provisioning/uerp/provisioning/mgmt/endpoints/resources/endpoints/<EndpointID>?external Collapse source curl --location --request DELETE 'https://<vRA_HostName>/provisioning/uerp/provisioning/mgmt/endpoints/resources/endpoints/<EndpointID>?external' \ --header 'Authorization: Bearer <token>' EndpointID should be the the id from documentSelfLink of the endpoint state
Een eigenschapsgroep maken die het adres en de vingerafdruk van de Salt-master bevat
POST https://<vRA_hostname>/properties/api/property-groups Collapse source curl --location --request POST 'https://cava-6-243-085.eng.vmware.com/properties/api/property-groups' \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data-raw '{ "id": null, "name": "SaltStackConfiguration", "displayName": "SaltStack Config Server Properties", "description": "Property Group with SaltStack Config server details such as master address, and fingerprint.", "projectId": null, "versions": null, "type": "CONSTANT", "properties": { "masterAddress": { "type": "string", "description": "Salt Master address associated with SaltStack Config Server.", "const": "cava-6-242-179.eng.vmware.com" }, "masterFingerPrint": { "type": "string", "description": "Salt Master finger print", "const": "aa:94:91:1b:03:5e:dd:39:35:86:ce:7e:2b:4d:12:a5:1c:35:f9:c9:ac:c6:55:18:2d:80:58:32:6f:c2:ac:e1" } } }'
Een vRealize Automation-URL toevoegen aan de SaltStack Config-server
Met deze volgorde kan de gebruiker van de SaltStack Config-integratie navigeren naar vRealize Automation. In een vRealize Automation-omgeving leidt de URL de gebruiker naar de gekoppelde tenant.
Dit proces bestaat uit meerdere stappen omdat het XSRF-token moet worden verkregen voordat u andere API's aanroept.
/version
API aan en haal de XSRF-tokenkoptekst op uit de antwoordkopteksten.
GET https://<SSC_server>/version Collapse source curl --location -k -v --request GET 'https://<SaltStackConfigServer_Hostname>/account/info' \ --header 'Authorization: Basic cm9vdDpzYWx0'
/account/login
API aan om het JWT-token op te halen die u als bearer-token voor de volgende API's wilt gebruiken.
POST https://<SSC_server>/account/login Collapse source curl --location --request POST 'https://<SaltStackConfigServer_Hostname>/account/login' \ --header 'X-Xsrftoken: <XSRF_Token_from_Response_Headers_of_Version_API>' \ --header 'Content-Type: application/json' \ --header 'Authorization: Basic cm9vdDpzYWx0' \ --header 'Cookie: _xsrf=<XSRF_Token_from_Response_Headers_of_Version_API>' \ --data-raw '{"password":"<SaltStackConfigServer_Password>","username":"<SaltStackConfigServer_Hostname>","config_name":"internal","token_type":"jwt"}'
/rpc
API aan om
vRealize Automation-parameters op de
SaltStack Config-server op te slaan.
POST https://<SSC_server>/account/login Collapse source curl --location --request POST 'https://<SaltStackConfigServer_Hostname>/account/rpc' \ --header 'X-Xsrftoken: <XSRF_Token_from_Response_Headers_of_Version_API>' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <JWT_from_Response_of_Login_API>' \ --header 'Cookie: _xsrf=<XSRF_Token_from_Response_Headers_of_Version_API>' \ --data-raw '{"resource":"admin","method":"save_vra_params","kwarg":{"url": "<vRA_Tenant_Specific_URL>"}}' Example: curl --location --request POST 'https://10.206.242.179/account/rpc' \ --header 'X-Xsrftoken: 2|4ca0b854|2dcdd4842fe32484d394740aa388b397|1604424534' \ --header 'Content-Type: application/json' \ --header 'Authorization: Basic cm9vdDpzYWx0' \ --header 'Cookie: _xsrf=2|4ca0b854|2dcdd4842fe32484d394740aa388b397|1604424534' \ --data-raw '{"resource":"admin","method":"save_vra_params","kwarg":{"url": "https://cava-n-81-037.eng.vmware.com/csp/gateway/portal"}}'
Werk de CSP-definities bij in het vRealize Automation-menu.
De hostgegevens van SaltStack Config moeten worden bijgewerkt om het vRealize Automation-pictogram en de aanmeldpagina in de vRealize Automation-omgeving weer te geven.
POST https://<vRA_hostname>/csp/gateway/am/api/auth/authorize Collapse source curl --location --request POST 'https://<vRA_Hostname>/csp/gateway/am/api/auth/authorize' \ --header 'Authorization: Basic cHJvdmlzaW9uaW5nLWlrbzVjb29sWWh0dHVFT286Uld1RFNvYVl2UG05OHVlWm40Q3I3VXY3enZPQ3hIWVA=' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=client_credentials' \ --data-urlencode 'orgId=<Org_Id>'
GET https://<vRA_hostname>/csp/gateway/slc/api/definitions Collapse source curl --location --request GET 'https://cava-n-81-037.eng.vmware.com/csp/gateway/slc/api/definitions' \ --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjUxMDUyOTk3MDIzOTQ0MTQzMjgifQ.eyJpc3MiOiJDTj1QcmVsdWRlIElkZW50aXR5IFNlcnZpY2UsT1U9Q01CVSxPPVZNd2FyZSxMPVNvZmlhLFNUPVNvZmlhLEM9QkciLCJpYXQiOjE2MDUxNTQxNDQsImV4cCI6MTYwNTE4Mjk0NCwianRpIjoiMTVmODg3NWItMWIwMi00MWU4LTlmOWUtNTRjZGIxMDM2ODhiIiwiY29udGV4dCI6IjNhZjI0NGQ5LTM0ZWEtNDI3MS1hNDc0LTE3ZWNkZDQ2NTcxOSIsImF6cCI6InByb3Zpc2lvbmluZy1udmVTSTFQVXlmU0luSldhIiwic3ViIjoicHJvdmlzaW9uaW5nLW52ZVNJMVBVeWZTSW5KV2EiLCJwcm5fdHlwZSI6IlNFUlZJQ0UiLCJwZXJtcyI6W10sImNvbnRleHRfbmFtZSI6ImRlZmF1bHQifQ.fgnNx1VvM71GgPeVs7E4y8-OSQ53txR1EJt12_nmWbWbCXaZPu8EYlyYmIoGQbN1RzT-nlgm7V74HAPyp4BwBanCR6aim9KnZHX7LZdVLeyQ1ehmMd2lQXPLxCQj7nzS1Ov3uaR_OdQWMsasFEMi_uU5qNn0QBXFGUPXzGB8OYxvEzFlTJKlPgvNNHdm2OVMn4a5i5g90bx_6IzzHkgyOd2OuNQPf7H3mc9PPoQ_jtpYVYSumPDeoRZ7w1_ogdpbTKrr_AddTCqbMztno81a-9bQeEEY8e8BYM56cGGGL-4wM3AX4FdcI4dWW0hOO69MGLUtts7_6GFACAOCQuDx8g' \ --data-raw ''