Aria Automation with ChatGPT part 3

5–8 minutes

read –

in

As i quickly realized in part 1 and 2, the yaml file was incomplete and needed some different approach when asked for an output.

One thing was the many different templates you can create:

1. VMware Infrastructure

  • VMware vSphere: Direct support for deploying VMs and services on VMware’s core virtualization platform.
  • VMware Cloud on AWS: Integration with VMware’s cloud offering on Amazon Web Services for seamless hybrid cloud operations.
  • VMware NSX: Support for advanced network configurations and services using VMware’s network virtualization and security platform.

2. Public Cloud Platforms

  • Amazon Web Services (AWS): Comprehensive support for deploying and managing AWS resources such as EC2 instances, S3 storage, and more.
  • Microsoft Azure: Support for various Azure resources, including virtual machines, Azure SQL databases, and Azure Kubernetes Service.
  • Google Cloud Platform (GCP): Allows for the deployment and management of Google Cloud resources like Compute Engine instances and Google Kubernetes Engine.

3. Container Platforms

  • Kubernetes: Native support for deploying and managing Kubernetes clusters and containerized applications across any infrastructure, including integrations with Tanzu Kubernetes Grid and other Kubernetes distributions.
  • OpenShift: Can integrate with Red Hat OpenShift for managing applications and services on this enterprise Kubernetes platform.

4. Private and Hybrid Clouds

  • VMware Cloud Foundation: Support for deploying on VMware’s integrated private cloud platform that includes vSphere, vSAN, and NSX.
  • VMware Cloud on Dell EMC: Allows businesses to manage and orchestrate environments running VMware’s cloud infrastructure on Dell EMC hardware.

5. Other Integrations

  • VMware Cloud Director (formerly vCloud Director): Supports deployments in environments managed by VMware Cloud Director, which is targeted at service providers and large enterprises managing multiple cloud instances.

6. Traditional IT

  • Bare Metal Servers: Capability to manage and provision bare metal servers directly, expanding automation beyond virtual and cloud resources.

7. Edge Environments

  • VMware Edge Compute Stack: Supports the deployment and management of edge computing scenarios where processing is done at or near the source of data generation.

The list above shows that every blueprint has it`s prereq, and different config parameters, so you need to be very precise in your question for a template.

This means that i changed my approach a little and added more info to get a blueprint that i could use in my vsphere environment.

My first yaml created a cloud machine, but i needed a cloud vsphere machine, so that was one thing that needed to change. I also added info about the storage type and changed to win2022.

Me:

“Show me a aria automation cloud vsphere machine yaml file, for a windows 2022, with an existing c disk with 100gb. Storage type is cloud vsphere disk. disk number 2 is a DB disk with 300gb with letter E, disk number 3 is a log disk with 120gb with letter f and disk number 4 is a temp disk with 50gb with letter g.Disk provisioning type is thin. the vm uses NSX network called test2, and needs 2 cpu and 8gb ram”

ChatGPT:

Here’s a VMware Aria Automation Cloud template that matches your specifications for a Windows Server 2022 vSphere machine using vSAN storage with a thin provisioning type:

name: "Windows-Server-2022-VM-Detailed"
description: "Provision a Windows Server 2022 VM with integrated cloud vSphere disk configuration."
version: "1.0"

resources:
  windowsVm:
    type: Cloud.vSphere.Machine
    properties:
      name: "Win2022Server"
      image: "Windows-2022"
      flavor: "custom"
      cpuCount: 2
      totalMemoryMB: 8192
      networks:
        - networkType: "existing"
          networkName: "test2"
      storage:
        type: "cloud.vsphere.disk"
        datastore: "vsanDatastore"
        disks:
          - name: "C Disk"
            type: "Cloud.vSphere.Disk"
            capacityGB: 100
            provisioningType: "thin"
            bootDisk: true
          - name: "DB Disk"
            type: "Cloud.vSphere.Disk"
            capacityGB: 300
            deviceName: "E:"
            provisioningType: "thin"
          - name: "Log Disk"
            type: "Cloud.vSphere.Disk"
            capacityGB: 120
            deviceName: "F:"
            provisioningType: "thin"
          - name: "Temp Disk"
            type: "Cloud.vSphere.Disk"
            capacityGB: 50
            deviceName: "G:"
            provisioningType: "thin"
      customizationSpec:
        customizationType: "windows"
        timezone: "UTC"
        adminUsername: "administrator"
        adminPassword: "SecurePassword123!"
        computerName: "Win2022Server"
        preScript:
          inline: |
            # PowerShell script to initialize and format additional disks
            Get-Disk | Where-Object PartitionStyle -eq 'RAW' |
            Initialize-Disk -PartitionStyle MBR -PassThru |
            ForEach-Object {
              $disk = $_
              switch ($disk.Number) {
                1 {
                  New-Partition -DiskNumber $disk.Number -DriveLetter 'E' -UseMaximumSize |
                  Format-Volume -FileSystem NTFS -NewFileSystemLabel 'DBDisk' -Confirm:$false
                }
                2 {
                  New-Partition -DiskNumber $disk.Number -DriveLetter 'F' -UseMaximumSize |
                  Format-Volume -FileSystem NTFS -NewFileSystemLabel 'LogDisk' -Confirm:$false
                }
                3 {
                  New-Partition -DiskNumber $disk.Number -DriveLetter 'G' -UseMaximumSize |
                  Format-Volume -FileSystem NTFS -NewFileSystemLabel 'TempDisk' -Confirm:$false
                }
              }
            }

Now we have a more complete file, but still we where missing some info. The blueprint has something called input parameters that is connected to the schema used when you request a vm from the Aria portal . Here you can setup variables like dropdown for different type of info, set disk size , name and so on, so its quite useful.

Next step would be to ask for input parameters.

Me:

“Show me a aria automation cloud vsphere machine yaml file, for a windows 2022, with an existing c disk with 100gb. Storage type is cloud vsphere disk. disk number 2 is a DB disk with 300gb with letter E, disk number 3 is a log disk with 120gb with letter f and disk number 4 is a temp disk with 50gb with letter g.Disk provisioning type is thin. the vm uses NSX network called test2, and needs 2 cpu and 8gb ram , with template input parameters”

ChatGPT:

Here’s a VMware Aria Automation Cloud template for a vSphere machine with template inputs as requested:

name: "Deploy-Windows-2022-VM"
description: "Template to deploy a Windows Server 2022 VM with custom disk configuration and NSX networking."
version: "1.0"

inputs:
  vmName:
    type: string
    title: "Virtual Machine Name"
    description: "Name of the virtual machine to be deployed."
    default: "Win2022VM"

  cpuCount:
    type: integer
    title: "CPU Count"
    description: "Number of CPUs for the virtual machine."
    default: 2

  memoryMB:
    type: integer
    title: "Memory in MB"
    description: "Amount of RAM in megabytes for the virtual machine."
    default: 8192

  networkName:
    type: string
    title: "NSX Network Name"
    description: "Name of the NSX network the VM will connect to."
    default: "test2"

  adminUsername:
    type: string
    title: "Administrator Username"
    description: "Administrator username for the VM."
    default: "admin"

  adminPassword:
    type: string
    title: "Administrator Password"
    description: "Administrator password for the VM."
    encrypted: true

  dbDiskSizeGB:
    type: integer
    title: "DB Disk Size in GB"
    description: "Size of the database disk in gigabytes."
    default: 300

  logDiskSizeGB:
    type: integer
    title: "Log Disk Size in GB"
    description: "Size of the log disk in gigabytes."
    default: 120

  tempDiskSizeGB:
    type: integer
    title: "Temporary Disk Size in GB"
    description: "Size of the temporary disk in gigabytes."
    default: 50

resources:
  windowsVm:
    type: Cloud.vSphere.Machine
    properties:
      name: "${input.vmName}"
      image: "Windows-2022"
      flavor: "custom"
      cpuCount: "${input.cpuCount}"
      totalMemoryMB: "${input.memoryMB}"
      networks:
        - networkType: "existing"
          networkName: "${input.networkName}"
      storage:
        type: "vsan"
        datastore: "vsanDatastore"
        disks:
          - name: "C Disk"
            type: "Cloud.vSphere.Disk"
            capacityGB: 100
            provisioningType: "thin"
            bootDisk: true
          - name: "DB Disk"
            type: "Cloud.vSphere.Disk"
            capacityGB: "${input.dbDiskSizeGB}"
            deviceName: "E:"
            provisioningType: "thin"
          - name: "Log Disk"
            type: "Cloud.vSphere.Disk"
            capacityGB: "${input.logDiskSizeGB}"
            deviceName: "F:"
            provisioningType: "thin"
          - name: "Temp Disk"
            type: "Cloud.vSphere.Disk"
            capacityGB: "${input.tempDiskSizeGB}"
            deviceName: "G:"
            provisioningType: "thin"
      customizationSpec:
        customizationType: "windows"
        timezone: "UTC"
        adminUsername: "${input.adminUsername}"
        adminPassword: "${input.adminPassword}"
        computerName: "${input.vmName}"
        preScript:
          inline: |
            # PowerShell script to initialize and format additional disks
            Get-Disk | Where-Object PartitionStyle -eq 'RAW' |
            Initialize-Disk -PartitionStyle MBR -PassThru |
            ForEach-Object {
              $disk = $_
              switch ($disk.Number) {
                1 {
                  New-Partition -DiskNumber $disk.Number -DriveLetter 'E' -UseMaximumSize |
                  Format-Volume -FileSystem NTFS -NewFileSystemLabel 'DBDisk' -Confirm:$false
                }
                2 {
                  New-Partition -DiskNumber $disk.Number -DriveLetter 'F' -UseMaximumSize |
                  Format-Volume -FileSystem NTFS -NewFileSystemLabel 'LogDisk' -Confirm:$false
                }
                3 {
                  New-Partition -DiskNumber $disk.Number -DriveLetter 'G' -UseMaximumSize |
                  Format-Volume -FileSystem NTFS -NewFileSystemLabel 'TempDisk' -Confirm:$false
                }
              }
            }

As you can see, the yaml file is starting to look a bit more complex, but also more complete. From the looks of it, i see that it still needs some adjusting. One thing is actually the disks itself, so to do a quick comparison, i created a new template manually in Aria, a cloud vsphere machine vm with 3 disks and nsx network connected.

After a quick comparison of the yaml files i then merged the files , the manual template and the latest chatGPT template, and this gave me the most functioning blueprint in the test. There are some duplicate parameters, so it needs some adjusting, but i will test it along with some input parameters for the schema, so hopefully in the next post i will have a 100% functioning blueprint.


Comments

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.