proxmox.rst 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. ============================
  2. Getting Started With Proxmox
  3. ============================
  4. Proxmox Virtual Environment is a complete server virtualization management solution,
  5. based on OpenVZ(in Proxmox up to 3.4)/LXC(from Proxmox 4.0 and up) and full virtualization with KVM.
  6. Further information can be found at:
  7. http://www.proxmox.org/
  8. Dependencies
  9. ============
  10. * IPy >= 0.81
  11. * requests >= 2.2.1
  12. Please note:
  13. This module allows you to create OpenVZ/LXC containers and KVM VMs, but installing Salt on it will only be
  14. done on containers rather than a KVM virtual machine.
  15. * Set up the cloud configuration at
  16. ``/etc/salt/cloud.providers`` or
  17. ``/etc/salt/cloud.providers.d/proxmox.conf``:
  18. .. code-block:: yaml
  19. my-proxmox-config:
  20. # Set up the location of the salt master
  21. #
  22. minion:
  23. master: saltmaster.example.com
  24. # Set the PROXMOX access credentials (see below)
  25. #
  26. user: myuser@pve
  27. password: badpass
  28. # Set the access URL for your PROXMOX host
  29. #
  30. url: your.proxmox.host
  31. driver: proxmox
  32. .. note::
  33. .. versionchanged:: 2015.8.0
  34. The ``provider`` parameter in cloud provider definitions was renamed to ``driver``. This
  35. change was made to avoid confusion with the ``provider`` parameter that is used in cloud profile
  36. definitions. Cloud provider definitions now use ``driver`` to refer to the Salt cloud module that
  37. provides the underlying functionality to connect to a cloud host, while cloud profiles continue
  38. to use ``provider`` to refer to provider configurations that you define.
  39. Access Credentials
  40. ==================
  41. The ``user``, ``password``, and ``url`` will be provided to you by your cloud
  42. host. These are all required in order for the PROXMOX driver to work.
  43. Cloud Profiles
  44. ==============
  45. Set up an initial profile at ``/etc/salt/cloud.profiles`` or
  46. ``/etc/salt/cloud.profiles.d/proxmox.conf``:
  47. * Configure a profile to be used:
  48. .. code-block:: yaml
  49. proxmox-ubuntu:
  50. provider: my-proxmox-config
  51. image: local:vztmpl/ubuntu-12.04-standard_12.04-1_amd64.tar.gz
  52. technology: lxc
  53. # host needs to be set to the configured name of the proxmox host
  54. # and not the ip address or FQDN of the server
  55. host: myvmhost
  56. ip_address: 192.168.100.155
  57. password: topsecret
  58. The profile can be realized now with a salt command:
  59. .. code-block:: bash
  60. # salt-cloud -p proxmox-ubuntu myubuntu
  61. This will create an instance named ``myubuntu`` on the cloud host. The
  62. minion that is installed on this instance will have a ``hostname`` of ``myubuntu``.
  63. If the command was executed on the salt-master, its Salt key will automatically
  64. be signed on the master.
  65. Once the instance has been created with salt-minion installed, connectivity to
  66. it can be verified with Salt:
  67. .. code-block:: bash
  68. # salt myubuntu test.version
  69. Required Settings
  70. =================
  71. The following settings are always required for PROXMOX:
  72. * Using the new cloud configuration format:
  73. .. code-block:: yaml
  74. my-proxmox-config:
  75. driver: proxmox
  76. user: saltcloud@pve
  77. password: xyzzy
  78. url: your.proxmox.host
  79. Optional Settings
  80. =================
  81. Unlike other cloud providers in Salt Cloud, Proxmox does not utilize a
  82. ``size`` setting. This is because Proxmox allows the end-user to specify a
  83. more detailed configuration for their instances, than is allowed by many other
  84. cloud providers. The following options are available to be used in a profile,
  85. with their default settings listed.
  86. .. code-block:: yaml
  87. # Description of the instance.
  88. desc: <instance_name>
  89. # How many CPU cores, and how fast they are (in MHz)
  90. cpus: 1
  91. cpuunits: 1000
  92. # How many megabytes of RAM
  93. memory: 256
  94. # How much swap space in MB
  95. swap: 256
  96. # Whether to auto boot the vm after the host reboots
  97. onboot: 1
  98. # Size of the instance disk (in GiB)
  99. disk: 10
  100. # Host to create this vm on
  101. host: myvmhost
  102. # Nameservers. Defaults to host
  103. nameserver: 8.8.8.8 8.8.4.4
  104. # Username and password
  105. ssh_username: root
  106. password: <value from PROXMOX.password>
  107. # The name of the image, from ``salt-cloud --list-images proxmox``
  108. image: local:vztmpl/ubuntu-12.04-standard_12.04-1_amd64.tar.gz
  109. # Whether or not to verify the SSL cert on the Proxmox host
  110. verify_ssl: False
  111. # Network interfaces, netX
  112. net0: name=eth0,bridge=vmbr0,ip=dhcp
  113. # Public key to add to /root/.ssh/authorized_keys.
  114. pubkey: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABA...'
  115. QEMU
  116. ====
  117. Some functionnalities works differently if you use 'qemu' as technology. In order to create a new VM with qemu, you need to specificy some more information.
  118. You can also clone a qemu template which already is on your Proxmox server.
  119. QEMU profile file (for a new VM):
  120. .. code-block:: yaml
  121. proxmox-win7:
  122. # Image of the new VM
  123. image: image.iso # You can get all your available images using 'salt-cloud --list-images provider_name' (Ex: 'salt-cloud --list-images my-proxmox-config')
  124. # Technology used to create the VM ('qemu', 'openvz'(on Proxmox <4.x) or 'lxc'(on Proxmox 4.x+))
  125. technology: qemu
  126. # Proxmox node name
  127. host: node_name
  128. # Proxmox password
  129. password: your_password
  130. # Workaround https://github.com/saltstack/salt/issues/27821
  131. size: ''
  132. # RAM size (MB)
  133. memory: 2048
  134. # OS Type enum (other / wxp / w2k / w2k3 / w2k8 / wvista / win7 / win8 / l24 / l26 / solaris)
  135. ostype: win7
  136. # Hard disk location
  137. sata0: <location>:<size>, format=<qcow2/vmdk/raw>, size=<size>GB #Example: local:120,format=qcow2,size=120GB
  138. #CD/DVD Drive
  139. ide2: <content_location>,media=cdrom #Example: local:iso/name.iso,media=cdrom
  140. # Network Device
  141. net0:<model>,bridge=<bridge> #Example: e1000,bridge=vmbr0
  142. # Enable QEMU Guest Agent (0 / 1)
  143. agent: 1
  144. # Use the QEMU Guest agent to determine the VM's IP (0 / 1)
  145. agent_get_ip: 1
  146. # VM name
  147. name: Test
  148. More information about these parameters can be found on Proxmox API (http://pve.proxmox.com/pve2-api-doc/) under the 'POST' method of nodes/{node}/qemu
  149. QEMU profile file (for a clone):
  150. .. code-block:: yaml
  151. proxmox-win7:
  152. # Enable Clone
  153. clone: True
  154. # New VM description
  155. clone_description: 'description'
  156. # New VM name
  157. clone_name: 'name'
  158. # New VM format (qcow2 / raw / vmdk)
  159. clone_format: qcow2
  160. # Full clone (1) or Link clone (0)
  161. clone_full: 0
  162. # VMID of Template to clone
  163. clone_from: ID
  164. # Technology used to create the VM ('qemu' or 'lxc')
  165. technology: qemu
  166. # Proxmox node name
  167. host: node_name
  168. # Proxmox password
  169. password: your_password
  170. # Workaround https://github.com/saltstack/salt/issues/27821
  171. size: ''
  172. More information can be found on Proxmox API under the 'POST' method of /nodes/{node}/qemu/{vmid}/clone
  173. .. note::
  174. The Proxmox API offers a lot more options and parameters, which are not yet
  175. supported by this salt-cloud 'overlay'. Feel free to add your contribution
  176. by forking the github repository and modifying the following file:
  177. ``salt/cloud/clouds/proxmox.py``
  178. An easy way to support more parameters for VM creation would be to add the
  179. names of the optional parameters in the 'create_nodes(vm\_)' function, under
  180. the 'qemu' technology. But it requires you to dig into the code ...