Skip to main content

VMware Cloud Foundation APIs: Deploying VCF Automation

 

VMware Cloud Foundation APIs: Deploying VCF Automation

Whilst VCF Automation is typically deployed during the initial VMware Cloud Foundation deployment phase via VCF Installer it is possible to skip the deployment initially for various reasons such as may you don’t have a use case initially or you want to deploy to a different network that is not available at the time. Under such scenarios you can easily deploy as a Day N task.

In this post we will look at how the VCF Automation component can be deployed using the public APIs, this is achieved via the VCF Fleet Lifecycle Service which is tightly integrated into VCF Operations.

VCF Fleet Lifecycle Service APIs Used

VCF Fleet LCM Service APIs

  • POST /api/v1/identity/token
  • GET /fleet-lcm/v1/sddc-lcms
  • POST /fleet-lcm/v1/components/validations
  • POST /fleet-lcm/v1/components
  • GET /fleet-lcm/v1/tasks/{taskId}

Procedure

  1. Connect to a system that has access to the infrastructure and is capable of running CURL.

  2. Replace the values in the sample code with values for your VCF Fleet Lifecycle Service and paste the commands in the console. If your not sure which endpoint this FQDN should be log into VCF Operations, go to Build > Lifecycle > VCF Management and select the Components tab and locate the component named Fleet lifecycle the FQDN is shown in the FQDN column.

export vcfFleetLifecycleFqdn='flt-fc01.rainpole.io'
export vcfFleetLifecycleUser='admin@vsp.local'
export vcfFleetLifecyclePass='VMw@re1!VMw@re1!'
  1. Authenticate to the VCF Fleet Lifecycle Service and obtain a token by running the following command:
vcfFleetLifecycleToken=$(curl -k -X POST "https://$vcfFleetLifecycleFqdn/api/v1/identity/token" \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data "grant_type=password" \
    --data "username=$vcfFleetLifecycleUser" \
    --data "password=$vcfFleetLifecyclePass" \
    | jq -r '.access_token')
  1. Verify you successfully obtained an authentication token by running the following command:
echo $vcfFleetLifecycleToken

Example Output:

eyJhbGciOiJFZERTQSIsImtpZCI6Ilg4Mk5veGNJRlVCVEFiY0xPM1NUdU12UTF6Qlo4d01xeUxDTGNuOGZYdFUiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2ZsdC1mYzAxLnJhaW5wb2xlLmlvIiwic3ViIjoiYWRtaW5AdnNwLmxvY2FsIiwiYXVkIjpbInZzcCJdLCJleHAiOjE3ODM0MzU1NTIsImlhdCI6MTc4MzQyMTE1MiwianRpIjoiMjA3OTg0MDgtZGE3OC00N2UzLTgxMDctNDAyMThkNjM1ZThmIiwiYXpwIjoicGFzc3dvcmRfZ3JhbnRfY2xpZW50IiwiYWNjdCI6ImFkbWluQHZzcC5sb2NhbCIsImF1dGhvcml6YXRpb25fZGV0YWlscyI6bnVsbH0.OsXjW3cgwZaEMXwZC6MOqOped5MX1wdf3wpUmjZLaRiXeug4rtm9dnWHvPrp5pM74MNsVEjhbeT3u0TJjgIIBQ

  1. First we retrieve the unique ID of the SDDC instance by running the following command:
primarySddcLcms=$(curl -k -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/sddc-lcms" \
  --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  | jq -r '.sddcLcms[] | select(.isPrimary == true) | .id')
  1. Verify you successfully obtained the SDDC instance by running the following command:
echo $primarySddcLcms

Example Output:

3e8d0034-906b-49cb-9c47-3afa8d919192
  1. Replace the values in the sample code with values for the deployment of your VCF Automation instance and paste the commands in the console.
export automationFqdn='flt-auto01.rainpole.io'
export automationPlatformFqdn='flt-vcfa-sr01.rainpole.io'
export automationIpRangeStart='10.11.10.46'
export automationIpRangeEnd='10.11.10.50'
export automationSize='small'
export automationAdminPass='VMw@re1!VMw@re1!'
export automationSystemPass='VMw@re1!VMw@re1!'
  1. Create the JSON payload for the VCF Automation instance deployment by running the following command:
cat << EOF > automation-deploy.json
{
  "componentSpecs": [
    {
      "componentType": "VCFA",
      "deploymentType": "VspComponentSpec",
      "sddcLcmId": "${primarySddcLcms}",
      "fqdn": "${automationFqdn}",
      "version": "9.1.0.0",
      "configSpec": {
        "size": "${automationSize}",
        "adminSystemPassword": "${automationAdminPass}"
      },
      "vspClusterSpec": {
        "deploymentType": "VspClusterSpec",
        "sddcLcmId": "${primarySddcLcms}",
        "platformFqdn": "${automationPlatformFqdn}",
        "systemUserPassword": "${automationSystemPass}",
        "size": "${automationSize}",
        "ipv4Pool": {
          "ipRange": {
            "startIpAddress": "${automationIpRangeStart}",
            "endIpAddress": "${automationIpRangeEnd}"
          }
        }
      }
    }
  ]
}
EOF
  1. Verify the JSON payload has been populated correctly by running the following command:
cat automation-deploy.json

Example Output:

{
  "componentSpecs": [
    {
      "componentType": "VCFA",
      "deploymentType": "VspComponentSpec",
      "sddcLcmId": "3e8d0034-906b-49cb-9c47-3afa8d919192",
      "fqdn": "flt-auto01.rainpole.io",
      "version": "9.1.0.0",
      "configSpec": {
        "size": "small",
        "adminSystemPassword": "VMw@re1!VMw@re1!"
      },
      "vspClusterSpec": {
        "deploymentType": "VspClusterSpec",
        "sddcLcmId": "3e8d0034-906b-49cb-9c47-3afa8d919192",
        "platformFqdn": "flt-vcfa-sr01.rainpole.io",
        "systemUserPassword": "VMw@re1!VMw@re1!",
        "size": "small",
        "ipv4Pool": {
          "ipRange": {
            "startIpAddress": "10.11.10.46",
            "endIpAddress": "10.11.10.50"
          }
        }
      }
    }
  ]
}

  1. Validate the JSON payload by running the following command:
validationId=$(curl -k -X POST "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/components/validations" \
  --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
   -d @automation-deploy.json | jq -r ".id")
  1. Check the status of the validation by running the following command:
curl -k -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/tasks/$validationId" \
    --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
    --header "Accept: application/json" \
    --header "Content-Type: application/json" \
    | jq
  1. The command in step 11 may need to be run multiple times, alternatively you can run the command over and over by running the following command:
while curl -k -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/tasks/$validationId" \
    --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
    --header "Accept: application/json" \
    --header "Content-Type: application/json" \
    | jq '{status: .status}' \
    | grep -q "RUNNING"; do
    echo "Still in 'RUNNING' state... waiting 2 seconds."
    sleep 2
done
  1. Start the deployment by running the following command:
deploymentId=$(curl -k -X POST "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/components" \
  --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  -d @automation-deploy.json | jq -r ".id")
  1. Check the status of the deployment by running the following command:
curl -k -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/tasks/$deploymentId" \
    --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
    --header "Accept: application/json" \
    --header "Content-Type: application/json" \
    | jq
  1. The command in step 11 would need to be run multiple times, alternatively you can run the command over and over by running the following command:
while curl -k -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/tasks/$deploymentId" \
    --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
    --header "Accept: application/json" \
    --header "Content-Type: application/json" \
    | jq '{status: .status}' \
    | grep -q "RUNNING"; do
    echo "Still in 'RUNNING' state... waiting 60 seconds."
    sleep 60
done

Comments

Popular posts from this blog

Step-by-Step Explanation of Ballooning, Compression & Swapping in VMware

 ðŸ”¹ Step-by-Step Explanation of Ballooning, Compression & Swapping in VMware ⸻ 1️⃣ Memory Ballooning (vmmemctl) Ballooning is the first memory reclamation technique used when ESXi detects memory pressure. ➤ Step-by-Step: How Ballooning Works  1. VMware Tools installs the balloon driver (vmmemctl) inside the guest OS.  2. ESXi detects low free memory on the host.  3. ESXi inflates the balloon in selected VMs.  4. Balloon driver occupies guest memory, making the OS think RAM is full.  5. Guest OS frees idle / unused pages (because it believes memory is needed).  6. ESXi reclaims those freed pages and makes them available to other VMs. Why Ballooning Happens?  • Host free memory is very low.  • ESXi wants the VM to release unused pages before resorting to swapping. Example  • Host memory: 64 GB  • VMs used: 62 GB  • Free: 2 GB → ESXi triggers ballooning  • VM1 (8 GB RAM): Balloon inflates to 2 GB → OS frees 2 GB → ESXi re...

Quick Guide to VCF Automation for VCD Administrators

  Quick Guide to VCF Automation for VCD Administrators VMware Cloud Foundation 9 (VCF 9) has been  released  and with it comes brand new Cloud Management Platform –  VCF Automation (VCFA)  which supercedes both Aria Automation and VMware Cloud Director (VCD). This blog post is intended for those people that know VCD quite well and want to understand how is VCFA similar or different to help them quickly orient in the new direction. It should be emphasized that VCFA is a new solution and not just rebranding of an old one. However it reuses a lot of components from its predecessors. The provider part of VCFA called Tenenat Manager is based on VCD code and the UI and APIs will be familiar to VCD admins, while the tenant part inherist a lot from Aria Automation and especially for VCD end-users will look brand new. Deployment and Architecture VCFA is generaly deployed from VCF Operations Fleet Management (former Aria Suite LCM embeded in VCF Ops. Fleet Management...
  Issue with Aria Automation Custom form Multi Value Picker and Data Grid https://knowledge.broadcom.com/external/article?articleNumber=345960 Products VMware Aria Suite Issue/Introduction Symptoms: Getting  error " Expected Type String but was Object ", w hen trying to use Complex Types in MultiValue Picker on the Aria for Automation Custom Form. Environment VMware vRealize Automation 8.x Cause This issue has been identified where the problem appears when a single column Multi Value Picker or Data Grid is used. Resolution This is a known issue. There is a workaround.  Workaround: As a workaround, try adding one empty column in the Multivalue picker without filling the options. So we can add one more column without filling the value which will be hidden(there is a button in the designer page that will hide the column). This way the end user will receive the same view.