Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

vCD vApp VM

mac edited this page Dec 5, 2020 · 3 revisions

Vapp VM Example Usage

  1. Vapp VM States

    Create Vapp VM
    • Create Vapp VM from Catalog
    
     - name: create vapp vm from catalog
       vcd_vapp_vm:
        target_vm_name: "test_vapp_vm"
        target_vapp: "web2"
        source_vdc: "test_vdc"
        target_vdc: "test_vdc"
        source_catalog_name: "test_catalog"
        source_template_name: "centos7"
        source_vm_name: "CentOS7"
        hostname: "vcdcell"
        vmpassword: "rootpass"
        vmpassword_auto: "false"
        vmpassword_reset: "false"
        ip_allocation_mode: "DHCP"
        power_on: "false"
        all_eulas_accepted: "true"
        storage_profile: "Standard"
        network: "web2Network"
        cust_script: "test_script"
        deploy: false
        state: "present"
    
    
    Argument Reference
    • user - (Optional) - vCloud Director user name
    • password - (Optional) - vCloud Director password
    • org - (Optional) - vCloud Director org name to log into
    • host - (Optional) - vCloud Director host name
    • api_version - (Optional) - Pyvcloud API version
    • verify_ssl_certs - (Optional) - true to enforce to verify ssl certificate for each requests else false
    • target_vm_name - (Optional) target vm name
    • target_vapp - (Required) name of the target vapp
    • source_vdc - (Required) name of the source vdc
    • target_vdc - (Required) name of the target vdc
    • source_catalog_name - (Required) name of the sorce catalog
    • source_template_name - (Required) name of the source template
    • source_vm_name - (Required) source vm name
    • hostname - (Optional) target guest hostname
    • vmpassword - (Optional) the administrator password of the vm
    • vmpassword_auto - (Optional) if true, auto generate administrator password
    • vmpassword_reset - (Optional) true, if the administrator password for this vm must be reset after first use
    • ip_allocation_mode - (Optional) Name of the ip ip allocation mode. The default value is 'DHCP'.
    • power_on - (Optional) true if the vApp should be powered-on at instantiation. The default value is true.
    • all_eulas_accepted - (Optional) true confirms acceptance of all EULAs in the vApp. The default value is None.
    • storage_profile - (Optional) name of the storage profile. The default value is None.
    • network - (Optional) name of the vApp network to connect. If omitted, the vm won't be connected to any network
    • cust_script - (Optional) script to run on guest customization
    • deploy - (Optional) true, if the vApp should be deployed at instantiation. The default value is true.
    • state == "present" (Required) to create vapp vm
    • Create Vapp VM from Vapp
    
     - name: create vapp vm from vapp
       vcd_vapp_vm:
        target_vm_name: "test_vapp_vm"
        target_vapp: "web2"
        source_vdc: "test_vdc"
        target_vdc: "test_vdc"
        source_vapp: "web"
        source_vm_name: "CentOS7"
        hostname: "vcdcell"
        vmpassword: "rootpass"
        vmpassword_auto: "false"
        vmpassword_reset: "false"
        ip_allocation_mode: "DHCP"
        power_on: "false"
        all_eulas_accepted: "true"
        storage_profile: "Standard"
        network: "web2Network"
        cust_script: "test_script"
        deploy: false
        state: "present"
    
    
    Argument Reference
    • user - (Optional) - vCloud Director user name
    • password - (Optional) - vCloud Director password
    • org - (Optional) - vCloud Director org name to log into
    • host - (Optional) - vCloud Director host name
    • api_version - (Optional) - Pyvcloud API version
    • verify_ssl_certs - (Optional) - true to enforce to verify ssl certificate for each requests else false
    • target_vm_name - (Optional) target vm name
    • target_vapp - (Required) name of the target vapp
    • source_vdc - (Required) name of the source vdc
    • target_vdc - (Required) name of the target vdc
    • source_vapp - (Required) name of the sorce vapp
    • source_vm_name - (Required) source vm name
    • hostname - (Optional) target guest hostname
    • vmpassword - (Optional) the administrator password of the vm
    • vmpassword_auto - (Optional) if true, auto generate administrator password
    • vmpassword_reset - (Optional) true, if the administrator password for this vm must be reset after first use
    • ip_allocation_mode - (Optional) Name of the ip ip allocation mode. The default value is 'DHCP'.
    • power_on - (Optional) true if the vApp should be powered-on at instantiation. The default value is true.
    • all_eulas_accepted - (Optional) true confirms acceptance of all EULAs in the vApp. The default value is None.
    • storage_profile - (Optional) name of the storage profile. The default value is None.
    • network - (Optional) name of the vApp network to connect. If omitted, the vm won't be connected to any network
    • cust_script - (Optional) script to run on guest customization
    • deploy - (Optional) true, if the vApp should be deployed at instantiation. The default value is true.
    • state == "present" (Required) to create vapp vm

    Update Vapp VM
    • Update cpu
    
     - name: modify cpu vapp vm
       vcd_vapp_vm:
        target_vm_name: "test_vm"
        target_vapp: "web2"
        target_vdc: "Terraform_VDC"
        virtual_cpus: 2
        cores_per_socket: 2
        state: "update"
    
    
    Argument Reference
    • user - (Optional) - vCloud Director user name
    • password - (Optional) - vCloud Director password
    • org - (Optional) - vCloud Director org name to log into
    • host - (Optional) - vCloud Director host name
    • api_version - (Optional) - Pyvcloud API version
    • verify_ssl_certs - (Optional) - true to enforce to verify ssl certificate for each requests else false
    • target_vm_name - (Required) name of the target vm
    • target_vapp - (Required) name of the target vapp
    • target_vdc - (Required) name of the target vdc
    • virtual_cpus - (Required) number of virtual CPUs to configure on the vm
    • cores_per_socket - (Optional) number of cores per socket
    • state == "update" (Required) to update vapp vm cpu & cpu cores
    • Update memory
    
     - name: modify memory vapp vm
       vcd_vapp_vm:
        target_vm_name: "test_vm"
        target_vapp: "web2"
        target_vdc: "test_vdc"
        memory: 4096
        state: "update"
    
    
    Argument Reference
    • user - (Optional) - vCloud Director user name
    • password - (Optional) - vCloud Director password
    • org - (Optional) - vCloud Director org name to log into
    • host - (Optional) - vCloud Director host name
    • api_version - (Optional) - Pyvcloud API version
    • verify_ssl_certs - (Optional) - true to enforce to verify ssl certificate for each requests else false
    • target_vm_name - (Required) name of the target vm
    • target_vapp - (Required) name of the target vapp
    • target_vdc - (Required) name of the target vdc
    • memory - (Required) number of MB of memory to configure on the vm
    • state == "update" (Required) to update vapp vm memory

    Delete Vapp VM
    
     - name: delete vapp vm
       vcd_vapp_vm:
        target_vm_name: "test_vm"
        target_vapp: "web2"
        target_vdc: "test_vdc"
        state: "absent"
    
    
    Argument Reference
    • user - (Optional) - vCloud Director user name
    • password - (Optional) - vCloud Director password
    • org - (Optional) - vCloud Director org name to log into
    • host - (Optional) - vCloud Director host name
    • api_version - (Optional) - Pyvcloud API version
    • verify_ssl_certs - (Optional) - true to enforce to verify ssl certificate for each requests else false
    • target_vm_name - (Required) name of the target vm
    • target_vapp - (Required) name of the target vapp
    • target_vdc - (Required) name of the target vdc
    • state == "absent" (Required) to delete vapp vm

  2. Vapp VM Operations

    Power on vapp vm
    
     - name: power on vapp vm
       vcd_vapp_vm:
        target_vm_name: "test_vapp"
        target_vapp: "web2"
        target_vdc: "test_vdc"
        operation: "poweron"
    
    
    Argument Reference
    • user - (Optional) - vCloud Director user name
    • password - (Optional) - vCloud Director password
    • org - (Optional) - vCloud Director org name to log into
    • host - (Optional) - vCloud Director host name
    • api_version - (Optional) - Pyvcloud API version
    • verify_ssl_certs - (Optional) - true to enforce to verify ssl certificate for each requests else false
    • target_vm_name - (Required) name of the target vm
    • target_vapp - (Required) name of the target vapp
    • target_vdc - (Required) name of the target vdc
    • operation == "poweron" (Required) to power on vapp vm

    Power off vapp vm
    
     - name: power off vapp vm
       vcd_vapp_vm:
        target_vm_name: "test_vapp"
        target_vapp: "web2"
        target_vdc: "test_vdc"
        operation: "poweroff"
    
    
    Argument Reference
    • user - (Optional) - vCloud Director user name
    • password - (Optional) - vCloud Director password
    • org - (Optional) - vCloud Director org name to log into
    • host - (Optional) - vCloud Director host name
    • api_version - (Optional) - Pyvcloud API version
    • verify_ssl_certs - (Optional) - true to enforce to verify ssl certificate for each requests else false
    • target_vm_name - (Required) name of the target vm
    • target_vapp - (Required) name of the target vapp
    • target_vdc - (Required) name of the target vdc
    • operation == "poweroff" (Required) to power off vapp vm

    Reload vapp vm
    
     - name: reload vapp vm
       vcd_vapp_vm:
        target_vm_name: "test_vapp_vm"
        target_vapp: "web2"
        target_vdc: "test_vdc"
        operation: "reloadvm"
    
    
    Argument Reference
    • user - (Optional) - vCloud Director user name
    • password - (Optional) - vCloud Director password
    • org - (Optional) - vCloud Director org name to log into
    • host - (Optional) - vCloud Director host name
    • api_version - (Optional) - Pyvcloud API version
    • verify_ssl_certs - (Optional) - true to enforce to verify ssl certificate for each requests else false
    • target_vm_name - (Required) name of the target vm
    • target_vapp - (Required) name of the target vapp
    • target_vdc - (Required) name of the target vdc
    • operation == "reloadvm" (Required) to reload vapp vm

    Undeploy Vapp VM
    
     - name: undeploy vapp vm
       vcd_vapp_vm:
        target_vm_name: "test_vm"
        target_vapp: "web2"
        target_vdc: "test_vdc"
        operation: "undeploy"
    
    
    Argument Reference
    • user - (Optional) - vCloud Director user name
    • password - (Optional) - vCloud Director password
    • org - (Optional) - vCloud Director org name to log into
    • host - (Optional) - vCloud Director host name
    • api_version - (Optional) - Pyvcloud API version
    • verify_ssl_certs - (Optional) - true to enforce to verify ssl certificate for each requests else false
    • target_vm_name - (Required) name of the target vm
    • target_vapp - (Required) name of the target vapp
    • target_vdc - (Required) name of the target vdc
    • operation == "undeploy" (Required) to undeploy vapp vm

    Deploy Vapp VM
    
     - name: deploy vapp vm
       vcd_vapp_vm:
        target_vm_name: "test_vm"
        target_vapp: "web2"
        target_vdc: "test_vdc"
        operation: "deploy"
    
    
    Argument Reference
    • user - (Optional) - vCloud Director user name
    • password - (Optional) - vCloud Director password
    • org - (Optional) - vCloud Director org name to log into
    • host - (Optional) - vCloud Director host name
    • api_version - (Optional) - Pyvcloud API version
    • verify_ssl_certs - (Optional) - true to enforce to verify ssl certificate for each requests else false
    • target_vm_name - (Required) name of the target vm
    • target_vapp - (Required) name of the target vapp
    • target_vdc - (Required) name of the target vdc
    • force_customization - (Optional) True/False if need to use force customization while deploying the vm. The default value is False
    • operation == "deploy" (Required) to deploy vapp vm

    List Vapp VM Disks
    
     - name: list vapp vm disks
       vcd_vapp_vm:
        target_vm_name: "test_vm"
        target_vapp: "web2"
        target_vdc: "test_vdc"
        operation: "list_disks"
    
    
    Argument Reference
    • user - (Optional) - vCloud Director user name
    • password - (Optional) - vCloud Director password
    • org - (Optional) - vCloud Director org name to log into
    • host - (Optional) - vCloud Director host name
    • api_version - (Optional) - Pyvcloud API version
    • verify_ssl_certs - (Optional) - true to enforce to verify ssl certificate for each requests else false
    • target_vm_name - (Required) name of the target vm
    • target_vapp - (Required) name of the target vapp
    • target_vdc - (Required) name of the target vdc
    • operation == "list_disks" (Required) to list vapp vm disks

    List Vapp VM NICs
    
     - name: list vapp vm nics
       vcd_vapp_vm:
        target_vm_name: "test_vm"
        target_vapp: "web2"
        target_vdc: "test_vdc"
        operation: "list_nics"
    
    
    Argument Reference
    • user - (Optional) - vCloud Director user name
    • password - (Optional) - vCloud Director password
    • org - (Optional) - vCloud Director org name to log into
    • host - (Optional) - vCloud Director host name
    • api_version - (Optional) - Pyvcloud API version
    • verify_ssl_certs - (Optional) - true to enforce to verify ssl certificate for each requests else false
    • target_vm_name - (Required) name of the target vm
    • target_vapp - (Required) name of the target vapp
    • target_vdc - (Required) name of the target vdc
    • operation == "list_nics" (Required) to list vapp vm nics
    Set Metadata
    
     - name: set metadata for vm
       vcd_vapp:
        target_vm_name: centos
        target_vapp: acme_vapp
        target_vdc: ACME_PAYG
        metadata:
          sample7: sample-value4
          sample8: sample-value4
          sample9: sample-value4
        operation: set_meta
    
    
    Argument Reference
    • user - (Optional) - vCloud Director user name
    • password - (Optional) - vCloud Director password
    • org - (Optional) - vCloud Director org name to log into
    • host - (Optional) - vCloud Director host name
    • api_version - (Optional) - Pyvcloud API version
    • verify_ssl_certs - (Optional) - true to enforce to verify ssl certificate for each requests else false
    • target_vm_name - (Required) name of the target vm
    • target_vapp - (Required) name of the target vapp
    • target_vdc - (Required) name of the target vdc
    • metadata - (Required) a dict containing key-value pairs to be added/updated. If an entry with the same key exists, it will be updated with the new value. All entries must have the same value type and will be written to the same domain with identical visibility.
    • domain - (Optional) domain where the new entries would be put. It should be the type of client.MetadataDomain. Possible values could be, 'GENERAL'/'SYSTEM'
    • visibility - (Optional) visibility of the metadata entries. It should be the type of client.MetadataVisibility. Possible values could be, 'PRIVATE'/'READONLY'/'READWRITE'
    • metadata_value_type - (Optional) type of metadata values. It should be type of client.MetadataValueType. Possible values could be, 'String'/'Number'/'Boolean'/'DateTime'
    • operation == "set_meta" (Required) to set metadata for a VM
    Get Metadata
    
     - name: get metadata for vm
       vcd_vapp:
        target_vm_name: centos
        target_vdc: ACME_PAYG
        target_vapp: acme_vapp
        operation: get_meta
    
    
    Argument Reference
    • user - (Optional) - vCloud Director user name
    • password - (Optional) - vCloud Director password
    • org - (Optional) - vCloud Director org name to log into
    • host - (Optional) - vCloud Director host name
    • api_version - (Optional) - Pyvcloud API version
    • verify_ssl_certs - (Optional) - true to enforce to verify ssl certificate for each requests else false
    • target_vm_name - (Required) name of the target vm
    • target_vapp - (Required) name of the target vapp
    • target_vdc - (Required) name of the target vdc
    • operation == "get_meta" (Required) to get metadata for a VM
    Remove Metadata
    
     - name: remove metadata for vm
       vcd_vapp:
        target_vm_name: centos
        target_vapp: acme_vapp
        target_vdc: ACME_PAYG
        metadata:
          sample7: sample-value4
          sample8: sample-value4
          sample9: sample-value4
        operation: remove_meta
    
    
    Argument Reference
    • user - (Optional) - vCloud Director user name
    • password - (Optional) - vCloud Director password
    • org - (Optional) - vCloud Director org name to log into
    • host - (Optional) - vCloud Director host name
    • api_version - (Optional) - Pyvcloud API version
    • verify_ssl_certs - (Optional) - true to enforce to verify ssl certificate for each requests else false
    • target_vm_name - (Required) name of the target vm
    • target_vapp - (Required) name of the target vapp
    • target_vdc - (Required) name of the target vdc
    • metadata - (Required) a dict containing key-value pairs to be deleted.
    • domain - (Optional) domain where the new entries would be put. It should be type of client.MetadataDomain. Possible values could be, 'GENERAL'/'SYSTEM'
    • operation == "remove_meta" (Required) to remove metadata for a VM