Managing VMC SDDC with Salt#
Things to know about running VMC modules & states#
- To create CSP API token which is referred to as
refresh_key
across all the VMC modules and states: Please refer Generate API Token.
- To get the
org_id
: Login to VMware Cloud Services, select your user profile in the top-right corner, and click View Organization.
In the Organization page, pick the Long Organization ID.
- To create an SDDC in the Organization:
Execute the
create
function from vmc_sddc module. This function will return the ID of the created SDDC.For example,
salt '*' vmc_sddc.create hostname=stg.example.com refresh_key=7TUPdyffgs authorization_host=console.example.com org_id=10e1092e-51d0-473a-80f8-137652fd0b39 provider=AWS num_hosts=1 sddc_name='test-sddc' region='us-west-2' verify_ssl=False --output=json | python -m json.tool | grep '"id"'
returns,
"id": "332e384f-43b1-4c7d-b125-450d5c25a332"
- Alternatively, to get the
sddc_id
from the UI: Navigate to the support tab of an SDDC on UI.
- To find the nsx-reverse-proxy-host which is referred to as
hostname
in some of the VMC modules and states: Execute
vmc_sddc.get_by_id
and get thensx_reverse_proxy_url
from the output.For example,
salt * vmc_sddc.get_by_id hostname=stg.example.com refresh_key=7TUPdyffgs authorization_host=console.example.com org_id=10e1092e-51d0-473a-80f8-137652fd0b39 sddc_id=2f225622-17ba-4bae-b0ec-b995123a5330 verify_ssl=False --output=json | python -m json.tool | grep '"nsx_reverse_proxy_url"'
returns,
"nsx_reverse_proxy_url": "https://nsx-203-0-113-42.rp.stg.example.com/vmc/reverse-proxy/api"
here
nsx-203-0-113-42.rp.stg.example.com
represents the nsx-reverse-proxy-host- To find the hostname, username and password for vCenter associated with the SDDC:
Execute
vmc_sddc.get_vcenter_detail
function. Sample output forvmc_sddc.get_vcenter_detail
:"vcenter_detail": { "vcenter_url": "https://vcenter.sddc-203-0-113-42.example.com/", "username": "user@example.local", "password": "Password123" }
- To find the VirtualMachine Identifier which is referred to as
vm_id
in some of the VMC modules: Login to vCenter Console using the above credentials, and click on any of the virtual machines available in VC. We can see the url like,
"https://vcenter.sddc-203-0-113-42.example.com/ui/app/vm;nav=h/urn:vmomi:VirtualMachine:vm-1003:f0876254-4ce2-4dc6-8bc3-792432406c31/summary"
Here
vm-1003
represents thevm_id
.
Alternatively, to get the vm_id
, execute vmc_sddc.get_vms
function which returns a list of virtual machines
associated with the SDDC.
Sample output for vmc_sddc.get_vms
:
[ { "memory_size_MiB": 4096, "vm": "vm-1001", "name": "New Virtual Machine", "power_state": "POWERED_OFF", "cpu_count": 2 }, { "memory_size_MiB": 8192, "vm": "vm-20", "name": "NSX-Edge-1", "power_state": "POWERED_ON", "cpu_count": 4 } ]Here
vm-1001
andvm-20
represents thevm_id
of corresponding virtual machines.
Using script to create vmc_config.json#
Below command will return the required information to create vmc_config.json which is required to run Integration tests for VMC
python tools/test_value_scraper_vmc.py --help
Modules and States for controlling VMC SDDC:#
- saltext.vmware.modules.vmc_dhcp_profiles
- saltext.vmware.modules.vmc_direct_connect
- saltext.vmware.modules.vmc_distributed_firewall_rules
- saltext.vmware.modules.vmc_dns_forwarder
- saltext.vmware.modules.vmc_nat_rules
- saltext.vmware.modules.vmc_networks
- saltext.vmware.modules.vmc_public_ip
- saltext.vmware.modules.vmc_sddc
- saltext.vmware.modules.vmc_sddc_clusters
- saltext.vmware.modules.vmc_sddc_host
- saltext.vmware.modules.vmc_security_groups
- saltext.vmware.modules.vmc_security_rules
- saltext.vmware.modules.vmc_vcenter_stats
- saltext.vmware.modules.vmc_vm_disks
- saltext.vmware.modules.vmc_vm_stats
- saltext.vmware.modules.vmc_vpn_statistics