vmware.rst 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. .. _cloud-getting-started-vmware:
  2. ===========================
  3. Getting Started With VMware
  4. ===========================
  5. .. versionadded:: 2015.5.4
  6. **Author**: Nitin Madhok <nmadhok@clemson.edu>
  7. The VMware cloud module allows you to manage VMware ESX, ESXi, and vCenter.
  8. Dependencies
  9. ============
  10. The vmware module for Salt Cloud requires the ``pyVmomi`` package, which is
  11. available at PyPI:
  12. https://pypi.python.org/pypi/pyvmomi
  13. This package can be installed using `pip` or `easy_install`:
  14. .. code-block:: bash
  15. pip install pyvmomi
  16. easy_install pyvmomi
  17. .. note::
  18. Version 6.0 of pyVmomi has some problems with SSL error handling on certain
  19. versions of Python. If using version 6.0 of pyVmomi, the machine that you
  20. are running the proxy minion process from must have either Python 2.7.9 or
  21. newer This is due to an upstream dependency in pyVmomi 6.0 that is not supported
  22. in Python version 2.6 to 2.7.8. If the version of Python running the salt-cloud
  23. command is not in the supported range, you will need to install an earlier version
  24. of pyVmomi. See `Issue #29537`_ for more information.
  25. .. _Issue #29537: https://github.com/saltstack/salt/issues/29537
  26. .. note::
  27. pyVmomi doesn't expose the ability to specify the locale when connecting to
  28. VMware. This causes parsing issues when connecting to an instance of VMware
  29. running under a non-English locale. Until this feature is added upstream
  30. `Issue #38402`_ contains a workaround.
  31. .. _Issue #38402: https://github.com/saltstack/salt/issues/38402
  32. Configuration
  33. =============
  34. The VMware cloud module needs the vCenter or ESX/ESXi URL, username and password to be
  35. set up in the cloud configuration at
  36. ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/vmware.conf``:
  37. .. code-block:: yaml
  38. my-vmware-config:
  39. driver: vmware
  40. user: 'DOMAIN\user'
  41. password: 'verybadpass'
  42. url: '10.20.30.40'
  43. vcenter01:
  44. driver: vmware
  45. user: 'DOMAIN\user'
  46. password: 'verybadpass'
  47. url: 'vcenter01.domain.com'
  48. protocol: 'https'
  49. port: 443
  50. vcenter02:
  51. driver: vmware
  52. user: 'DOMAIN\user'
  53. password: 'verybadpass'
  54. url: 'vcenter02.domain.com'
  55. protocol: 'http'
  56. port: 80
  57. esx01:
  58. driver: vmware
  59. user: 'admin'
  60. password: 'verybadpass'
  61. url: 'esx01.domain.com'
  62. .. note::
  63. Optionally, ``protocol`` and ``port`` can be specified if the vCenter
  64. server is not using the defaults. Default is ``protocol: https`` and
  65. ``port: 443``.
  66. .. note::
  67. .. versionchanged:: 2015.8.0
  68. The ``provider`` parameter in cloud provider configuration was renamed to ``driver``.
  69. This change was made to avoid confusion with the ``provider`` parameter that is
  70. used in cloud profile configuration. Cloud provider configuration now uses ``driver``
  71. to refer to the salt-cloud driver that provides the underlying functionality to
  72. connect to a cloud provider, while cloud profile configuration continues to use
  73. ``provider`` to refer to the cloud provider configuration that you define.
  74. .. _vmware-cloud-profile:
  75. Profiles
  76. ========
  77. Set up an initial profile at ``/etc/salt/cloud.profiles`` or
  78. ``/etc/salt/cloud.profiles.d/vmware.conf``:
  79. .. code-block:: yaml
  80. vmware-centos6.5:
  81. provider: vcenter01
  82. clonefrom: test-vm
  83. ## Optional arguments
  84. num_cpus: 4
  85. memory: 8GB
  86. devices:
  87. cd:
  88. CD/DVD drive 1:
  89. device_type: datastore_iso_file
  90. iso_path: "[nap004-1] vmimages/tools-isoimages/linux.iso"
  91. CD/DVD drive 2:
  92. device_type: client_device
  93. mode: atapi
  94. controller: IDE 2
  95. CD/DVD drive 3:
  96. device_type: client_device
  97. mode: passthrough
  98. controller: IDE 3
  99. disk:
  100. Hard disk 1:
  101. size: 30
  102. Hard disk 2:
  103. size: 20
  104. controller: SCSI controller 2
  105. Hard disk 3:
  106. size: 5
  107. controller: SCSI controller 3
  108. datastore: smalldiskdatastore
  109. network:
  110. Network adapter 1:
  111. name: 10.20.30-400-Test
  112. switch_type: standard
  113. ip: 10.20.30.123
  114. gateway: [10.20.30.110]
  115. subnet_mask: 255.255.255.128
  116. domain: example.com
  117. Network adapter 2:
  118. name: 10.30.40-500-Dev-DHCP
  119. adapter_type: e1000
  120. switch_type: distributed
  121. mac: '00:16:3e:e8:19:0f'
  122. Network adapter 3:
  123. name: 10.40.50-600-Prod
  124. adapter_type: vmxnet3
  125. switch_type: distributed
  126. ip: 10.40.50.123
  127. gateway: [10.40.50.110]
  128. subnet_mask: 255.255.255.128
  129. domain: example.com
  130. scsi:
  131. SCSI controller 1:
  132. type: lsilogic
  133. SCSI controller 2:
  134. type: lsilogic_sas
  135. bus_sharing: virtual
  136. SCSI controller 3:
  137. type: paravirtual
  138. bus_sharing: physical
  139. ide:
  140. IDE 2
  141. IDE 3
  142. domain: example.com
  143. dns_servers:
  144. - 123.127.255.240
  145. - 123.127.255.241
  146. - 123.127.255.242
  147. resourcepool: Resources
  148. cluster: Prod
  149. datastore: HUGE-DATASTORE-Cluster
  150. folder: Development
  151. datacenter: DC1
  152. host: c4212n-002.domain.com
  153. template: False
  154. power_on: True
  155. extra_config:
  156. mem.hotadd: 'yes'
  157. guestinfo.foo: bar
  158. guestinfo.domain: foobar.com
  159. guestinfo.customVariable: customValue
  160. annotation: Created by Salt-Cloud
  161. deploy: True
  162. customization: True
  163. private_key: /root/.ssh/mykey.pem
  164. ssh_username: cloud-user
  165. password: veryVeryBadPassword
  166. minion:
  167. master: 123.127.193.105
  168. file_map:
  169. /path/to/local/custom/script: /path/to/remote/script
  170. /path/to/local/file: /path/to/remote/file
  171. /srv/salt/yum/epel.repo: /etc/yum.repos.d/epel.repo
  172. hardware_version: 10
  173. image: centos64Guest
  174. #For Windows VM
  175. win_username: Administrator
  176. win_password: administrator
  177. win_organization_name: ABC-Corp
  178. plain_text: True
  179. win_installer: /root/Salt-Minion-2015.8.4-AMD64-Setup.exe
  180. win_user_fullname: Windows User
  181. ``provider``
  182. Enter the name that was specified when the cloud provider config was created.
  183. ``clonefrom``
  184. Enter the name of the VM/template to clone from. If not specified, the VM will be created
  185. without cloning.
  186. ``num_cpus``
  187. Enter the number of vCPUS that you want the VM/template to have. If not specified,
  188. the current VM/template\'s vCPU count is used.
  189. ``cores_per_socket``
  190. Enter the number of cores per vCPU that you want the VM/template to have. If not specified,
  191. this will default to 1.
  192. .. note::
  193. Cores per socket should be less than or equal to the total number of
  194. vCPUs assigned to the VM/template.
  195. .. versionadded:: 2016.11.0
  196. ``memory``
  197. Enter the memory size (in MB or GB) that you want the VM/template to have. If
  198. not specified, the current VM/template\'s memory size is used. Example
  199. ``memory: 8GB`` or ``memory: 8192MB``.
  200. ``devices``
  201. Enter the device specifications here. Currently, the following devices can be
  202. created or reconfigured:
  203. cd
  204. Enter the CD/DVD drive specification here. If the CD/DVD drive doesn\'t exist,
  205. it will be created with the specified configuration. If the CD/DVD drive
  206. already exists, it will be reconfigured with the specifications. The following
  207. options can be specified per CD/DVD drive:
  208. device_type
  209. Specify how the CD/DVD drive should be used. Currently supported types are
  210. ``client_device`` and ``datastore_iso_file``. Default is
  211. ``device_type: client_device``
  212. iso_path
  213. Enter the path to the iso file present on the datastore only if
  214. ``device_type: datastore_iso_file``. The syntax to specify this is
  215. ``iso_path: "[datastoreName] vmimages/tools-isoimages/linux.iso"``. This
  216. field is ignored if ``device_type: client_device``
  217. mode
  218. Enter the mode of connection only if ``device_type: client_device``. Currently
  219. supported modes are ``passthrough`` and ``atapi``. This field is ignored if
  220. ``device_type: datastore_iso_file``. Default is ``mode: passthrough``
  221. controller
  222. Specify the IDE controller label to which this drive should be attached.
  223. This should be specified only when creating both the specified IDE
  224. controller as well as the CD/DVD drive at the same time.
  225. disk
  226. Enter the disk specification here. If the hard disk doesn\'t exist, it will
  227. be created with the provided size. If the hard disk already exists, it will
  228. be expanded if the provided size is greater than the current size of the disk.
  229. size
  230. Enter the size of disk in GB
  231. thin_provision
  232. Specifies whether the disk should be thin provisioned or not. Default is ``thin_provision: False``.
  233. .. versionadded:: 2016.3.0
  234. eagerly_scrub
  235. Specifies whether the disk should be rewrite with zeros during thick provisioning or not.
  236. Default is ``eagerly_scrub: False``.
  237. .. versionadded:: 2018.3.0
  238. controller
  239. Specify the SCSI controller label to which this disk should be attached.
  240. This should be specified only when creating both the specified SCSI
  241. controller as well as the hard disk at the same time.
  242. datastore
  243. The name of a valid datastore should you wish the new disk to be in
  244. a datastore other than the default for the VM.
  245. network
  246. Enter the network adapter specification here. If the network adapter doesn\'t
  247. exist, a new network adapter will be created with the specified network name,
  248. type and other configuration. If the network adapter already exists, it will
  249. be reconfigured with the specifications. The following additional options can
  250. be specified per network adapter (See example above):
  251. name
  252. Enter the network name you want the network adapter to be mapped to.
  253. adapter_type
  254. Enter the network adapter type you want to create. Currently supported
  255. types are ``vmxnet``, ``vmxnet2``, ``vmxnet3``, ``e1000`` and ``e1000e``.
  256. If no type is specified, by default ``vmxnet3`` will be used.
  257. switch_type
  258. Enter the type of switch to use. This decides whether to use a standard
  259. switch network or a distributed virtual portgroup. Currently supported
  260. types are ``standard`` for standard portgroups and ``distributed`` for
  261. distributed virtual portgroups.
  262. ip
  263. Enter the static IP you want the network adapter to be mapped to. If the
  264. network specified is DHCP enabled, you do not have to specify this.
  265. gateway
  266. Enter the gateway for the network as a list. If the network specified
  267. is DHCP enabled, you do not have to specify this.
  268. subnet_mask
  269. Enter the subnet mask for the network. If the network specified is DHCP
  270. enabled, you do not have to specify this.
  271. domain
  272. Enter the domain to be used with the network adapter. If the network
  273. specified is DHCP enabled, you do not have to specify this.
  274. mac
  275. Enter the MAC for this network adapter. If not specified an address
  276. will be selected automatically.
  277. scsi
  278. Enter the SCSI controller specification here. If the SCSI controller doesn\'t exist,
  279. a new SCSI controller will be created of the specified type. If the SCSI controller
  280. already exists, it will be reconfigured with the specifications. The following
  281. additional options can be specified per SCSI controller:
  282. type
  283. Enter the SCSI controller type you want to create. Currently supported
  284. types are ``lsilogic``, ``lsilogic_sas`` and ``paravirtual``. Type must
  285. be specified when creating a new SCSI controller.
  286. bus_sharing
  287. Specify this if sharing of virtual disks between virtual machines is desired.
  288. The following can be specified:
  289. virtual
  290. Virtual disks can be shared between virtual machines on the same server.
  291. physical
  292. Virtual disks can be shared between virtual machines on any server.
  293. no
  294. Virtual disks cannot be shared between virtual machines.
  295. ide
  296. Enter the IDE controller specification here. If the IDE controller doesn\'t exist,
  297. a new IDE controller will be created. If the IDE controller already exists,
  298. no further changes to it will me made.
  299. ``domain``
  300. Enter the global domain name to be used for DNS. If not specified and if the VM name
  301. is a FQDN, ``domain`` is set to the domain from the VM name. Default is ``local``.
  302. ``dns_servers``
  303. Enter the list of DNS servers to use in order of priority.
  304. ``resourcepool``
  305. Enter the name of the resourcepool to which the new virtual machine should be
  306. attached. This determines what compute resources will be available to the clone.
  307. .. note::
  308. - For a clone operation from a virtual machine, it will use the same
  309. resourcepool as the original virtual machine unless specified.
  310. - For a clone operation from a template to a virtual machine, specifying
  311. either this or cluster is required. If both are specified, the resourcepool
  312. value will be used.
  313. - For a clone operation to a template, this argument is ignored.
  314. ``cluster``
  315. Enter the name of the cluster whose resource pool the new virtual machine should
  316. be attached to.
  317. .. note::
  318. - For a clone operation from a virtual machine, it will use the same cluster\'s
  319. resourcepool as the original virtual machine unless specified.
  320. - For a clone operation from a template to a virtual machine, specifying either
  321. this or resourcepool is required. If both are specified, the resourcepool
  322. value will be used.
  323. - For a clone operation to a template, this argument is ignored.
  324. ``datastore``
  325. Enter the name of the datastore or the datastore cluster where the virtual machine
  326. should be located on physical storage. If not specified, the current datastore is
  327. used.
  328. .. note::
  329. - If you specify a datastore cluster name, DRS Storage recommendation is
  330. automatically applied.
  331. - If you specify a datastore name, DRS Storage recommendation is disabled.
  332. ``folder``
  333. Enter the name of the folder that will contain the new virtual machine.
  334. .. note::
  335. - For a clone operation from a VM/template, the new VM/template will be added
  336. to the same folder that the original VM/template belongs to unless specified.
  337. - If both folder and datacenter are specified, the folder value will be used.
  338. ``datacenter``
  339. Enter the name of the datacenter that will contain the new virtual machine.
  340. .. note::
  341. - For a clone operation from a VM/template, the new VM/template will be added
  342. to the same folder that the original VM/template belongs to unless specified.
  343. - If both folder and datacenter are specified, the folder value will be used.
  344. ``host``
  345. Enter the name of the target host where the virtual machine should be registered.
  346. If not specified:
  347. .. note::
  348. - If resource pool is not specified, current host is used.
  349. - If resource pool is specified, and the target pool represents a stand-alone
  350. host, the host is used.
  351. - If resource pool is specified, and the target pool represents a DRS-enabled
  352. cluster, a host selected by DRS is used.
  353. - If resource pool is specified and the target pool represents a cluster without
  354. DRS enabled, an InvalidArgument exception be thrown.
  355. ``template``
  356. Specifies whether the new virtual machine should be marked as a template or not.
  357. Default is ``template: False``.
  358. ``power_on``
  359. Specifies whether the new virtual machine should be powered on or not. If
  360. ``template: True`` is set, this field is ignored. Default is ``power_on: True``.
  361. ``extra_config``
  362. Specifies the additional configuration information for the virtual machine. This
  363. describes a set of modifications to the additional options. If the key is already
  364. present, it will be reset with the new value provided. Otherwise, a new option is
  365. added. Keys with empty values will be removed.
  366. ``annotation``
  367. User-provided description of the virtual machine. This will store a message in the
  368. vSphere interface, under the annotations section in the Summary view of the virtual
  369. machine.
  370. ``deploy``
  371. Specifies if salt should be installed on the newly created VM. Default is ``True``
  372. so salt will be installed using the bootstrap script. If ``template: True`` or
  373. ``power_on: False`` is set, this field is ignored and salt will not be installed.
  374. ``wait_for_ip_timeout``
  375. When ``deploy: True``, this timeout determines the maximum time to wait for
  376. VMware tools to be installed on the virtual machine. If this timeout is
  377. reached, an attempt to determine the client's IP will be made by resolving
  378. the VM's name. By lowering this value a salt bootstrap can be fully
  379. automated for systems that are not built with VMware tools. Default is
  380. ``wait_for_ip_timeout: 1200``.
  381. ``customization``
  382. Specify whether the new virtual machine should be customized or not. If
  383. ``customization: False`` is set, the new virtual machine will not be customized.
  384. Default is ``customization: True``.
  385. ``private_key``
  386. Specify the path to the private key to use to be able to ssh to the VM.
  387. ``ssh_username``
  388. Specify the username to use in order to ssh to the VM. Default is ``root``
  389. ``password``
  390. Specify a password to use in order to ssh to the VM. If ``private_key`` is
  391. specified, you do not need to specify this.
  392. ``minion``
  393. Specify custom minion configuration you want the salt minion to have. A good example
  394. would be to specify the ``master`` as the IP/DNS name of the master.
  395. ``file_map``
  396. Specify file/files you want to copy to the VM before the bootstrap script is run
  397. and salt is installed. A good example of using this would be if you need to put
  398. custom repo files on the server in case your server will be in a private network
  399. and cannot reach external networks.
  400. ``hardware_version``
  401. Specify the virtual hardware version for the vm/template that is supported by the
  402. host.
  403. ``image``
  404. Specify the guest id of the VM. For a full list of supported values see the
  405. VMware vSphere documentation:
  406. http://pubs.vmware.com/vsphere-60/topic/com.vmware.wssdk.apiref.doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html
  407. .. note::
  408. For a clone operation, this argument is ignored.
  409. ``win_username``
  410. Specify windows vm administrator account.
  411. .. note::
  412. Windows template should have "administrator" account.
  413. ``win_password``
  414. Specify windows vm administrator account password.
  415. .. note::
  416. During network configuration (if network specified), it is used to specify new administrator password for the machine.
  417. ``win_organization_name``
  418. Specify windows vm user's organization. Default organization name is Organization
  419. VMware vSphere documentation:
  420. https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.vm.customization.UserData.html
  421. ``win_user_fullname``
  422. Specify windows vm user's fullname. Default fullname is "Windows User"
  423. VMware vSphere documentation:
  424. https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.vm.customization.UserData.html
  425. ``plain_text``
  426. Flag to specify whether or not the password is in plain text, rather than encrypted.
  427. VMware vSphere documentation:
  428. https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.vm.customization.Password.html
  429. ``win_installer``
  430. Specify windows minion client installer path
  431. ``win_run_once``
  432. Specify a list of commands to run on first login to a windows minion
  433. https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.vm.customization.GuiRunOnce.html
  434. Cloning a VM
  435. ============
  436. Cloning VMs/templates is the easiest and the preferred way to work with VMs using the VMware driver.
  437. .. note::
  438. Cloning operations are unsupported on standalone ESXi hosts, a vCenter server will be required.
  439. Example of a minimal profile:
  440. .. code-block:: yaml
  441. my-minimal-clone:
  442. provider: vcenter01
  443. clonefrom: 'test-vm'
  444. When cloning a VM, all the profile configuration parameters are optional and the configuration gets inherited from the clone.
  445. Example to add/resize a disk:
  446. .. code-block:: yaml
  447. my-disk-example:
  448. provider: vcenter01
  449. clonefrom: 'test-vm'
  450. devices:
  451. disk:
  452. Hard disk 1:
  453. size: 30
  454. Depending on the configuration of the VM that is getting cloned, the disk in the resulting clone will differ.
  455. .. note::
  456. - If the VM has no disk named 'Hard disk 1' an empty disk with the specified size will be added to the clone.
  457. - If the VM has a disk named 'Hard disk 1' and the size specified is larger than the original disk, an empty disk with the specified size will be added to the clone.
  458. - If the VM has a disk named 'Hard disk 1' and the size specified is smaller than the original disk, an empty disk with the original size will be added to the clone.
  459. Example to reconfigure the memory and number of vCPUs:
  460. .. code-block:: yaml
  461. my-disk-example:
  462. provider: vcenter01
  463. clonefrom: 'test-vm'
  464. memory: 16GB
  465. num_cpus: 8
  466. Cloning a Template
  467. ==================
  468. Cloning a template works similar to cloning a VM except for the fact that a resource
  469. pool or cluster must be specified additionally in the profile.
  470. Example of a minimal profile:
  471. .. code-block:: yaml
  472. my-template-clone:
  473. provider: vcenter01
  474. clonefrom: 'test-template'
  475. cluster: 'Prod'
  476. Cloning from a Snapshot
  477. =======================
  478. .. versionadded:: 2016.3.5
  479. Cloning from a snapshot requires that one of the
  480. supported options be set in the cloud profile.
  481. Supported options are ``createNewChildDiskBacking``,
  482. ``moveChildMostDiskBacking``, ``moveAllDiskBackingsAndAllowSharing``
  483. and ``moveAllDiskBackingsAndDisallowSharing``.
  484. Example of a minimal profile:
  485. .. code-block:: yaml
  486. my-template-clone:
  487. provider: vcenter01
  488. clonefrom: 'salt_vm'
  489. snapshot:
  490. disk_move_type: createNewChildDiskBacking
  491. # these types are also supported
  492. # disk_move_type: moveChildMostDiskBacking
  493. # disk_move_type: moveAllDiskBackingsAndAllowSharing
  494. # disk_move_type: moveAllDiskBackingsAndDisallowSharing
  495. Creating a VM
  496. =============
  497. .. versionadded:: 2016.3.0
  498. Creating a VM from scratch means that more configuration has to be specified in the
  499. profile because there is no place to inherit configuration from.
  500. .. note::
  501. Unlike most cloud drivers that use prepared images, creating VMs using VMware
  502. cloud driver needs an installation method that requires no human interaction.
  503. For Example: preseeded ISO, kickstart URL or network PXE boot.
  504. Example of a minimal profile:
  505. .. code-block:: yaml
  506. my-minimal-profile:
  507. provider: esx01
  508. datastore: esx01-datastore
  509. resourcepool: Resources
  510. folder: vm
  511. .. note::
  512. The example above contains the minimum required configuration needed to create
  513. a VM from scratch. The resulting VM will only have 1 VCPU, 32MB of RAM and will
  514. not have any storage or networking.
  515. Example of a complete profile:
  516. .. code-block:: yaml
  517. my-complete-example:
  518. provider: esx01
  519. datastore: esx01-datastore
  520. resourcepool: Resources
  521. folder: vm
  522. num_cpus: 2
  523. memory: 8GB
  524. image: debian7_64Guest
  525. devices:
  526. scsi:
  527. SCSI controller 0:
  528. type: lsilogic_sas
  529. ide:
  530. IDE 0: {}
  531. IDE 1: {}
  532. disk:
  533. Hard disk 0:
  534. controller: 'SCSI controller 0'
  535. size: 20
  536. mode: 'independent_nonpersistent'
  537. cd:
  538. CD/DVD drive 0:
  539. controller: 'IDE 0'
  540. device_type: datastore_iso_file
  541. iso_path: '[esx01-datastore] debian-8-with-preseed.iso'
  542. network:
  543. Network adapter 0:
  544. name: 'VM Network'
  545. swith_type: standard
  546. .. note::
  547. Depending on VMware ESX/ESXi version, an exact match for ``image`` might not
  548. be available. In such cases, the closest match to another ``image`` should
  549. be used. In the example above, a Debian 8 VM is created using the image
  550. ``debian7_64Guest`` which is for a Debian 7 guest.
  551. Specifying disk backing mode
  552. ============================
  553. .. versionadded:: 2016.3.5
  554. Disk backing mode can now be specified when cloning a VM. This option
  555. can be set in the cloud profile as shown in example below:
  556. .. code-block:: yaml
  557. my-vm:
  558. provider: esx01
  559. datastore: esx01-datastore
  560. resourcepool: Resources
  561. folder: vm
  562. devices:
  563. disk:
  564. Hard disk 1:
  565. mode: 'independent_nonpersistent'
  566. size: 42
  567. Hard disk 2:
  568. mode: 'independent_nonpersistent'