Skip to content

mario-slowinski/vmware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vmware

Ansible role to manage VMware objects.

Description

  • network

    vmware_networks is a list of interfaces to be set on VMware guest

    • if list element contains vlan_id attribute, named vswitch and portgroup will be created on vmware_esxis servers
    • if list element does not contain vlan_id attribute, portgroup should already exist and will be just assigned to VMware guest
    • if list elements contains ip attribute, will do network customization which requires VMware tools installed or task fails
    • if list elements does not contain ip attribute, Manage VMware guest network task will launch to assign portgroup or other interface properties

    vmware_guest ansible module performs network customization even if networks list contains only portgroup name so vmware_guest_network module must be used in second task even if only to change portgroup

  • folders

    vmware_folders list contains elements which combines to vCenter VM and Templates folder path, i.e. below will create /<vmware_datacenter>/vm/folder/subfolder/child

      vmware_folders:
        - name: "folder"
        - name: "subfolder"
          parent: "folder"
        - name: "child"
          parent: "folder/subfolder"
  • guest

    Create vmware_name VMware guest or clone it from vmware_template and optionally reconfigure it with:

    • vmware_guest_id - one of guest_id list, not required for cloning,
    • vmware_hardware - vCPU and memory
    • vmware_disks - datastore and size
    • vmware_annotation
    • vmware_customization
    • vmware_networks - list of network interfaces with possible customization
  • guest_info

    Get and store in vmware_guest variable details about VMware guest or template.

  • permissions

    Set vmware_role for vmware_principal user on vmware_folder (it's only supported type at the moment)

  • storagepolicy

    Set storage policy on vm_home or per each disk selected by unit_number.

Requirements

Role Variables

  • defaults

    • main.yaml

      vmware_host: ""             # vCenter or ESXi server
      vmware_user: ""             # vCenter or ESXi server user
      vmware_password: ""         # vCenter or ESXi server user's password
      vmware_validate_certs: bool # whether validate vCenter SSL certificate
      
      vmware_name: ""             # VMware guest name
      vmware_annotation: ""       # VMware guest annotation
      vmware_template: ""         # VMware template to clone to guest
      
      vmware_datacenter: ""       # name of VMware datacenter
      vmware_cluster: ""          # name of VMware cluster
      vmware_esxis: []            # list of ESXi standalone servers
      vmware_datastores: []       # list of datastores to be used in vmware_disks
      
      vmware_folders: []          # list of vCenter folders concatenated into path
      #  - name: "folder"
      #  - name: "subfolder"
      #    parent: "folder"
      vmware_folder: ""           # vCenter folder used for guest
      
      vmware_guest_id: ""         # VMware guest id i.e. rhel7_64Guest
      
      vmware_disks: []            # list of guest disks
      #  - datastore: ""          # disk datastore
      #    size_gb: int           # disk size
      
      vmware_hardware: []         # list of guest hardware
      #  num_cpus: int
      #  memory_mb: int
      #  scsi: ""
      
      vmware_networks: []         # list of guest networks
      #  - name: "VM Network"     # name of portgroup
      #    type: "static"         # static or dhcp
      #    ip: ""                 # ip address for OS customization
      #    netmask: ""            # netmask for OS customization
      #    gateway: ""            # gateway for OS customization
      #    start_connected: bool
      
      vmware_customization: []
      #  hostname: "{{ inventory_hostname_short }}"
      #  timezone: "Europe/Warsaw"
      #  dns_servers: []
      #  dns_suffix: []
      #  domain: example.com
      
      vmware_ip_address_wait: false
      vmware_ip_address_wait_timeout: int
      vmware_customization_wait: false
      vmware_customization_wait_timeout: int
      
      vmware_netplan_dir: ""
      
      vmware_principal: ""        # user to assign privileges
      vmware_guest_user: ""       # user used to copy files with vmtools
      vmware_guest_password: ""   # user's password used to copy files with vmtools
      
      vmware_guest_schema: ""     # schema used for vmware_guest_info
      vmware_guest_properties: ""
      
      vmware_storagepolicies:     # list of storage policies
        vm_home: ""
        disk: []

Dependencies

No dependencies

Tags

  • vmware.folder - Manage VMware vCenter folders
  • vmware.network - Manage VMware network
    • vmware.network.vswitch - Create VMware vswitch
    • vmware.network.portgroup - Create VMware portgroups (with defined vlan_id) in vswitch
  • vmware.guest - Manage VMware guest
    • vmware.guest.vm - Manage VMware guest vm
    • vmware.guest.network - Manage VMware guest network
  • vmware.custom - Manage VMware guest custom attributes
  • vmware.storagepolicy - Manage VM Storage Policy

Examples

  • requirements.yaml

    - name: vmware
      src: https://github.com/mario-slowinski/vmware
  • playbook.yaml

    - hosts: servers
      gather_facts: true
      roles:
        - role: vmware

License

GPL-3.0

Author Information

mario.slowinski@gmail.com

About

Manage VMware guest, vswitch, portgroup

Topics

Resources

License

Stars

Watchers

Forks