1
0

troubleshooting.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. ==========================
  2. Troubleshooting Salt Cloud
  3. ==========================
  4. This page describes various steps for troubleshooting problems that may arise
  5. while using Salt Cloud.
  6. Virtual Machines Are Created, But Do Not Respond
  7. ================================================
  8. Are TCP ports 4505 and 4506 open on the master? This is easy to overlook on new
  9. masters. Information on how to open firewall ports on various platforms can be
  10. found :ref:`here <firewall>`.
  11. Generic Troubleshooting Steps
  12. =============================
  13. This section describes a set of instructions that are useful to a large number
  14. of situations, and are likely to solve most issues that arise.
  15. Debug Mode
  16. ----------
  17. Frequently, running Salt Cloud in debug mode will reveal information about a
  18. deployment which would otherwise not be obvious:
  19. .. code-block:: bash
  20. salt-cloud -p myprofile myinstance -l debug
  21. Keep in mind that a number of messages will appear that look at first like
  22. errors, but are in fact intended to give developers factual information to
  23. assist in debugging. A number of messages that appear will be for cloud
  24. providers that you do not have configured; in these cases, the message usually
  25. is intended to confirm that they are not configured.
  26. Salt Bootstrap
  27. --------------
  28. By default, Salt Cloud uses the Salt Bootstrap script to provision instances:
  29. .. _`Salt Bootstrap`: https://github.com/saltstack/salt-bootstrap
  30. This script is packaged with Salt Cloud, but may be updated without updating
  31. the Salt package:
  32. .. code-block:: bash
  33. salt-cloud -u
  34. The Bootstrap Log
  35. -----------------
  36. If the default deploy script was used, there should be a file in the ``/tmp/``
  37. directory called ``bootstrap-salt.log``. This file contains the full output from
  38. the deployment, including any errors that may have occurred.
  39. Keeping Temp Files
  40. ------------------
  41. Salt Cloud uploads minion-specific files to instances once they are available
  42. via SSH, and then executes a deploy script to put them into the correct place
  43. and install Salt. The ``--keep-tmp`` option will instruct Salt Cloud not to
  44. remove those files when finished with them, so that the user may inspect them
  45. for problems:
  46. .. code-block:: bash
  47. salt-cloud -p myprofile myinstance --keep-tmp
  48. By default, Salt Cloud will create a directory on the target instance called
  49. ``/tmp/.saltcloud/``. This directory should be owned by the user that is to
  50. execute the deploy script, and should have permissions of ``0700``.
  51. Most cloud hosts are configured to use ``root`` as the default initial user
  52. for deployment, and as such, this directory and all files in it should be owned
  53. by the ``root`` user.
  54. The ``/tmp/.saltcloud/`` directory should the following files:
  55. - A ``deploy.sh`` script. This script should have permissions of ``0755``.
  56. - A ``.pem`` and ``.pub`` key named after the minion. The ``.pem`` file should
  57. have permissions of ``0600``. Ensure that the ``.pem`` and ``.pub`` files have
  58. been properly copied to the ``/etc/salt/pki/minion/`` directory.
  59. - A file called ``minion``. This file should have been copied to the
  60. ``/etc/salt/`` directory.
  61. - Optionally, a file called ``grains``. This file, if present, should have been
  62. copied to the ``/etc/salt/`` directory.
  63. Unprivileged Primary Users
  64. --------------------------
  65. Some cloud hosts, most notably EC2, are configured with a different primary user.
  66. Some common examples are ``ec2-user``, ``ubuntu``, ``fedora``, and ``bitnami``.
  67. In these cases, the ``/tmp/.saltcloud/`` directory and all files in it should
  68. be owned by this user.
  69. Some cloud hosts, such as EC2, are configured to not require these users to
  70. provide a password when using the ``sudo`` command. Because it is more secure
  71. to require ``sudo`` users to provide a password, other hosts are configured
  72. that way.
  73. If this instance is required to provide a password, it needs to be configured
  74. in Salt Cloud. A password for sudo to use may be added to either the provider
  75. configuration or the profile configuration:
  76. .. code-block:: yaml
  77. sudo_password: mypassword
  78. ``/tmp/`` is Mounted as ``noexec``
  79. ----------------------------------
  80. It is more secure to mount the ``/tmp/`` directory with a ``noexec`` option.
  81. This is uncommon on most cloud hosts, but very common in private
  82. environments. To see if the ``/tmp/`` directory is mounted this way, run the
  83. following command:
  84. .. code-block:: bash
  85. mount | grep tmp
  86. The if the output of this command includes a line that looks like this, then
  87. the ``/tmp/`` directory is mounted as ``noexec``:
  88. .. code-block:: console
  89. tmpfs on /tmp type tmpfs (rw,noexec)
  90. If this is the case, then the ``deploy_command`` will need to be changed
  91. in order to run the deploy script through the ``sh`` command, rather than trying
  92. to execute it directly. This may be specified in either the provider or the
  93. profile config:
  94. .. code-block:: yaml
  95. deploy_command: sh /tmp/.saltcloud/deploy.sh
  96. Please note that by default, Salt Cloud will place its files in a directory
  97. called ``/tmp/.saltcloud/``. This may be also be changed in the provider or
  98. profile configuration:
  99. .. code-block:: yaml
  100. tmp_dir: /tmp/.saltcloud/
  101. If this directory is changed, then the ``deploy_command`` need to be changed
  102. in order to reflect the ``tmp_dir`` configuration.
  103. Executing the Deploy Script Manually
  104. ------------------------------------
  105. If all of the files needed for deployment were successfully uploaded to the
  106. correct locations, and contain the correct permissions and ownerships, the
  107. deploy script may be executed manually in order to check for other issues:
  108. .. code-block:: bash
  109. cd /tmp/.saltcloud/
  110. ./deploy.sh