mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #30349 from rallytime/bp-30347
Back-port #30347 to 2015.8
This commit is contained in:
commit
bccb8f3b5b
6 changed files with 300 additions and 22 deletions
|
@ -81,11 +81,14 @@ proxy process. pyVmomi can be installed via pip:
|
|||
|
||||
.. note::
|
||||
|
||||
A new version of pyVmomi was recently released to PyPi, version 6.0. There
|
||||
have been some problems with the SSL authentication and connection pieces of
|
||||
Salt that cause stack traces when a proper SSL certificate is not in place.
|
||||
Until `Issue #29537`_ is resolved, SaltStack recommends installing pyVmomi
|
||||
version 5.5.0.
|
||||
Version 6.0 of pyVmomi has some problems with SSL error handling on certain
|
||||
versions of Python. If using version 6.0 of pyVmomi, the machine that you
|
||||
are running the proxy minion process from must have either Python 2.6,
|
||||
Python 2.7.9, or newer. This is due to an upstream dependency in pyVmomi 6.0
|
||||
that is not supported in Python version 2.7 to 2.7.8. If the
|
||||
version of Python running the proxy process is not in the supported range, you
|
||||
will need to install an earlier version of pyVmomi. See `Issue #29537`_ for
|
||||
more information.
|
||||
|
||||
.. _Issue #29537: https://github.com/saltstack/salt/issues/29537
|
||||
|
||||
|
@ -103,7 +106,7 @@ ESXCLI
|
|||
------
|
||||
|
||||
Currently, about a third of the functions used for the ESXi Proxy Minion require
|
||||
the ESXCLI package be installed on machine running the Proxy Minion process.
|
||||
the ESXCLI package be installed on the machine running the Proxy Minion process.
|
||||
|
||||
The ESXCLI package is also referred to as the VMware vSphere CLI, or vCLI. VMware
|
||||
provides vCLI package installation instructions for `vSphere 5.5`_ and
|
||||
|
@ -120,8 +123,8 @@ the following command:
|
|||
|
||||
esxcli -s <host-location> -u <username> -p <password> system syslog config get
|
||||
|
||||
If the connection was successful ESXCLI was succesfully installed on your system,
|
||||
you should see output related to the ESXi host's syslog configuration.
|
||||
If the connection was successful, ESXCLI was successfully installed on your system.
|
||||
You should see output related to the ESXi host's syslog configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
|
|
|
@ -10,7 +10,42 @@ The VMware cloud module allows you to manage VMware ESX, ESXi, and vCenter.
|
|||
See :doc:`Getting started with VMware </topics/cloud/vmware>` to get started.
|
||||
|
||||
:codeauthor: Nitin Madhok <nmadhok@clemson.edu>
|
||||
:depends: pyVmomi Python module
|
||||
|
||||
|
||||
Dependencies
|
||||
============
|
||||
|
||||
- pyVmomi Python Module
|
||||
|
||||
pyVmomi
|
||||
-------
|
||||
|
||||
PyVmomi can be installed via pip:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install pyVmomi
|
||||
|
||||
.. note::
|
||||
|
||||
Version 6.0 of pyVmomi has some problems with SSL error handling on certain
|
||||
versions of Python. If using version 6.0 of pyVmomi, Python 2.6,
|
||||
Python 2.7.9, or newer must be present. This is due to an upstream dependency
|
||||
in pyVmomi 6.0 that is not supported in Python versions 2.7 to 2.7.8. If the
|
||||
version of Python is not in the supported range, you will need to install an
|
||||
earlier version of pyVmomi. See `Issue #29537`_ for more information.
|
||||
|
||||
.. _Issue #29537: https://github.com/saltstack/salt/issues/29537
|
||||
|
||||
Based on the note above, to install an earlier version of pyVmomi than the
|
||||
version currently listed in PyPi, run the following:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install pyVmomi==5.5.0.2014.1.1
|
||||
|
||||
The 5.5.0.2014.1.1 is a known stable version that this original VMware cloud
|
||||
driver was developed against.
|
||||
|
||||
.. note::
|
||||
Ensure python pyVmomi module is installed by running following one-liner
|
||||
|
@ -20,6 +55,10 @@ See :doc:`Getting started with VMware </topics/cloud/vmware>` to get started.
|
|||
|
||||
python -c "import pyVmomi" ; echo $?
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
To use this module, set up the vCenter URL, username and password in the
|
||||
cloud configuration at
|
||||
``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/vmware.conf``:
|
||||
|
|
|
@ -5,11 +5,65 @@ Manage VMware vCenter servers and ESXi hosts.
|
|||
.. versionadded:: 2015.8.4
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
============
|
||||
|
||||
- pyVmomi Python Module
|
||||
- ESXCLI
|
||||
|
||||
pyVmomi
|
||||
-------
|
||||
|
||||
PyVmomi can be installed via pip:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install pyVmomi
|
||||
|
||||
.. note::
|
||||
|
||||
Version 6.0 of pyVmomi has some problems with SSL error handling on certain
|
||||
versions of Python. If using version 6.0 of pyVmomi, Python 2.6,
|
||||
Python 2.7.9, or newer must be present. This is due to an upstream dependency
|
||||
in pyVmomi 6.0 that is not supported in Python versions 2.7 to 2.7.8. If the
|
||||
version of Python is not in the supported range, you will need to install an
|
||||
earlier version of pyVmomi. See `Issue #29537`_ for more information.
|
||||
|
||||
.. _Issue #29537: https://github.com/saltstack/salt/issues/29537
|
||||
|
||||
Based on the note above, to install an earlier version of pyVmomi than the
|
||||
version currently listed in PyPi, run the following:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install pyVmomi==5.5.0.2014.1.1
|
||||
|
||||
The 5.5.0.2014.1.1 is a known stable version that this original vSphere Execution
|
||||
Module was developed against.
|
||||
|
||||
ESXCLI
|
||||
------
|
||||
|
||||
Currently, about a third of the functions used in the vSphere Execution Module require
|
||||
the ESXCLI package be installed on the machine running the Proxy Minion process.
|
||||
|
||||
The ESXCLI package is also referred to as the VMware vSphere CLI, or vCLI. VMware
|
||||
provides vCLI package installation instructions for `vSphere 5.5`_ and
|
||||
`vSphere 6.0`_.
|
||||
|
||||
.. _vSphere 5.5: http://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.vcli.getstart.doc/cli_install.4.2.html
|
||||
.. _vSphere 6.0: http://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vcli.getstart.doc/cli_install.4.2.html
|
||||
|
||||
Once all of the required dependencies are in place and the vCLI package is
|
||||
installed, you can check to see if you can connect to your ESXi host or vCenter
|
||||
server by running the following command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
esxcli -s <host-location> -u <username> -p <password> system syslog config get
|
||||
|
||||
If the connection was successful, ESXCLI was successfully installed on your system.
|
||||
You should see output related to the ESXi host's syslog configuration.
|
||||
|
||||
.. note::
|
||||
|
||||
Be aware that some functionality in this execution module may depend on the
|
||||
|
@ -27,7 +81,7 @@ Dependencies
|
|||
|
||||
|
||||
About
|
||||
-----
|
||||
=====
|
||||
|
||||
This execution module was designed to be able to handle connections both to a
|
||||
vCenter Server, as well as to an ESXi host. It utilizes the pyVmomi Python
|
||||
|
|
|
@ -4,9 +4,6 @@ Proxy Minion interface module for managing VMWare ESXi hosts.
|
|||
|
||||
.. versionadded:: 2015.8.4
|
||||
|
||||
:depends: pyVmomi
|
||||
:depends: ESXCLI
|
||||
|
||||
**Special Note: SaltStack thanks** `Adobe Corporation <http://adobe.com/>`_
|
||||
**for their support in creating this Proxy Minion integration.**
|
||||
|
||||
|
@ -24,6 +21,68 @@ More in-depth conceptual reading on Proxy Minions can be found in the
|
|||
documentation.
|
||||
|
||||
|
||||
Dependencies
|
||||
============
|
||||
|
||||
- pyVmomi Python Module
|
||||
- ESXCLI
|
||||
|
||||
|
||||
pyVmomi
|
||||
-------
|
||||
|
||||
PyVmomi can be installed via pip:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install pyVmomi
|
||||
|
||||
.. note::
|
||||
|
||||
Version 6.0 of pyVmomi has some problems with SSL error handling on certain
|
||||
versions of Python. If using version 6.0 of pyVmomi, Python 2.6,
|
||||
Python 2.7.9, or newer must be present. This is due to an upstream dependency
|
||||
in pyVmomi 6.0 that is not supported in Python versions 2.7 to 2.7.8. If the
|
||||
version of Python is not in the supported range, you will need to install an
|
||||
earlier version of pyVmomi. See `Issue #29537`_ for more information.
|
||||
|
||||
.. _Issue #29537: https://github.com/saltstack/salt/issues/29537
|
||||
|
||||
Based on the note above, to install an earlier version of pyVmomi than the
|
||||
version currently listed in PyPi, run the following:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install pyVmomi==5.5.0.2014.1.1
|
||||
|
||||
The 5.5.0.2014.1.1 is a known stable version that this original ESXi State
|
||||
Module was developed against.
|
||||
|
||||
ESXCLI
|
||||
------
|
||||
|
||||
Currently, about a third of the functions used in the vSphere Execution Module require
|
||||
the ESXCLI package be installed on the machine running the Proxy Minion process.
|
||||
|
||||
The ESXCLI package is also referred to as the VMware vSphere CLI, or vCLI. VMware
|
||||
provides vCLI package installation instructions for `vSphere 5.5`_ and
|
||||
`vSphere 6.0`_.
|
||||
|
||||
.. _vSphere 5.5: http://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.vcli.getstart.doc/cli_install.4.2.html
|
||||
.. _vSphere 6.0: http://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vcli.getstart.doc/cli_install.4.2.html
|
||||
|
||||
Once all of the required dependencies are in place and the vCLI package is
|
||||
installed, you can check to see if you can connect to your ESXi host or vCenter
|
||||
server by running the following command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
esxcli -s <host-location> -u <username> -p <password> system syslog config get
|
||||
|
||||
If the connection was successful, ESXCLI was successfully installed on your system.
|
||||
You should see output related to the ESXi host's syslog configuration.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
To use this integration proxy module, please configure the following:
|
||||
|
|
|
@ -5,11 +5,66 @@ Manage VMware ESXi Hosts.
|
|||
.. versionadded:: 2015.8.4
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
============
|
||||
|
||||
- pyVmomi Python Module
|
||||
- ESXCLI
|
||||
|
||||
|
||||
pyVmomi
|
||||
-------
|
||||
|
||||
PyVmomi can be installed via pip:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install pyVmomi
|
||||
|
||||
.. note::
|
||||
|
||||
Version 6.0 of pyVmomi has some problems with SSL error handling on certain
|
||||
versions of Python. If using version 6.0 of pyVmomi, Python 2.6,
|
||||
Python 2.7.9, or newer must be present. This is due to an upstream dependency
|
||||
in pyVmomi 6.0 that is not supported in Python versions 2.7 to 2.7.8. If the
|
||||
version of Python is not in the supported range, you will need to install an
|
||||
earlier version of pyVmomi. See `Issue #29537`_ for more information.
|
||||
|
||||
.. _Issue #29537: https://github.com/saltstack/salt/issues/29537
|
||||
|
||||
Based on the note above, to install an earlier version of pyVmomi than the
|
||||
version currently listed in PyPi, run the following:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install pyVmomi==5.5.0.2014.1.1
|
||||
|
||||
The 5.5.0.2014.1.1 is a known stable version that this original ESXi State
|
||||
Module was developed against.
|
||||
|
||||
ESXCLI
|
||||
------
|
||||
|
||||
Currently, about a third of the functions used in the vSphere Execution Module require
|
||||
the ESXCLI package be installed on the machine running the Proxy Minion process.
|
||||
|
||||
The ESXCLI package is also referred to as the VMware vSphere CLI, or vCLI. VMware
|
||||
provides vCLI package installation instructions for `vSphere 5.5`_ and
|
||||
`vSphere 6.0`_.
|
||||
|
||||
.. _vSphere 5.5: http://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.vcli.getstart.doc/cli_install.4.2.html
|
||||
.. _vSphere 6.0: http://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vcli.getstart.doc/cli_install.4.2.html
|
||||
|
||||
Once all of the required dependencies are in place and the vCLI package is
|
||||
installed, you can check to see if you can connect to your ESXi host or vCenter
|
||||
server by running the following command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
esxcli -s <host-location> -u <username> -p <password> system syslog config get
|
||||
|
||||
If the connection was successful, ESXCLI was successfully installed on your system.
|
||||
You should see output related to the ESXi host's syslog configuration.
|
||||
|
||||
.. note::
|
||||
|
||||
Be aware that some functionality in this state module may depend on the
|
||||
|
|
|
@ -16,6 +16,60 @@ Dependencies
|
|||
- ESXCLI: This dependency is only needed to use the ``esxcli`` function. No other
|
||||
functions in this module rely on ESXCLI.
|
||||
|
||||
pyVmomi
|
||||
-------
|
||||
|
||||
PyVmomi can be installed via pip:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install pyVmomi
|
||||
|
||||
.. note::
|
||||
|
||||
Version 6.0 of pyVmomi has some problems with SSL error handling on certain
|
||||
versions of Python. If using version 6.0 of pyVmomi, Python 2.6,
|
||||
Python 2.7.9, or newer must be present. This is due to an upstream dependency
|
||||
in pyVmomi 6.0 that is not supported in Python versions 2.7 to 2.7.8. If the
|
||||
version of Python is not in the supported range, you will need to install an
|
||||
earlier version of pyVmomi. See `Issue #29537`_ for more information.
|
||||
|
||||
.. _Issue #29537: https://github.com/saltstack/salt/issues/29537
|
||||
|
||||
Based on the note above, to install an earlier version of pyVmomi than the
|
||||
version currently listed in PyPi, run the following:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install pyVmomi==5.5.0.2014.1.1
|
||||
|
||||
The 5.5.0.2014.1.1 is a known stable version that this original VMware utils file
|
||||
was developed against.
|
||||
|
||||
ESXCLI
|
||||
------
|
||||
|
||||
This dependency is only needed to use the ``esxcli`` function. At the time of this
|
||||
writing, no other functions in this module rely on ESXCLI.
|
||||
|
||||
The ESXCLI package is also referred to as the VMware vSphere CLI, or vCLI. VMware
|
||||
provides vCLI package installation instructions for `vSphere 5.5`_ and
|
||||
`vSphere 6.0`_.
|
||||
|
||||
.. _vSphere 5.5: http://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.vcli.getstart.doc/cli_install.4.2.html
|
||||
.. _vSphere 6.0: http://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vcli.getstart.doc/cli_install.4.2.html
|
||||
|
||||
Once all of the required dependencies are in place and the vCLI package is
|
||||
installed, you can check to see if you can connect to your ESXi host or vCenter
|
||||
server by running the following command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
esxcli -s <host-location> -u <username> -p <password> system syslog config get
|
||||
|
||||
If the connection was successful, ESXCLI was successfully installed on your system.
|
||||
You should see output related to the ESXi host's syslog configuration.
|
||||
|
||||
'''
|
||||
|
||||
# Import Python Libs
|
||||
|
@ -141,8 +195,8 @@ def get_service_instance(host, username, password, protocol=None, port=None):
|
|||
except Exception as exc:
|
||||
default_msg = 'Could not connect to host \'{0}\'. ' \
|
||||
'Please check the debug log for more information.'.format(host)
|
||||
if isinstance(exc, vim.fault.HostConnectFault) and '[SSL: CERTIFICATE_VERIFY_FAILED]' in exc.msg:
|
||||
try:
|
||||
try:
|
||||
if (isinstance(exc, vim.fault.HostConnectFault) and '[SSL: CERTIFICATE_VERIFY_FAILED]' in exc.msg) or '[SSL: CERTIFICATE_VERIFY_FAILED]' in str(exc):
|
||||
import ssl
|
||||
default_context = ssl._create_default_https_context
|
||||
ssl._create_default_https_context = ssl._create_unverified_context
|
||||
|
@ -154,14 +208,28 @@ def get_service_instance(host, username, password, protocol=None, port=None):
|
|||
port=port
|
||||
)
|
||||
ssl._create_default_https_context = default_context
|
||||
except Exception as exc:
|
||||
else:
|
||||
err_msg = exc.msg if hasattr(exc, 'msg') else default_msg
|
||||
log.debug(exc)
|
||||
raise SaltSystemExit(err_msg)
|
||||
|
||||
except Exception as exc:
|
||||
if 'certificate verify failed' in str(exc):
|
||||
import ssl
|
||||
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
|
||||
context.verify_mode = ssl.CERT_NONE
|
||||
service_instance = SmartConnect(
|
||||
host=host,
|
||||
user=username,
|
||||
pwd=password,
|
||||
protocol=protocol,
|
||||
port=port,
|
||||
sslContext=context
|
||||
)
|
||||
else:
|
||||
err_msg = exc.msg if hasattr(exc, 'msg') else default_msg
|
||||
log.debug(exc)
|
||||
raise SaltSystemExit(err_msg)
|
||||
else:
|
||||
err_msg = exc.msg if hasattr(exc, 'msg') else default_msg
|
||||
log.debug(exc)
|
||||
raise SaltSystemExit(err_msg)
|
||||
|
||||
atexit.register(Disconnect, service_instance)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue