2013-11-23 14:35:22 +00:00
|
|
|
==========================
|
|
|
|
Troubleshooting Salt Cloud
|
|
|
|
==========================
|
|
|
|
|
|
|
|
This page describes various steps for troubleshooting problems that may arise
|
|
|
|
while using Salt Cloud.
|
|
|
|
|
2014-06-16 22:29:08 +00:00
|
|
|
Virtual Machines Are Created, But Do Not Respond
|
|
|
|
================================================
|
|
|
|
|
2014-06-17 02:19:32 +00:00
|
|
|
Are TCP ports 4505 and 4506 open on the master? This is easy to overlook on new
|
|
|
|
masters. Information on how to open firewall ports on various platforms can be
|
|
|
|
found :doc:`here </topics/tutorials/firewall>`.
|
2014-06-16 22:29:08 +00:00
|
|
|
|
|
|
|
|
2013-11-23 14:35:22 +00:00
|
|
|
Generic Troubleshooting Steps
|
|
|
|
=============================
|
|
|
|
This section describes a set of instructions that are useful to a large number
|
|
|
|
of situations, and are likely to solve most issues that arise.
|
|
|
|
|
2013-12-28 06:01:08 +00:00
|
|
|
.. admonition:: Version Compatibility
|
|
|
|
|
|
|
|
One of the most common issues that Salt Cloud users run into is import
|
2013-12-29 01:02:03 +00:00
|
|
|
errors. These are often caused by version compatibility issues with Salt.
|
2013-12-28 06:01:08 +00:00
|
|
|
|
|
|
|
Salt 0.16.x works with Salt Cloud 0.8.9 or greater.
|
|
|
|
|
|
|
|
Salt 0.17.x requires Salt Cloud 0.8.11.
|
|
|
|
|
|
|
|
Releases after 0.17.x (0.18 or greater) should not encounter issues as Salt
|
|
|
|
Cloud has been merged into Salt itself.
|
|
|
|
|
2013-11-23 14:35:22 +00:00
|
|
|
Debug Mode
|
|
|
|
----------
|
|
|
|
Frequently, running Salt Cloud in debug mode will reveal information about a
|
|
|
|
deployment which would otherwise not be obvious:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
salt-cloud -p myprofile myinstance -l debug
|
|
|
|
|
|
|
|
Keep in mind that a number of messages will appear that look at first like
|
|
|
|
errors, but are in fact intended to give developers factual information to
|
|
|
|
assist in debugging. A number of messages that appear will be for cloud
|
|
|
|
providers that you do not have configured; in these cases, the message usually
|
|
|
|
is intended to confirm that they are not configured.
|
|
|
|
|
|
|
|
|
|
|
|
Salt Bootstrap
|
|
|
|
--------------
|
|
|
|
By default, Salt Cloud uses the Salt Bootstrap script to provision instances:
|
|
|
|
|
|
|
|
.. _`Salt Bootstrap`: https://github.com/saltstack/salt-bootstrap
|
|
|
|
|
|
|
|
This script is packaged with Salt Cloud, but may be updated without updating
|
|
|
|
the Salt package:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
salt-cloud -u
|
|
|
|
|
|
|
|
|
|
|
|
The Bootstrap Log
|
|
|
|
-----------------
|
|
|
|
If the default deploy script was used, there should be a file in the ``/tmp/``
|
|
|
|
directory called ``bootstrap-salt.log``. This file contains the full output from
|
|
|
|
the deployment, including any errors that may have occurred.
|
|
|
|
|
|
|
|
|
|
|
|
Keeping Temp Files
|
|
|
|
------------------
|
|
|
|
Salt Cloud uploads minion-specific files to instances once they are available
|
|
|
|
via SSH, and then executes a deploy script to put them into the correct place
|
|
|
|
and install Salt. The ``--keep-tmp`` option will instruct Salt Cloud not to
|
|
|
|
remove those files when finished with them, so that the user may inspect them
|
|
|
|
for problems:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
salt-cloud -p myprofile myinstance --keep-tmp
|
|
|
|
|
|
|
|
By default, Salt Cloud will create a directory on the target instance called
|
|
|
|
``/tmp/.saltcloud/``. This directory should be owned by the user that is to
|
|
|
|
execute the deploy script, and should have permissions of ``0700``.
|
|
|
|
|
2015-08-10 15:20:26 +00:00
|
|
|
Most cloud hosts are configured to use ``root`` as the default initial user
|
2013-11-23 14:35:22 +00:00
|
|
|
for deployment, and as such, this directory and all files in it should be owned
|
|
|
|
by the ``root`` user.
|
|
|
|
|
|
|
|
The ``/tmp/.saltcloud/`` directory should the following files:
|
|
|
|
|
|
|
|
- A ``deploy.sh`` script. This script should have permissions of ``0755``.
|
|
|
|
- A ``.pem`` and ``.pub`` key named after the minion. The ``.pem`` file should
|
|
|
|
have permissions of ``0600``. Ensure that the ``.pem`` and ``.pub`` files have
|
|
|
|
been properly copied to the ``/etc/salt/pki/minion/`` directory.
|
|
|
|
- A file called ``minion``. This file should have been copied to the
|
2014-12-11 15:51:43 +00:00
|
|
|
``/etc/salt/`` directory.
|
2013-11-23 14:35:22 +00:00
|
|
|
- Optionally, a file called ``grains``. This file, if present, should have been
|
|
|
|
copied to the ``/etc/salt/`` directory.
|
|
|
|
|
|
|
|
|
|
|
|
Unprivileged Primary Users
|
|
|
|
--------------------------
|
2015-08-10 15:20:26 +00:00
|
|
|
Some cloud hosts, most notably EC2, are configured with a different primary user.
|
2014-12-12 19:32:16 +00:00
|
|
|
Some common examples are ``ec2-user``, ``ubuntu``, ``fedora``, and ``bitnami``.
|
2013-11-23 14:35:22 +00:00
|
|
|
In these cases, the ``/tmp/.saltcloud/`` directory and all files in it should
|
|
|
|
be owned by this user.
|
|
|
|
|
2015-08-10 15:20:26 +00:00
|
|
|
Some cloud hosts, such as EC2, are configured to not require these users to
|
2013-11-23 14:35:22 +00:00
|
|
|
provide a password when using the ``sudo`` command. Because it is more secure
|
2015-08-10 15:20:26 +00:00
|
|
|
to require ``sudo`` users to provide a password, other hosts are configured
|
2013-11-23 14:35:22 +00:00
|
|
|
that way.
|
|
|
|
|
|
|
|
If this instance is required to provide a password, it needs to be configured
|
|
|
|
in Salt Cloud. A password for sudo to use may be added to either the provider
|
|
|
|
configuration or the profile configuration:
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
sudo_password: mypassword
|
|
|
|
|
|
|
|
|
|
|
|
``/tmp/`` is Mounted as ``noexec``
|
|
|
|
----------------------------------
|
|
|
|
It is more secure to mount the ``/tmp/`` directory with a ``noexec`` option.
|
2015-08-10 15:20:26 +00:00
|
|
|
This is uncommon on most cloud hosts, but very common in private
|
2013-11-23 14:35:22 +00:00
|
|
|
environments. To see if the ``/tmp/`` directory is mounted this way, run the
|
|
|
|
following command:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
mount | grep tmp
|
|
|
|
|
|
|
|
The if the output of this command includes a line that looks like this, then
|
|
|
|
the ``/tmp/`` directory is mounted as ``noexec``:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
tmpfs on /tmp type tmpfs (rw,noexec)
|
|
|
|
|
|
|
|
If this is the case, then the ``deploy_command`` will need to be changed
|
|
|
|
in order to run the deploy script through the ``sh`` command, rather than trying
|
|
|
|
to execute it directly. This may be specified in either the provider or the
|
|
|
|
profile config:
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
deploy_command: sh /tmp/.saltcloud/deploy.sh
|
|
|
|
|
|
|
|
Please note that by default, Salt Cloud will place its files in a directory
|
|
|
|
called ``/tmp/.saltcloud/``. This may be also be changed in the provider or
|
|
|
|
profile configuration:
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
tmp_dir: /tmp/.saltcloud/
|
|
|
|
|
|
|
|
If this directory is changed, then the ``deploy_command`` need to be changed
|
|
|
|
in order to reflect the ``tmp_dir`` configuration.
|
|
|
|
|
|
|
|
|
|
|
|
Executing the Deploy Script Manually
|
|
|
|
------------------------------------
|
|
|
|
If all of the files needed for deployment were successfully uploaded to the
|
|
|
|
correct locations, and contain the correct permissions and ownerships, the
|
|
|
|
deploy script may be executed manually in order to check for other issues:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
cd /tmp/.saltcloud/
|
|
|
|
./deploy.sh
|