2013-09-05 14:10:47 +00:00
|
|
|
Frequently Asked Questions
|
|
|
|
==========================
|
|
|
|
|
2013-09-20 01:44:55 +00:00
|
|
|
.. contents:: FAQ
|
|
|
|
|
2013-09-05 18:40:10 +00:00
|
|
|
Is Salt open-core?
|
|
|
|
------------------
|
2013-09-05 14:10:47 +00:00
|
|
|
|
2013-09-05 18:40:10 +00:00
|
|
|
No. Salt is 100% committed to being open-source, including all of our APIs and
|
2014-09-26 04:49:07 +00:00
|
|
|
the `'Halite' web interface`_ which was introduced in version 0.17.0. It is
|
|
|
|
developed under the `Apache 2.0 license`_, allowing it to be used in both open
|
|
|
|
and proprietary projects.
|
2013-09-05 14:10:47 +00:00
|
|
|
|
2013-09-05 18:40:10 +00:00
|
|
|
.. _`'Halite' web interface`: https://github.com/saltstack/halite
|
|
|
|
.. _`Apache 2.0 license`: http://www.apache.org/licenses/LICENSE-2.0.html
|
2013-09-05 14:10:47 +00:00
|
|
|
|
2013-09-05 18:40:10 +00:00
|
|
|
What ports should I open on my firewall?
|
|
|
|
----------------------------------------
|
2013-09-05 14:10:47 +00:00
|
|
|
|
2013-09-16 18:05:35 +00:00
|
|
|
Minions need to be able to connect to the Master on TCP ports 4505 and 4506.
|
2013-09-05 18:40:10 +00:00
|
|
|
Minions do not need any inbound ports open. More detailed information on
|
|
|
|
firewall settings can be found :doc:`here </topics/tutorials/firewall>`.
|
2013-09-05 14:10:47 +00:00
|
|
|
|
2013-11-15 22:13:05 +00:00
|
|
|
I'm seeing weird behavior (including but not limited to packages not installing their users properly)
|
|
|
|
-----------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
This is often caused by SELinux. Try disabling SELinux or putting it in
|
|
|
|
permissive mode and see if the weird behavior goes away.
|
|
|
|
|
2013-09-20 01:44:55 +00:00
|
|
|
My script runs every time I run a *state.highstate*. Why?
|
|
|
|
---------------------------------------------------------
|
2013-09-05 14:10:47 +00:00
|
|
|
|
2013-09-09 17:14:21 +00:00
|
|
|
You are probably using :mod:`cmd.run <salt.states.cmd.run>` rather than
|
|
|
|
:mod:`cmd.wait <salt.states.cmd.wait>`. A :mod:`cmd.wait
|
|
|
|
<salt.states.cmd.wait>` state will only run when there has been a change in a
|
|
|
|
state that it is watching.
|
2013-09-05 14:10:47 +00:00
|
|
|
|
2013-09-09 17:14:21 +00:00
|
|
|
A :mod:`cmd.run <salt.states.cmd.run>` state will run the corresponding command
|
|
|
|
*every time* (unless it is prevented from running by the ``unless`` or ``onlyif``
|
|
|
|
arguments).
|
2013-09-05 14:10:47 +00:00
|
|
|
|
2014-07-13 18:43:33 +00:00
|
|
|
More details can be found in the documentation for the :mod:`cmd
|
2013-09-09 17:14:21 +00:00
|
|
|
<salt.states.cmd>` states.
|
2013-09-05 14:10:47 +00:00
|
|
|
|
2013-09-20 19:39:53 +00:00
|
|
|
When I run *test.ping*, why don't the Minions that aren't responding return anything? Returning ``False`` would be helpful.
|
|
|
|
---------------------------------------------------------------------------------------------------------------------------
|
2013-09-16 18:05:35 +00:00
|
|
|
|
2013-09-23 02:32:14 +00:00
|
|
|
When you run *test.ping* the Master tells Minions to run commands/functions,
|
|
|
|
and listens for the return data, printing it to the screen when it is received.
|
|
|
|
If it doesn't receive anything back, it doesn't have anything to display for
|
|
|
|
that Minion.
|
2013-09-16 18:05:35 +00:00
|
|
|
|
|
|
|
There are a couple options for getting information on Minions that are not
|
|
|
|
responding. One is to use the verbose (``-v``) option when you run salt
|
|
|
|
commands, as it will display "Minion did not return" for any Minions which time
|
|
|
|
out.
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
salt -v '*' pkg.install zsh
|
|
|
|
|
|
|
|
Another option is to use the :mod:`manage.down <salt.runners.manage.down>`
|
|
|
|
runner:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
salt-run manage.down
|
|
|
|
|
2014-01-26 02:56:01 +00:00
|
|
|
Also, if the Master is under heavy load, it is possible that the CLI will exit
|
|
|
|
without displaying return data for all targeted Minions. However, this doesn't
|
|
|
|
mean that the Minions did not return; this only means that the Salt CLI timed
|
|
|
|
out waiting for a response. Minions will still send their return data back to
|
|
|
|
the Master once the job completes. If any expected Minions are missing from the
|
|
|
|
CLI output, the :mod:`jobs.list_jobs <salt.runners.jobs.list_jobs>` runner can
|
|
|
|
be used to show the job IDs of the jobs that have been run, and the
|
|
|
|
:mod:`jobs.lookup_jid <salt.runners.jobs.lookup_jid>` runner can be used to get
|
|
|
|
the return data for that job.
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
salt-run jobs.list_jobs
|
|
|
|
salt-run jobs.lookup_jid 20130916125524463507
|
|
|
|
|
|
|
|
If you find that you are often missing Minion return data on the CLI, only to
|
|
|
|
find it with the jobs runners, then this may be a sign that the
|
|
|
|
:conf_master:`worker_threads` value may need to be increased in the master
|
|
|
|
config file. Additionally, running your Salt CLI commands with the ``-t``
|
|
|
|
option will make Salt wait longer for the return data before the CLI command
|
|
|
|
exits. For instance, the below command will wait up to 60 seconds for the
|
|
|
|
Minions to return:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
salt -t 60 '*' test.ping
|
|
|
|
|
|
|
|
|
2013-09-09 14:15:49 +00:00
|
|
|
How does Salt determine the Minion's id?
|
|
|
|
----------------------------------------
|
|
|
|
|
2013-09-16 18:05:35 +00:00
|
|
|
If the Minion id is not configured explicitly (using the :conf_minion:`id`
|
2013-09-09 16:10:58 +00:00
|
|
|
parameter), Salt will determine the id based on the hostname. Exactly how this
|
|
|
|
is determined varies a little between operating systems and is described in
|
|
|
|
detail :ref:`here <minion-id-generation>`.
|
2013-09-09 14:15:49 +00:00
|
|
|
|
2013-09-23 02:32:14 +00:00
|
|
|
I'm trying to manage packages/services but I get an error saying that the state is not available. Why?
|
|
|
|
------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Salt detects the Minion's operating system and assigns the correct package or
|
2013-09-23 18:59:37 +00:00
|
|
|
service management module based on what is detected. However, for certain custom
|
2013-09-23 14:55:56 +00:00
|
|
|
spins and OS derivatives this detection fails. In cases like this, an issue
|
|
|
|
should be opened on our tracker_, with the following information:
|
2013-09-23 02:32:14 +00:00
|
|
|
|
|
|
|
1. The output of the following command:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
salt <minion_id> grains.items | grep os
|
|
|
|
|
|
|
|
2. The contents of ``/etc/lsb-release``, if present on the Minion.
|
|
|
|
|
|
|
|
.. _tracker: https://github.com/saltstack/salt/issues
|
|
|
|
|
2013-09-09 20:57:38 +00:00
|
|
|
I'm using gitfs and my custom modules/states/etc are not syncing. Why?
|
|
|
|
----------------------------------------------------------------------
|
2013-09-09 14:15:49 +00:00
|
|
|
|
|
|
|
In versions of Salt 0.16.3 or older, there is a bug in :doc:`gitfs
|
2013-09-09 20:57:38 +00:00
|
|
|
</topics/tutorials/gitfs>` which can affect the syncing of custom types.
|
|
|
|
Upgrading to 0.16.4 or newer will fix this.
|
2013-09-09 14:15:49 +00:00
|
|
|
|
2013-09-16 18:05:35 +00:00
|
|
|
Why aren't my custom modules/states/etc. available on my Minions?
|
2013-09-09 14:15:49 +00:00
|
|
|
-----------------------------------------------------------------
|
2013-09-05 14:10:47 +00:00
|
|
|
|
2013-09-16 18:05:35 +00:00
|
|
|
Custom modules are only synced to Minions when :mod:`state.highstate
|
2013-09-09 20:57:38 +00:00
|
|
|
<salt.modules.state.highstate>`, :mod:`saltutil.sync_modules
|
|
|
|
<salt.modules.saltutil.sync_modules>`, or :mod:`saltutil.sync_all
|
|
|
|
<salt.modules.saltutil.sync_all>` is run. Similarly, custom states are only
|
2013-09-16 18:05:35 +00:00
|
|
|
synced to Minions when :mod:`state.highstate <salt.modules.state.highstate>`,
|
2013-09-09 20:57:38 +00:00
|
|
|
:mod:`saltutil.sync_states <salt.modules.saltutil.sync_states>`, or
|
|
|
|
:mod:`saltutil.sync_all <salt.modules.saltutil.sync_all>` is run.
|
|
|
|
|
|
|
|
Other custom types (renderers, outputters, etc.) have similar behavior, see the
|
|
|
|
documentation for the :mod:`saltutil <salt.modules.saltutil>` module for more
|
|
|
|
information.
|
2013-09-10 20:59:10 +00:00
|
|
|
|
|
|
|
Module ``X`` isn't available, even though the shell command it uses is installed. Why?
|
|
|
|
--------------------------------------------------------------------------------------
|
|
|
|
This is most likely a PATH issue. Did you custom-compile the software which the
|
|
|
|
module requires? RHEL/CentOS/etc. in particular override the root user's path
|
|
|
|
in ``/etc/init.d/functions``, setting it to ``/sbin:/usr/sbin:/bin:/usr/bin``,
|
|
|
|
making software installed into ``/usr/local/bin`` unavailable to Salt when the
|
2014-02-15 01:01:57 +00:00
|
|
|
Minion is started using the initscript. In version 2014.1.0, Salt will have a
|
2013-09-10 20:59:10 +00:00
|
|
|
better solution for these sort of PATH-related issues, but recompiling the
|
|
|
|
software to install it into a location within the PATH should resolve the
|
|
|
|
issue in the meantime. Alternatively, you can create a symbolic link within the
|
|
|
|
PATH using a :mod:`file.symlink <salt.states.file.symlink>` state.
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
/usr/bin/foo:
|
|
|
|
file.symlink:
|
|
|
|
- target: /usr/local/bin/foo
|
2013-11-14 04:49:54 +00:00
|
|
|
|
|
|
|
Can I run different versions of Salt on my Master and Minion?
|
|
|
|
-------------------------------------------------------------
|
|
|
|
|
2014-03-05 17:35:29 +00:00
|
|
|
This depends on the versions. In general, it is recommended that Master and
|
|
|
|
Minion versions match.
|
|
|
|
|
|
|
|
When upgrading Salt, the master(s) should always be upgraded first. Backwards
|
|
|
|
compatibility for minions running newer versions of salt than their masters is
|
|
|
|
not guaranteed.
|
|
|
|
|
|
|
|
Whenever possible, backwards compatibility between new masters
|
|
|
|
and old minions will be preserved. Generally, the only exception to this
|
|
|
|
policy is in case of a security vulnerability.
|
|
|
|
|
|
|
|
Recent examples of backwards compatibility breakage include the 0.17.1 release
|
|
|
|
(where all backwards compatibility was broken due to a security fix), and the
|
|
|
|
2014.1.0 release (which retained compatibility between 2014.1.0 masters and
|
|
|
|
0.17 minions, but broke compatibility for 2014.1.0 minions and older masters).
|
2013-12-08 05:52:45 +00:00
|
|
|
|
|
|
|
Does Salt support backing up managed files?
|
|
|
|
-------------------------------------------
|
|
|
|
|
|
|
|
Yes. Salt provides an easy to use addition to your file.managed states that
|
|
|
|
allow you to back up files via :doc:`backup_mode </ref/states/backup_mode>`,
|
|
|
|
backup_mode can be configured on a per state basis, or in the minion config
|
|
|
|
(note that if set in the minion config this would simply be the default
|
|
|
|
method to use, you still need to specify that the file should be backed up!).
|
2014-04-30 19:55:58 +00:00
|
|
|
|
|
|
|
What is the best way to restart a Salt daemon using Salt?
|
|
|
|
---------------------------------------------------------
|
|
|
|
|
2014-08-29 17:17:06 +00:00
|
|
|
Updating the salt-minion package requires a restart of the salt-minion service.
|
|
|
|
But restarting the service while in the middle of a state run interrupts the
|
|
|
|
process of the minion running states and sending results back to the master.
|
|
|
|
It's a tricky problem to solve, and we're working on it, but in the meantime
|
|
|
|
one way of handling this (on Linux and UNIX-based operating systems) is to use
|
|
|
|
**at** (a job scheduler which predates cron) to schedule a restart of the
|
|
|
|
service. **at** is not installed by default on most distros, and requires a
|
|
|
|
service to be running (usually called **atd**) in order to schedule jobs.
|
|
|
|
Here's an example of how to upgrade the salt-minion package at the end of a
|
|
|
|
Salt run, and schedule a service restart for one minute after the package
|
|
|
|
update completes.
|
2014-04-30 19:55:58 +00:00
|
|
|
|
2014-10-08 21:50:47 +00:00
|
|
|
Linux/Unix
|
|
|
|
**********
|
2014-04-30 19:55:58 +00:00
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
2014-08-29 17:17:06 +00:00
|
|
|
salt-minion:
|
2014-12-16 21:45:25 +00:00
|
|
|
pkg.installed:
|
|
|
|
- name: salt-minion
|
2014-08-29 17:17:06 +00:00
|
|
|
- version: 2014.1.7-3.el6
|
|
|
|
- order: last
|
2014-12-16 21:45:25 +00:00
|
|
|
service.running:
|
|
|
|
- name: salt-minion
|
2014-08-29 17:17:06 +00:00
|
|
|
- require:
|
|
|
|
- pkg: salt-minion
|
2014-12-16 21:45:25 +00:00
|
|
|
cmd.wait:
|
2014-04-30 19:55:58 +00:00
|
|
|
- name: echo service salt-minion restart | at now + 1 minute
|
2014-08-29 17:17:06 +00:00
|
|
|
- watch:
|
|
|
|
- pkg: salt-minion
|
2014-04-30 19:55:58 +00:00
|
|
|
|
2014-10-08 21:50:47 +00:00
|
|
|
To ensure that **at** is installed and **atd** is running, the following states
|
|
|
|
can be used (be sure to double-check the package name and service name for the
|
|
|
|
distro the minion is running, in case they differ from the example below.
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
at:
|
2014-12-13 06:29:48 +00:00
|
|
|
pkg.installed:
|
|
|
|
- name: at
|
|
|
|
service.running:
|
2014-10-08 21:50:47 +00:00
|
|
|
- name: atd
|
|
|
|
- enable: True
|
|
|
|
|
2014-11-14 17:40:18 +00:00
|
|
|
An alternatvie to using the :program:`atd` daemon is to fork and disown the
|
|
|
|
process.
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
restart_minion:
|
|
|
|
cmd.run:
|
|
|
|
- name: |
|
|
|
|
nohup /bin/sh -c 'sleep 10 && salt-call --local service.restart salt-minion'
|
|
|
|
- python_shell: True
|
|
|
|
- order: last
|
|
|
|
|
2014-10-08 21:50:47 +00:00
|
|
|
Windows
|
|
|
|
*******
|
2014-04-30 19:55:58 +00:00
|
|
|
|
2014-11-04 03:24:44 +00:00
|
|
|
For Windows machines, restarting the minion at can be accomplished by
|
|
|
|
adding the following state:
|
|
|
|
|
2014-04-30 19:55:58 +00:00
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
schedule-start:
|
2014-12-13 06:29:48 +00:00
|
|
|
cmd.run:
|
2014-12-01 21:51:58 +00:00
|
|
|
- name: 'start powershell "Restart-Service -Name salt-minion"'
|
2014-04-30 19:55:58 +00:00
|
|
|
- order: last
|
2014-05-23 19:50:08 +00:00
|
|
|
|
2014-12-01 21:51:58 +00:00
|
|
|
or running immediately from the command line:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
salt -G kernel:Windows cmd.run 'start powershell "Restart-Service -Name salt-minion"'
|
2014-12-11 03:37:16 +00:00
|
|
|
|
2014-05-23 19:50:08 +00:00
|
|
|
Salting the Salt Master
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
In order to configure a master server via states, the Salt master can also be
|
|
|
|
"salted" in order to enforce state on the Salt master as well as the Salt
|
|
|
|
minions. Salting the Salt master requires a Salt minion to be installed on
|
|
|
|
the same machine as the Salt master. Once the Salt minion is installed, the
|
|
|
|
minion configuration file must be pointed to the local Salt master:
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
master: 127.0.0.1
|
|
|
|
|
|
|
|
Once the Salt master has been "salted" with a Salt minion, it can be targeted
|
|
|
|
just like any other minion. If the minion on the salted master is running, the
|
|
|
|
minion can be targeted via any usual ``salt`` command. Additionally, the
|
|
|
|
``salt-call`` command can execute operations to enforce state on the salted
|
|
|
|
master without requiring the minion to be running.
|
|
|
|
|
|
|
|
More information about salting the Salt master can be found in the salt-formula
|
|
|
|
for salt itself:
|
|
|
|
|
|
|
|
https://github.com/saltstack-formulas/salt-formula
|