Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/68367.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added capability to specify module arguments in an sls as a dict
2 changes: 1 addition & 1 deletion doc/cheatsheet/salt.tex
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
- running
- enable: True
/var/www/index.html: # ID declaration
file: # state declaration
file: # state module declaration
- managed # function
- source: salt://webserver/index.html
- user: root
Expand Down
68 changes: 34 additions & 34 deletions doc/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ PATH using a :mod:`file.symlink <salt.states.file.symlink>` state.

/usr/bin/foo:
file.symlink:
- target: /usr/local/bin/foo
target: /usr/local/bin/foo

.. _which-version:

Expand Down Expand Up @@ -240,10 +240,10 @@ via a :py:func:`file.managed <salt.states.file.managed>` state, using the

/etc/my_super_secret_file:
file.managed:
- user: secret
- group: secret
- mode: 600
- contents_pillar: secret_files:my_super_secret_file
user: secret
group: secret
mode: 600
contents_pillar: secret_files:my_super_secret_file

In this example, the source file would be located in a directory called
``secret_files`` underneath the file_tree path for the minion. The syntax for
Expand Down Expand Up @@ -284,38 +284,38 @@ service to restart right after the upgrade:

Disable starting services:
file.managed:
- name: /usr/sbin/policy-rc.d
- user: root
- group: root
- mode: 0755
- contents:
name: /usr/sbin/policy-rc.d
user: root
group: root
mode: 0755
contents:
- '#!/bin/sh'
- exit 101
# do not touch if already exists
- replace: False
- prereq:
replace: False
prereq:
- pkg: Upgrade Salt Minion

{%- endif %}

Upgrade Salt Minion:
pkg.installed:
- name: salt-minion
- version: 2016.11.3{% if grains['os_family'] == 'Debian' %}+ds-1{% endif %}
- order: last
name: salt-minion
version: 2016.11.3{% if grains['os_family'] == 'Debian' %}+ds-1{% endif %}
order: last

Enable Salt Minion:
service.enabled:
- name: salt-minion
- require:
name: salt-minion
require:
- pkg: Upgrade Salt Minion

{%- if grains['os_family'] == 'Debian' %}

Enable starting services:
file.absent:
- name: /usr/sbin/policy-rc.d
- onchanges:
name: /usr/sbin/policy-rc.d
onchanges:
- pkg: Upgrade Salt Minion

{%- endif %}
Expand All @@ -331,9 +331,9 @@ The following example works on UNIX-like operating systems:
{%- if grains['os'] != 'Windows' %}
Restart Salt Minion:
cmd.run:
- name: 'salt-call service.restart salt-minion'
- bg: True
- onchanges:
name: 'salt-call service.restart salt-minion'
bg: True
onchanges:
- pkg: Upgrade Salt Minion
{%- endif %}

Expand All @@ -351,12 +351,12 @@ as follows:
Restart Salt Minion:
cmd.run:
{%- if grains['kernel'] == 'Windows' %}
- name: 'C:\salt\salt-call.bat service.restart salt-minion'
name: 'C:\salt\salt-call.bat service.restart salt-minion'
{%- else %}
- name: 'salt-call service.restart salt-minion'
name: 'salt-call service.restart salt-minion'
{%- endif %}
- bg: True
- onchanges:
bg: True
onchanges:
- pkg: Upgrade Salt Minion

However, it requires more advanced tricks to upgrade from legacy version of
Expand All @@ -374,10 +374,10 @@ should run last or watch for the ``pkg`` state changes:
Restart Salt Minion:
cmd.run:
{%- if grains['kernel'] == 'Windows' %}
- name: 'start powershell "Restart-Service -Name salt-minion"'
name: 'start powershell "Restart-Service -Name salt-minion"'
{%- else %}
# fork and disown the process
- name: |-
name: |-
exec 0>&- # close stdin
exec 1>&- # close stdout
exec 2>&- # close stderr
Expand Down Expand Up @@ -408,15 +408,15 @@ needs to run on the master):

Wait for salt minion:
loop.until_no_eval:
- name: saltutil.runner
- expected:
name: saltutil.runner
expected:
- my_minion
- args:
args:
- manage.up
- kwargs:
kwargs:
tgt: my_minion
- period: 3
- init_wait: 3
period: 3
init_wait: 3

This will, after an initial delay of 3 seconds, execute the `manage.up`-runner
targeted specifically for `my_minion`. It will do this every `period` seconds
Expand Down
5 changes: 5 additions & 0 deletions doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ Glossary
set of host machines. Often used to create and deploy private clouds.
*See also*: :py:mod:`virt runner <salt.runners.virt>`.

SLS
Structured Layered State. The SLS is a representation of the state in
which a system should be in, and is set up to contain this data in a
simple format. This is often called configuration management.

SLS Module
Contains a set of :term:`state declarations <State Declaration>`.

Expand Down
10 changes: 5 additions & 5 deletions doc/ref/configuration/minion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2969,12 +2969,12 @@ data in a state file:

apply_showpillar:
module.run:
- name: state.apply
- mods:
name: state.apply
mods:
- showpillar
- kwargs:
pillar:
test: "foo bar"
kwargs:
pillar:
test: "foo bar"

If set to ``True``, the ``showpillar`` state will have access to the
global pillar data.
Expand Down
14 changes: 7 additions & 7 deletions doc/ref/file_server/environments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ the file from the ``config`` environment:

/etc/foo/bar.conf:
file.managed:
- source: salt://foo/bar.conf
- user: foo
- mode: 600
- saltenv: config
source: salt://foo/bar.conf
user: foo
mode: 600
saltenv: config

Another way of doing the same thing is to use the :ref:`querystring syntax
<querystring-syntax>` described above:
Expand All @@ -78,9 +78,9 @@ Another way of doing the same thing is to use the :ref:`querystring syntax

/etc/foo/bar.conf:
file.managed:
- source: salt://foo/bar.conf?saltenv=config
- user: foo
- mode: 600
source: salt://foo/bar.conf?saltenv=config
user: foo
mode: 600

.. note::
Specifying the environment using either of the above methods is only
Expand Down
4 changes: 2 additions & 2 deletions doc/ref/file_server/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ with ``salt://|`` rather than ``salt://``.

/etc/marathon/conf/?checkpoint:
file.managed:
- source: salt://|hw/config/?checkpoint
- makedirs: True
source: salt://|hw/config/?checkpoint
makedirs: True

Environments
````````````
Expand Down
8 changes: 4 additions & 4 deletions doc/ref/renderers/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ to install a package:
"""
return {
"include": ["python"],
"python-foo": {"pkg.installed": [{"version": "1.5-1.el7"}]},
"python-foo": {"pkg.installed": {"version": "1.5-1.el7"}},
}

This would be equivalent to the following:
Expand All @@ -94,7 +94,7 @@ This would be equivalent to the following:

python-foo:
pkg.installed:
- version: '1.5-1.el7'
version: '1.5-1.el7'

.. _renderers-composing:

Expand Down Expand Up @@ -132,10 +132,10 @@ render pipeline:

An_Example:
cmd.run:
- name: |
name: |
echo "Using Salt ${grains['saltversion']}" \
"from path {{grains['saltpath']}}."
- cwd: /
cwd: /

<%doc> ${...} is Mako's notation, and so is this comment. </%doc>
{# Similarly, {{...}} is Jinja's notation, and so is this comment. #}
Expand Down
6 changes: 3 additions & 3 deletions doc/ref/states/aggregate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ manager.

lamp_stack:
pkg.installed:
- pkgs:
pkgs:
- php
- mysql-client
- aggregate: True
aggregate: True

memcached:
pkg.installed:
- name: memcached
name: memcached

Adding mod_aggregate to a State Module
======================================
Expand Down
4 changes: 2 additions & 2 deletions doc/ref/states/backup_mode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Or it can be set for each file:

/etc/ssh/sshd_config:
file.managed:
- source: salt://ssh/sshd_config
- backup: minion
source: salt://ssh/sshd_config
backup: minion


The backup_mode can be set to any of the following options:
Expand Down
56 changes: 23 additions & 33 deletions doc/ref/states/compiler_ordering.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ As an example, a state written thusly:

apache:
pkg.installed:
- name: httpd
name: httpd
service.running:
- name: httpd
- watch:
name: httpd
watch:
- file: apache_conf
- pkg: apache

Expand All @@ -78,34 +78,24 @@ Will have High Data which looks like this represented in json:

{
"apache": {
"pkg": [
{
"name": "httpd"
},
"installed",
{
"order": 10000
}
],
"service": [
{
"name": "httpd"
},
{
"watch": [
{
"file": "apache_conf"
},
{
"pkg": "apache"
}
]
},
"running",
{
"order": 10001
}
],
"pkg": {
"name": "httpd",
"fun": "installed",
"order": 10000
},
"service": {
"name": "httpd",
"watch": [
{
"file": "apache_conf"
},
{
"pkg": "apache"
}
],
"fun": "running",
"order": 10001
},
"__sls__": "blah",
"__env__": "base"
},
Expand Down Expand Up @@ -247,8 +237,8 @@ ordering can be explicitly overridden using the ``order`` flag in states:

apache:
pkg.installed:
- name: httpd
- order: 1
name: httpd
order: 1

This order flag will over ride the definition order, this makes it very
simple to create states that are always executed first, last or in specific
Expand Down
Loading