1
0

vmware.rst 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  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. ``clonefrom_datacenter``
  187. If the VM/template to clone exists in a different datacenter than the destination
  188. datacenter, supply the source VM/template's datacenter here.
  189. This defaults to the same value as ``datacenter``.
  190. .. versionadded:: neon
  191. ``num_cpus``
  192. Enter the number of vCPUS that you want the VM/template to have. If not specified,
  193. the current VM/template\'s vCPU count is used.
  194. ``cores_per_socket``
  195. Enter the number of cores per vCPU that you want the VM/template to have. If not specified,
  196. this will default to 1.
  197. .. note::
  198. Cores per socket should be less than or equal to the total number of
  199. vCPUs assigned to the VM/template.
  200. .. versionadded:: 2016.11.0
  201. ``memory``
  202. Enter the memory size (in MB or GB) that you want the VM/template to have. If
  203. not specified, the current VM/template\'s memory size is used. Example
  204. ``memory: 8GB`` or ``memory: 8192MB``.
  205. ``devices``
  206. Enter the device specifications here. Currently, the following devices can be
  207. created or reconfigured:
  208. cd
  209. Enter the CD/DVD drive specification here. If the CD/DVD drive doesn\'t exist,
  210. it will be created with the specified configuration. If the CD/DVD drive
  211. already exists, it will be reconfigured with the specifications. The following
  212. options can be specified per CD/DVD drive:
  213. device_type
  214. Specify how the CD/DVD drive should be used. Currently supported types are
  215. ``client_device`` and ``datastore_iso_file``. Default is
  216. ``device_type: client_device``
  217. iso_path
  218. Enter the path to the iso file present on the datastore only if
  219. ``device_type: datastore_iso_file``. The syntax to specify this is
  220. ``iso_path: "[datastoreName] vmimages/tools-isoimages/linux.iso"``. This
  221. field is ignored if ``device_type: client_device``
  222. mode
  223. Enter the mode of connection only if ``device_type: client_device``. Currently
  224. supported modes are ``passthrough`` and ``atapi``. This field is ignored if
  225. ``device_type: datastore_iso_file``. Default is ``mode: passthrough``
  226. controller
  227. Specify the IDE controller label to which this drive should be attached.
  228. This should be specified only when creating both the specified IDE
  229. controller as well as the CD/DVD drive at the same time.
  230. disk
  231. Enter the disk specification here. If the hard disk doesn\'t exist, it will
  232. be created with the provided size. If the hard disk already exists, it will
  233. be expanded if the provided size is greater than the current size of the disk.
  234. size
  235. Enter the size of disk in GB
  236. thin_provision
  237. Specifies whether the disk should be thin provisioned or not. Default is ``thin_provision: False``.
  238. .. versionadded:: 2016.3.0
  239. eagerly_scrub
  240. Specifies whether the disk should be rewrite with zeros during thick provisioning or not.
  241. Default is ``eagerly_scrub: False``.
  242. .. versionadded:: 2018.3.0
  243. controller
  244. Specify the SCSI controller label to which this disk should be attached.
  245. This should be specified only when creating both the specified SCSI
  246. controller as well as the hard disk at the same time.
  247. datastore
  248. The name of a valid datastore should you wish the new disk to be in
  249. a datastore other than the default for the VM.
  250. network
  251. Enter the network adapter specification here. If the network adapter doesn\'t
  252. exist, a new network adapter will be created with the specified network name,
  253. type and other configuration. If the network adapter already exists, it will
  254. be reconfigured with the specifications. The following additional options can
  255. be specified per network adapter (See example above):
  256. name
  257. Enter the network name you want the network adapter to be mapped to.
  258. adapter_type
  259. Enter the network adapter type you want to create. Currently supported
  260. types are ``vmxnet``, ``vmxnet2``, ``vmxnet3``, ``e1000`` and ``e1000e``.
  261. If no type is specified, by default ``vmxnet3`` will be used.
  262. switch_type
  263. Enter the type of switch to use. This decides whether to use a standard
  264. switch network or a distributed virtual portgroup. Currently supported
  265. types are ``standard`` for standard portgroups and ``distributed`` for
  266. distributed virtual portgroups.
  267. ip
  268. Enter the static IP you want the network adapter to be mapped to. If the
  269. network specified is DHCP enabled, you do not have to specify this.
  270. gateway
  271. Enter the gateway for the network as a list. If the network specified
  272. is DHCP enabled, you do not have to specify this.
  273. subnet_mask
  274. Enter the subnet mask for the network. If the network specified is DHCP
  275. enabled, you do not have to specify this.
  276. domain
  277. Enter the domain to be used with the network adapter. If the network
  278. specified is DHCP enabled, you do not have to specify this.
  279. mac
  280. Enter the MAC for this network adapter. If not specified an address
  281. will be selected automatically.
  282. scsi
  283. Enter the SCSI controller specification here. If the SCSI controller doesn\'t exist,
  284. a new SCSI controller will be created of the specified type. If the SCSI controller
  285. already exists, it will be reconfigured with the specifications. The following
  286. additional options can be specified per SCSI controller:
  287. type
  288. Enter the SCSI controller type you want to create. Currently supported
  289. types are ``lsilogic``, ``lsilogic_sas`` and ``paravirtual``. Type must
  290. be specified when creating a new SCSI controller.
  291. bus_sharing
  292. Specify this if sharing of virtual disks between virtual machines is desired.
  293. The following can be specified:
  294. virtual
  295. Virtual disks can be shared between virtual machines on the same server.
  296. physical
  297. Virtual disks can be shared between virtual machines on any server.
  298. no
  299. Virtual disks cannot be shared between virtual machines.
  300. ide
  301. Enter the IDE controller specification here. If the IDE controller doesn\'t exist,
  302. a new IDE controller is created. If the IDE controller already exists,
  303. no further changes to it are made. The IDE controller specification is
  304. a dictionary.
  305. .. code-block:: yaml
  306. ide:
  307. IDE 2: {}
  308. ``domain``
  309. Enter the global domain name to be used for DNS. If not specified and if the VM name
  310. is a FQDN, ``domain`` is set to the domain from the VM name. Default is ``local``.
  311. ``dns_servers``
  312. Enter the list of DNS servers to use in order of priority.
  313. ``resourcepool``
  314. Enter the name of the resourcepool to which the new virtual machine should be
  315. attached. This determines what compute resources will be available to the clone.
  316. .. note::
  317. - For a clone operation from a virtual machine, it will use the same
  318. resourcepool as the original virtual machine unless specified.
  319. - For a clone operation from a template to a virtual machine, specifying
  320. either this or cluster is required. If both are specified, the resourcepool
  321. value will be used.
  322. - For a clone operation to a template, this argument is ignored.
  323. ``cluster``
  324. Enter the name of the cluster whose resource pool the new virtual machine should
  325. be attached to.
  326. .. note::
  327. - For a clone operation from a virtual machine, it will use the same cluster\'s
  328. resourcepool as the original virtual machine unless specified.
  329. - For a clone operation from a template to a virtual machine, specifying either
  330. this or resourcepool is required. If both are specified, the resourcepool
  331. value will be used.
  332. - For a clone operation to a template, this argument is ignored.
  333. ``datastore``
  334. Enter the name of the datastore or the datastore cluster where the virtual machine
  335. should be located on physical storage. If not specified, the current datastore is
  336. used.
  337. .. note::
  338. - If you specify a datastore cluster name, DRS Storage recommendation is
  339. automatically applied.
  340. - If you specify a datastore name, DRS Storage recommendation is disabled.
  341. ``folder``
  342. Enter the name of the folder that will contain the new virtual machine.
  343. .. note::
  344. - For a clone operation from a VM/template, the new VM/template will be added
  345. to the same folder that the original VM/template belongs to unless specified.
  346. - If both folder and datacenter are specified, the folder value will be used.
  347. ``datacenter``
  348. Enter the name of the datacenter that will contain the new virtual machine.
  349. .. note::
  350. - For a clone operation from a VM/template, the new VM/template will be added
  351. to the same folder that the original VM/template belongs to unless specified.
  352. - If both folder and datacenter are specified, the folder value will be used.
  353. ``host``
  354. Enter the name of the target host where the virtual machine should be registered.
  355. If not specified:
  356. .. note::
  357. - If resource pool is not specified, current host is used.
  358. - If resource pool is specified, and the target pool represents a stand-alone
  359. host, the host is used.
  360. - If resource pool is specified, and the target pool represents a DRS-enabled
  361. cluster, a host selected by DRS is used.
  362. - If resource pool is specified and the target pool represents a cluster without
  363. DRS enabled, an InvalidArgument exception be thrown.
  364. ``template``
  365. Specifies whether the new virtual machine should be marked as a template or not.
  366. Default is ``template: False``.
  367. ``power_on``
  368. Specifies whether the new virtual machine should be powered on or not. If
  369. ``template: True`` is set, this field is ignored. Default is ``power_on: True``.
  370. ``extra_config``
  371. Specifies the additional configuration information for the virtual machine. This
  372. describes a set of modifications to the additional options. If the key is already
  373. present, it will be reset with the new value provided. Otherwise, a new option is
  374. added. Keys with empty values will be removed.
  375. ``annotation``
  376. User-provided description of the virtual machine. This will store a message in the
  377. vSphere interface, under the annotations section in the Summary view of the virtual
  378. machine.
  379. ``deploy``
  380. Specifies if salt should be installed on the newly created VM. Default is ``True``
  381. so salt will be installed using the bootstrap script. If ``template: True`` or
  382. ``power_on: False`` is set, this field is ignored and salt will not be installed.
  383. ``wait_for_ip_timeout``
  384. When ``deploy: True``, this timeout determines the maximum time to wait for
  385. VMware tools to be installed on the virtual machine. If this timeout is
  386. reached, an attempt to determine the client's IP will be made by resolving
  387. the VM's name. By lowering this value a salt bootstrap can be fully
  388. automated for systems that are not built with VMware tools. Default is
  389. ``wait_for_ip_timeout: 1200``.
  390. ``customization``
  391. Specify whether the new virtual machine should be customized or not. If
  392. ``customization: False`` is set, the new virtual machine will not be customized.
  393. Default is ``customization: True``.
  394. ``private_key``
  395. Specify the path to the private key to use to be able to ssh to the VM.
  396. ``ssh_username``
  397. Specify the username to use in order to ssh to the VM. Default is ``root``
  398. ``password``
  399. Specify a password to use in order to ssh to the VM. If ``private_key`` is
  400. specified, you do not need to specify this.
  401. ``minion``
  402. Specify custom minion configuration you want the salt minion to have. A good example
  403. would be to specify the ``master`` as the IP/DNS name of the master.
  404. ``file_map``
  405. Specify file/files you want to copy to the VM before the bootstrap script is run
  406. and salt is installed. A good example of using this would be if you need to put
  407. custom repo files on the server in case your server will be in a private network
  408. and cannot reach external networks.
  409. ``hardware_version``
  410. Specify the virtual hardware version for the vm/template that is supported by the
  411. host.
  412. ``image``
  413. Specify the guest id of the VM. For a full list of supported values see the
  414. VMware vSphere documentation:
  415. http://pubs.vmware.com/vsphere-60/topic/com.vmware.wssdk.apiref.doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html
  416. .. note::
  417. For a clone operation, this argument is ignored.
  418. ``win_username``
  419. Specify windows vm administrator account.
  420. .. note::
  421. Windows template should have "administrator" account.
  422. ``win_password``
  423. Specify windows vm administrator account password.
  424. .. note::
  425. During network configuration (if network specified), it is used to specify new administrator password for the machine.
  426. ``win_organization_name``
  427. Specify windows vm user's organization. Default organization name is Organization
  428. VMware vSphere documentation:
  429. https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.vm.customization.UserData.html
  430. ``win_user_fullname``
  431. Specify windows vm user's fullname. Default fullname is "Windows User"
  432. VMware vSphere documentation:
  433. https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.vm.customization.UserData.html
  434. ``plain_text``
  435. Flag to specify whether or not the password is in plain text, rather than encrypted.
  436. VMware vSphere documentation:
  437. https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.vm.customization.Password.html
  438. ``win_installer``
  439. Specify windows minion client installer path
  440. ``win_run_once``
  441. Specify a list of commands to run on first login to a windows minion
  442. https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.vm.customization.GuiRunOnce.html
  443. ``win_ad_domain``
  444. Specify the AD domain to join during customization. ``win_ad_user`` and ``win_ad_password``
  445. must also be specified.
  446. Default is not set.
  447. .. versionadded:: neon
  448. ``win_ad_user``
  449. Specify the user from ``win_ad_domain`` that will be used to join the computer to the domain
  450. during customization.
  451. Default is not set.
  452. .. versionadded:: neon
  453. ``win_ad_password``
  454. Specify the password for the ``win_ad_user``.
  455. Default is not set.
  456. .. versionadded:: neon
  457. ``win_autologon``
  458. Specify if the local "Administrator" account should be logged in to the Windows machine
  459. after the cloning process.
  460. Defaults to 'True', must be 'True' for ``win_run_once`` to be executed.
  461. .. versionadded:: neon
  462. ``timezone``
  463. Specify the timezone to apply to the VM during customization.
  464. See https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.vm.customization.LinuxPrep.html for Linux timezone information.
  465. See https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.vm.customization.GuiUnattended.html for Windows timezone information.
  466. Default is not set.
  467. .. versionadded:: neon
  468. ``hw_clock_utc``
  469. Specify whether the hardware clock is in UTC or local time.
  470. Default is not set.
  471. .. versionadded:: neon
  472. Cloning a VM
  473. ============
  474. Cloning VMs/templates is the easiest and the preferred way to work with VMs using the VMware driver.
  475. .. note::
  476. Cloning operations are unsupported on standalone ESXi hosts, a vCenter server will be required.
  477. Example of a minimal profile:
  478. .. code-block:: yaml
  479. my-minimal-clone:
  480. provider: vcenter01
  481. clonefrom: 'test-vm'
  482. When cloning a VM, all the profile configuration parameters are optional and the configuration gets inherited from the clone.
  483. Example to add/resize a disk:
  484. .. code-block:: yaml
  485. my-disk-example:
  486. provider: vcenter01
  487. clonefrom: 'test-vm'
  488. devices:
  489. disk:
  490. Hard disk 1:
  491. size: 30
  492. Depending on the configuration of the VM that is getting cloned, the disk in the resulting clone will differ.
  493. .. note::
  494. - If the VM has no disk named 'Hard disk 1' an empty disk with the specified size will be added to the clone.
  495. - 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.
  496. - 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.
  497. Example to reconfigure the memory and number of vCPUs:
  498. .. code-block:: yaml
  499. my-disk-example:
  500. provider: vcenter01
  501. clonefrom: 'test-vm'
  502. memory: 16GB
  503. num_cpus: 8
  504. Cloning a Template
  505. ==================
  506. Cloning a template works similar to cloning a VM except for the fact that a resource
  507. pool or cluster must be specified additionally in the profile.
  508. Example of a minimal profile:
  509. .. code-block:: yaml
  510. my-template-clone:
  511. provider: vcenter01
  512. clonefrom: 'test-template'
  513. cluster: 'Prod'
  514. Cloning from a Snapshot
  515. =======================
  516. .. versionadded:: 2016.3.5
  517. Cloning from a snapshot requires that one of the
  518. supported options be set in the cloud profile.
  519. Supported options are ``createNewChildDiskBacking``,
  520. ``moveChildMostDiskBacking``, ``moveAllDiskBackingsAndAllowSharing``
  521. and ``moveAllDiskBackingsAndDisallowSharing``.
  522. Example of a minimal profile:
  523. .. code-block:: yaml
  524. my-template-clone:
  525. provider: vcenter01
  526. clonefrom: 'salt_vm'
  527. snapshot:
  528. disk_move_type: createNewChildDiskBacking
  529. # these types are also supported
  530. # disk_move_type: moveChildMostDiskBacking
  531. # disk_move_type: moveAllDiskBackingsAndAllowSharing
  532. # disk_move_type: moveAllDiskBackingsAndDisallowSharing
  533. Creating a VM
  534. =============
  535. .. versionadded:: 2016.3.0
  536. Creating a VM from scratch means that more configuration has to be specified in the
  537. profile because there is no place to inherit configuration from.
  538. .. note::
  539. Unlike most cloud drivers that use prepared images, creating VMs using VMware
  540. cloud driver needs an installation method that requires no human interaction.
  541. For Example: preseeded ISO, kickstart URL or network PXE boot.
  542. Example of a minimal profile:
  543. .. code-block:: yaml
  544. my-minimal-profile:
  545. provider: esx01
  546. datastore: esx01-datastore
  547. resourcepool: Resources
  548. folder: vm
  549. .. note::
  550. The example above contains the minimum required configuration needed to create
  551. a VM from scratch. The resulting VM will only have 1 VCPU, 32MB of RAM and will
  552. not have any storage or networking.
  553. Example of a complete profile:
  554. .. code-block:: yaml
  555. my-complete-example:
  556. provider: esx01
  557. datastore: esx01-datastore
  558. resourcepool: Resources
  559. folder: vm
  560. num_cpus: 2
  561. memory: 8GB
  562. image: debian7_64Guest
  563. devices:
  564. scsi:
  565. SCSI controller 0:
  566. type: lsilogic_sas
  567. ide:
  568. IDE 0: {}
  569. IDE 1: {}
  570. disk:
  571. Hard disk 0:
  572. controller: 'SCSI controller 0'
  573. size: 20
  574. mode: 'independent_nonpersistent'
  575. cd:
  576. CD/DVD drive 0:
  577. controller: 'IDE 0'
  578. device_type: datastore_iso_file
  579. iso_path: '[esx01-datastore] debian-8-with-preseed.iso'
  580. network:
  581. Network adapter 0:
  582. name: 'VM Network'
  583. swith_type: standard
  584. .. note::
  585. Depending on VMware ESX/ESXi version, an exact match for ``image`` might not
  586. be available. In such cases, the closest match to another ``image`` should
  587. be used. In the example above, a Debian 8 VM is created using the image
  588. ``debian7_64Guest`` which is for a Debian 7 guest.
  589. Specifying disk backing mode
  590. ============================
  591. .. versionadded:: 2016.3.5
  592. Disk backing mode can now be specified when cloning a VM. This option
  593. can be set in the cloud profile as shown in example below:
  594. .. code-block:: yaml
  595. my-vm:
  596. provider: esx01
  597. datastore: esx01-datastore
  598. resourcepool: Resources
  599. folder: vm
  600. devices:
  601. disk:
  602. Hard disk 1:
  603. mode: 'independent_nonpersistent'
  604. size: 42
  605. Hard disk 2:
  606. mode: 'independent_nonpersistent'