1
|
yum install salt-master
|
1
|
salt-master -d
|
1
|
yum install salt-minion
|
1
|
salt-minion-d
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
[root@
66
~]# salt -h
Usage: salt [options]
'<target>'
<
function
> [arguments]
Options:
--version show program's version number and exit
--versions-report show program's dependencies version number and exit
-h, --help show
this
help message and exit
-c CONFIG_DIR, --config-dir=CONFIG_DIR
Pass
in
an alternative configuration directory.
Default: /etc/salt
-t TIMEOUT, --timeout=TIMEOUT
Change the timeout,
if
applicable,
for
the running
command;
default
=
5
-s, --
static
Return the data from minions
as
a group after they all
return
.
--async Run the salt command but don't wait
for
a reply
-v, --verbose Turn on command verbosity, display jid and active job
queries
-b BATCH, --batch=BATCH, --batch-size=BATCH
Execute the salt job
in
batch mode, pass either the
number of minions to batch at a time, or the
percentage of minions to have running
-a EAUTH, --auth=EAUTH, --eauth=EAUTH, --extended-auth=EAUTH
Specify an extended authentication system to
use
.
-T, --make-token Generate and save an authentication token
for
re-
use
.
Thetoken
is
generated and made available
for
the
period defined
in
the Salt Master.
--
return
=RETURNER Set an alternative
return
method. By
default
salt will
send the
return
data from the command back to the
master, but the
return
data can be redirected into any
number of systems, databases or applications.
-d, --doc, --documentation
Return the documentation
for
the specified module or
for
all modules
if
none are specified.
Target Options:
Target Selection Options
-E, --pcre Instead of using shell globs to evaluate the target
servers,
use
pcre regular expressions
-L, --list Instead of using shell globs to evaluate the target
servers, take a comma delimited list of servers.
-G, --grain Instead of using shell globs to evaluate the target
use
a grain value to identify targets, the syntax
for
the target
is
the grain key followed by a
globexpression:
"os:Arch*"
--grain-pcre Instead of using shell globs to evaluate the target
use
a grain value to identify targets, the syntax
for
the target
is
the grain key followed by a pcre regular
expression:
"os:Arch.*"
-N, --nodegroup Instead of using shell globs to evaluate the target
use
one of the predefined nodegroups to identify a
list of targets.
-R, --range Instead of using shell globs to evaluate the target
use
a range expression to identify targets. Range
expressions look like %cluster
-C, --compound The compound target option allows
for
multiple target
types to be evaluated, allowing
for
greater
granularity
in
target matching. The compound target
is
space delimited, targets other than globs are preceded
with
an identifier matching the specific targets
argument type: salt 'G@os:RedHat and webser* or
E@database.*'
-X, --exsel Instead of using shell globs
use
the
return
code of a
function
.
-I, --pillar Instead of using shell globs to evaluate the target
use
a pillar value to identify targets, the syntax
for
the target
is
the pillar key followed by a
globexpression:
"role:production*"
-S, --ipcidr Match based on Subnet (CIDR notation) or IPv4 address.
Output Options:
Configure your preferred output format
--raw-out DEPRECATED. Print the output from the
'salt'
command
in
raw python form,
this
is
suitable
for
re-reading
the output into an executing python script
with
eval.
--yaml-out DEPRECATED. Print the output from the
'salt'
command
in
yaml.
--json-out DEPRECATED. Print the output from the
'salt'
command
in
json.
--text-out DEPRECATED. Print the output from the
'salt'
command
in
the same form the shell would.
--out=OUTPUT, --output=OUTPUT
Print the output from the
'salt'
command using the
specified outputter. The builtins are
'no_return'
,
'grains'
,
'yaml'
,
'overstatestage'
,
'json'
,
'pprint'
,
'nested'
,
'raw'
,
'highstate'
,
'quiet'
,
'key'
,
'txt'
,
'virt_query'
.
--out-indent=OUTPUT_INDENT, --output-indent=OUTPUT_INDENT
Print the output indented by the provided value
in
spaces. Negative values disables indentation. Only
applicable
in
outputters that support indentation.
--no-color, --no-colour
Disable all colored output
|
1
2
3
4
5
6
|
vim /etc/salt/master
增加以下内容
client_acl:
66
.xiaorui.com:
- test.ping
- status.uptime
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
base:
'*'
:
- ldap-client
- networking
- salt.minion
'salt-master*'
:
- salt.master
'^(memcache|web).(qa|prod).loc$'
:
- match: pcre
- nagios.client
- apache.server
'os:Ubuntu'
:
- match: grain
- repos.ubuntu
'os:(RedHat|CentOS)'
:
- match: grain_pcre
- repos.epel
'foo,bar,baz'
:
- match: list
- database
'somekey:abc'
:
- match: pillar
- xyz
'nag1* or G@role:monitoring'
:
- match: compound
- nagios.server
|