vCD vApp - vmware-archive/ansible-module-vcloud-director GitHub Wiki

Vapp Example Usage

  1. Vapp States

    Create Vapp
    
     - name: create vapp
       vcd_vapp:
        vapp_name: "test_vapp"
        template_name: "test_template"
        catalog_name: "test_catalog"
        vdc: "test_vdc"
        description: "test_description"
        network: "test_network"
        fence_mode: "bridged"
        ip_allocation_mode: 'dhcp'
        deploy: true
        power_on: true
        accept_all_eulas: false
        memory: 1024000
        cpu: 1000
        disk_size: 10240000
        vmpassword: "test_password"
        cust_script: "test_script"
        vm_name: "test_vm"
        hostname: "test_host"
        ip_address: "1.1.1.1"
        storage_profile: "Standard"
        network_adapter_type: "VMXNET"
        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
    • vapp_name - (Required) name of the new vApp
    • vdc - (Required) name of the vdc
    • catalog_name - (Optional) name of the catalog
    • template_name - (Optional) name of the vApp template
    • description - (Optional) description of the new vApp. The default value is None.
    • network - (Optional) name of a vdc network. When provided, connects the vm to the network. The default value is None.
    • fence_mode - (Optional) fence mode. Possible values are pyvcloud.vcd.client.FenceMode.BRIDGED.value and pyvcloud.vcd.client.FenceMode.NAT_ROUTED.value. The default value is pyvcloud.vcd.client.FenceMode.BRIDGED.value.
    • ip_allocation_mode - (Optional) ip allocation mode. Acceptable values are 'pool', 'dhcp' and 'manual'. The default value is 'dhcp'.
    • deploy - (Optional) if true deploy the vApp after instantiation. The default value is true.
    • power_on - (Optional) if true, power on the vApp after instantiation. The default value is true.
    • accept_all_eulas - (Optional) true, confirms acceptance of all EULAs in a vApp template. The default value is false.
    • memory - (Optional) max memory that can allocated. The default value is None.
    • cpu - (Optional) max cpu that can be allocated. The default value is None.
    • disk_size - size of the disk(Optional). The default value is None.
    • vmpassword - (Optional) the administrator password of vm. The default value is None.
    • cust_script - (Optional) script to run on guest customization. The default value is None.
    • vm_name - (Optional) when provided, sets the name of the vm. The default value is None.
    • ip_address - (Optional) when provided, sets the ip_address of the vm. The default value is None.
    • hostname - (Optional) when provided, sets the hostname of the guest OS. The default value is None.
    • storage_profile - (Optional) name of the storage profile. The default value is None.
    • network_adapter_type - (Optional) One of the values in pyvcloud.vcd.client.NetworkAdapterType. The default value is None.
    • state == "present" (Required) to create vapp
    Delete Vapp
    
      - name: delete vapp
        vcd_vapp:
         vapp_name: "test_vapp"
         vdc: "test_vdc"
         force: true
         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
    • vapp_name - (Required) name of the vApp to be deleted
    • vdc - (Required) name of the vdc
    • force - (Optional) default false. If true, will instruct vcd to force delete the vapp
    • state == "absent" (Required) to delete vapp
  2. Vapp Operations

    Power on vapp
    
     - name: power on vapp
       vcd_vapp:
        vapp_name: "test_vapp"
        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
    • vapp_name - (Required) name of the vApp to be powered on
    • vdc - (Required) name of the vdc
    • operation == "poweron" (Required) to power on vapp
    Power off vapp
    
     - name: power off vapp
       vcd_vapp:
        vapp_name: "test_vapp"
        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
    • vapp_name - (Required) name of the vApp to be powered off
    • vdc - (Required) name of the vdc
    • operation == "poweroff" (Required) to power off vapp
    Get list of vms
    
     - name: get list of vms
       vcd_vapp:
        vapp_name: "test_vapp"
        vdc: "test_vdc"
        operation: "list_vms"
    
    
    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
    • vapp_name - (Required) name of the vApp to get a list of vms from
    • vdc - (Required) name of the vdc
    • operation == "list_vms" (Required) get list of vms
    Get list of vapp networks
    
     - name: get list of networks
       vcd_vapp:
        vapp_name: "test_vapp"
        vdc: "test_vdc"
        operation: "list_networks"
    
    
    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
    • vapp_name - (Required) name of the vApp to get a list of networks from
    • vdc - (Required) name of the vdc
    • operation == "list_networks" (Required) get list of networks
    Share vapp Across Org
    
     - name: share vApp
       vcd_vapp:
        vapp_name: "test_vapp"
        vdc: "test_vdc"
        shared_access: ReadOnly
        operation: share
    
    
    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
    • vapp_name - (Required) name of the vApp to get a list of networks from
    • vdc - (Required) name of the vdc
    • shared_access - (Optional) share access for vApp. Possible values could be 'ReadOnly', 'Change', 'FullControl'
    • operation == "share" (Required) to share vApp across org
    Unshare vapp
    
     - name: unshare vApp
       vcd_vapp:
        vapp_name: "test_vapp"
        vdc: "test_vdc"
        operation: unshare
    
    
    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
    • vapp_name - (Required) name of the vApp to get a list of networks from
    • vdc - (Required) name of the vdc
    • operation == "unshare" (Required) to unshare vApp
    Set Metadata
    
     - name: set metadata for vApp
       vcd_vapp:
        vapp_name: "test_vapp"
        vdc: "test_vdc"
        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
    • vapp_name - (Required) name of the vApp to get a list of networks from
    • vdc - (Required) name of the 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 type of client.MetadataDomain. Possible values could be, 'GENERAL'/'SYSTEM'
    • visibility - (Optional) visibility of the metadata entries. It should be 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 vApp
    Get Metadata
    
     - name: get metadata for vApp
       vcd_vapp:
        vapp_name: "test_vapp"
        vdc: "test_vdc"
        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
    • vapp_name - (Required) name of the vApp to get a list of networks from
    • vdc - (Required) name of the vdc
    • operation == "get_meta" (Required) to get metadata for a vApp
    Remove Metadata
    
     - name: remove metadata for vApp
       vcd_vapp:
        vapp_name: "test_vapp"
        vdc: "test_vdc"
        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
    • vapp_name - (Required) name of the vApp to get a list of networks from
    • vdc - (Required) name of the 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 vApp
    Add Org Network
    
     - name: add org network to vApp
       vcd_vapp:
        vapp_name: "test_vapp"
        vdc: "test_vdc"
        network: test_network
        operation: add_org_network
    
    
    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
    • vapp_name - (Required) name of the vApp to get a list of networks from
    • vdc - (Required) name of the vdc
    • network - (Required) the org network name to connect
    • operation == "add_org_network" (Required) to connect a org network to vApp
    Delete Org Network
    
     - name: delete org network to vApp
       vcd_vapp:
        vapp_name: "test_vapp"
        vdc: "test_vdc"
        network: test_network
        operation: delete_org_network
    
    
    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
    • vapp_name - (Required) name of the vApp to get a list of networks from
    • vdc - (Required) name of the vdc
    • network - (Required) the org network name to disconnect
    • operation == "delete_org_network" (Required) to disconnect a org network from vApp
⚠️ **GitHub.com Fallback** ⚠️