项目作者: sky-joker

项目描述 :
Molecule VMware Driver
高级语言: Python
项目地址: git://github.com/sky-joker/molecule-vmware.git
创建时间: 2020-12-28T13:31:23Z
项目社区:https://github.com/sky-joker/molecule-vmware

开源协议:MIT License

下载


Molecule VMware Plugin

molecule-vmware-ci

Molecule VMware is designed to allow use of VMware vSphere environment for provisioning test resources.
Please note that this driver is currently in its early stage of development.

Installation and Usage

Install molecule-vmware and pre-requisites:

  1. pip install molecule-vmware ansible pyvmomi

Please also install pywinrm if you want to use Windows in test instance.

  1. pip install pywinrm

Create a new role with molecule using the vmware driver:

  1. molecule init role <role_name> -d vmware

Configure <role_name>/molecule/default/molecule.yml with required parameters based on your vSphere environment.
A simple config is:

  1. dependency:
  2. name: galaxy
  3. driver:
  4. name: vmware
  5. vcenter_hostname: vcsa.local
  6. vcenter_username: administrator@vsphere.local
  7. vcenter_password: secret
  8. validate_certs: false
  9. datacenter: dc
  10. #esxi_hostname: change me to esxi hostname of deploying an instance. need it if not cluster specified
  11. cluster: cluster01
  12. folder: /vm/example
  13. vm_username: root
  14. vm_password: secret
  15. instance_os_type: linux # is possible only specify [linux or windows]
  16. # The below are possible parameters to be specified if using the windows template.
  17. #winrm_port: 5986 # is WinRM port
  18. #connection: winrm # is the connection type
  19. #winrm_transport: ntlm # is the authentication type
  20. #winrm_server_cert_validation: ignore # is the server certificate validation mode
  21. # The below list is possible to define DNS nameservers
  22. #dns_servers:
  23. # - "8.8.8.8"
  24. # - "8.8.4.4"
  25. platforms:
  26. - name: instance1
  27. template: CentOS7
  28. hardware:
  29. num_cpus: 2
  30. memory_mb: 2048
  31. networks:
  32. - name: VM Network
  33. type: dhcp
  34. - name: instance2
  35. template: CentOS8
  36. snapshot_src: linked_clone # is a snapshot name to be possible specified if you want to use linked clone.
  37. resource_pool: rpool # is a resource pool to be possible specified
  38. hardware:
  39. num_cpus: 2
  40. memory_mb: 2048
  41. networks:
  42. - name: VM Network
  43. ip: 100.64.0.2
  44. netmask: 255.255.255.0
  45. gateway: 100.64.0.1
  46. # The below are possible parameters to be specified if using the windows template.
  47. #customization:
  48. # fullname: molecule # is the server owner name
  49. # orgname: molecule # is the organization name
  50. provisioner:
  51. name: ansible
  52. verifier:
  53. name: ansible

Template requirements

A template requires vmware tools because it is done Sysprep or Linuxprep to initialize OS.
When Linux, please also install Perl to the template.

License

The MIT License.