summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-support/salt/files
diff options
context:
space:
mode:
authorAlejandro del Castillo <alejandro.delcastillo@ni.com>2015-05-08 10:28:40 -0500
committerBruce Ashfield <bruce.ashfield@windriver.com>2015-05-13 10:02:11 -0400
commit37644a8fe105425099c7c8c57b161720766105d5 (patch)
tree81c00baf1dd2dc91c142d7283ccfc70235d4d766 /meta-openstack/recipes-support/salt/files
parentdd04ca6db2993404284679ea04a80d9071f90c2b (diff)
downloadmeta-cloud-services-37644a8fe105425099c7c8c57b161720766105d5.tar.gz
salt: add recipe for salt
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-support/salt/files')
-rw-r--r--meta-openstack/recipes-support/salt/files/cloud94
-rw-r--r--meta-openstack/recipes-support/salt/files/master525
-rw-r--r--meta-openstack/recipes-support/salt/files/minion494
-rw-r--r--meta-openstack/recipes-support/salt/files/roster8
-rwxr-xr-xmeta-openstack/recipes-support/salt/files/salt-api110
-rw-r--r--meta-openstack/recipes-support/salt/files/salt-common.bash_completion332
-rw-r--r--meta-openstack/recipes-support/salt/files/salt-common.logrotate10
-rwxr-xr-xmeta-openstack/recipes-support/salt/files/salt-master111
-rwxr-xr-xmeta-openstack/recipes-support/salt/files/salt-minion111
-rwxr-xr-xmeta-openstack/recipes-support/salt/files/salt-syndic111
10 files changed, 1906 insertions, 0 deletions
diff --git a/meta-openstack/recipes-support/salt/files/cloud b/meta-openstack/recipes-support/salt/files/cloud
new file mode 100644
index 0000000..2ea54f1
--- /dev/null
+++ b/meta-openstack/recipes-support/salt/files/cloud
@@ -0,0 +1,94 @@
1# This file should normally be installed at: /etc/salt/cloud
2
3
4##########################################
5##### VM Defaults #####
6##########################################
7
8# Set the size of minion keys to generate, defaults to 2048
9#
10#keysize: 2048
11
12
13# Set the default os being deployed. This sets which deployment script to
14# apply. This argument is optional.
15#
16#script: bootstrap-salt
17
18
19##########################################
20##### Logging Settings #####
21##########################################
22
23# The location of the master log file
24#
25#log_file: /var/log/salt/cloud
26
27
28# The level of messages to send to the console.
29# One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'.
30#
31# Default: 'info'
32#
33#log_level: info
34
35
36# The level of messages to send to the log file.
37# One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'.
38#
39# Default: 'info'
40#
41#log_level_logfile: info
42
43
44# The date and time format used in log messages. Allowed date/time formating
45# can be seen here:
46#
47# http://docs.python.org/library/time.html#time.strftime
48#
49#log_datefmt: '%Y-%m-%d %H:%M:%S'
50
51
52# The format of the console logging messages. Allowed formatting options can
53# be seen here:
54#
55# http://docs.python.org/library/logging.html#logrecord-attributes
56#
57# Console log colors are specified by these additional formatters:
58#
59# %(colorlevel)s
60# %(colorname)s
61# %(colorprocess)s
62# %(colormsg)s
63#
64# Since it is desirable to include the surrounding brackets, '[' and ']', in
65# the coloring of the messages, these color formatters also include padding as
66# well. Color LogRecord attributes are only available for console logging.
67#
68#log_fmt_console: '[%(levelname)-8s] %(message)s'
69#log_fmt_logfile: '%(asctime)s,%(msecs)03.0f [%(name)-17s][%(levelname)-8s] %(message)s'
70
71
72# Logger levels can be used to tweak specific loggers logging levels.
73# For example, if you want to have the salt library at the 'warning' level,
74# but you still wish to have 'salt.modules' at the 'debug' level:
75#
76# log_granular_levels:
77# 'salt': 'warning',
78# 'salt.modules': 'debug'
79# 'saltcloud': 'info'
80#
81#log_granular_levels: {}
82
83
84##########################################
85##### Misc Defaults #####
86##########################################
87
88# Whether or not to remove the accompanying SSH key from the known_hosts file
89# when an instance is destroyed.
90#
91# Default: 'False'
92#
93#delete_sshkeys: False
94
diff --git a/meta-openstack/recipes-support/salt/files/master b/meta-openstack/recipes-support/salt/files/master
new file mode 100644
index 0000000..8129a4f
--- /dev/null
+++ b/meta-openstack/recipes-support/salt/files/master
@@ -0,0 +1,525 @@
1##### Primary configuration settings #####
2##########################################
3# This configuration file is used to manage the behavior of the Salt Master
4# Values that are commented out but have no space after the comment are
5# defaults that need not be set in the config. If there is a space after the
6# comment that the value is presented as an example and is not the default.
7
8# Per default, the master will automatically include all config files
9# from master.d/*.conf (master.d is a directory in the same directory
10# as the main master config file)
11#default_include: master.d/*.conf
12
13# The address of the interface to bind to
14#interface: 0.0.0.0
15
16# Whether the master should listen for IPv6 connections. If this is set to True,
17# the interface option must be adjusted too (for example: "interface: '::'")
18#ipv6: False
19
20# The tcp port used by the publisher
21#publish_port: 4505
22
23# The user to run the salt-master as. Salt will update all permissions to
24# allow the specified user to run the master. If the modified files cause
25# conflicts set verify_env to False.
26#user: root
27
28# Max open files
29# Each minion connecting to the master uses AT LEAST one file descriptor, the
30# master subscription connection. If enough minions connect you might start
31# seeing on the console(and then salt-master crashes):
32# Too many open files (tcp_listener.cpp:335)
33# Aborted (core dumped)
34#
35# By default this value will be the one of `ulimit -Hn`, ie, the hard limit for
36# max open files.
37#
38# If you wish to set a different value than the default one, uncomment and
39# configure this setting. Remember that this value CANNOT be higher than the
40# hard limit. Raising the hard limit depends on your OS and/or distribution,
41# a good way to find the limit is to search the internet for(for example):
42# raise max open files hard limit debian
43#
44#max_open_files: 100000
45
46# The number of worker threads to start, these threads are used to manage
47# return calls made from minions to the master, if the master seems to be
48# running slowly, increase the number of threads
49#worker_threads: 5
50
51# The port used by the communication interface. The ret (return) port is the
52# interface used for the file server, authentication, job returnes, etc.
53#ret_port: 4506
54
55# Specify the location of the daemon process ID file
56#pidfile: /var/run/salt-master.pid
57
58# The root directory prepended to these options: pki_dir, cachedir,
59# sock_dir, log_file, autosign_file, extension_modules, key_logfile, pidfile.
60#root_dir: /
61
62# Directory used to store public key data
63#pki_dir: /etc/salt/pki/master
64
65# Directory to store job and cache data
66#cachedir: /var/cache/salt/master
67
68# Verify and set permissions on configuration directories at startup
69#verify_env: True
70
71# Set the number of hours to keep old job information in the job cache
72#keep_jobs: 24
73
74# Set the default timeout for the salt command and api, the default is 5
75# seconds
76#timeout: 5
77
78# The loop_interval option controls the seconds for the master's maintinance
79# process check cycle. This process updates file server backends, cleans the
80# job cache and executes the scheduler.
81#loop_interval: 60
82
83# Set the default outputter used by the salt command. The default is "nested"
84#output: nested
85
86# By default output is colored, to disable colored output set the color value
87# to False
88#color: True
89
90# Set the directory used to hold unix sockets
91#sock_dir: /var/run/salt/master
92
93# The master can take a while to start up when lspci and/or dmidecode is used
94# to populate the grains for the master. Enable if you want to see GPU hardware
95# data for your master.
96#
97# enable_gpu_grains: False
98
99# The master maintains a job cache, while this is a great addition it can be
100# a burden on the master for larger deployments (over 5000 minions).
101# Disabling the job cache will make previously executed jobs unavailable to
102# the jobs system and is not generally recommended.
103#
104#job_cache: True
105
106# Cache minion grains and pillar data in the cachedir.
107#minion_data_cache: True
108
109# The master can include configuration from other files. To enable this,
110# pass a list of paths to this option. The paths can be either relative or
111# absolute; if relative, they are considered to be relative to the directory
112# the main master configuration file lives in (this file). Paths can make use
113# of shell-style globbing. If no files are matched by a path passed to this
114# option then the master will log a warning message.
115#
116#
117# Include a config file from some other path:
118#include: /etc/salt/extra_config
119#
120# Include config from several files and directories:
121#include:
122# - /etc/salt/extra_config
123
124
125##### Security settings #####
126##########################################
127# Enable "open mode", this mode still maintains encryption, but turns off
128# authentication, this is only intended for highly secure environments or for
129# the situation where your keys end up in a bad state. If you run in open mode
130# you do so at your own risk!
131#open_mode: False
132
133# Enable auto_accept, this setting will automatically accept all incoming
134# public keys from the minions. Note that this is insecure.
135#auto_accept: False
136
137# If the autosign_file is specified only incoming keys specified in
138# the autosign_file will be automatically accepted. This is insecure.
139# Regular expressions as well as globing lines are supported.
140#autosign_file: /etc/salt/autosign.conf
141
142# Enable permissive access to the salt keys. This allows you to run the
143# master or minion as root, but have a non-root group be given access to
144# your pki_dir. To make the access explicit, root must belong to the group
145# you've given access to. This is potentially quite insecure.
146# If an autosign_file is specified, enabling permissive_pki_access will allow group access
147# to that specific file.
148#permissive_pki_access: False
149
150# Allow users on the master access to execute specific commands on minions.
151# This setting should be treated with care since it opens up execution
152# capabilities to non root users. By default this capability is completely
153# disabled.
154#
155#client_acl:
156# larry:
157# - test.ping
158# - network.*
159#
160
161# Blacklist any of the following users or modules
162#
163# This example would blacklist all non sudo users, including root from
164# running any commands. It would also blacklist any use of the "cmd"
165# module.
166# This is completely disabled by default.
167#
168#client_acl_blacklist:
169# users:
170# - root
171# - '^(?!sudo_).*$' # all non sudo users
172# modules:
173# - cmd
174
175# The external auth system uses the Salt auth modules to authenticate and
176# validate users to access areas of the Salt system.
177#
178#external_auth:
179# pam:
180# fred:
181# - test.*
182#
183
184# Time (in seconds) for a newly generated token to live. Default: 12 hours
185#token_expire: 43200
186
187# Allow minions to push files to the master. This is disabled by default, for
188# security purposes.
189#file_recv: False
190
191# Signature verification on messages published from the master.
192# This causes the master to cryptographically sign all messages published to its event
193# bus, and minions then verify that signature before acting on the message.
194#
195# This is False by default.
196#
197# Note that to facilitate interoperability with masters and minions that are different
198# versions, if sign_pub_messages is True but a message is received by a minion with
199# no signature, it will still be accepted, and a warning message will be logged.
200# Conversely, if sign_pub_messages is False, but a minion receives a signed
201# message it will be accepted, the signature will not be checked, and a warning message
202# will be logged. This behavior will go away in Salt 0.17.6 (or Hydrogen RC1, whichever
203# comes first) and these two situations will cause minion to throw an exception and
204# drop the message.
205#
206# sign_pub_messages: False
207
208##### Master Module Management #####
209##########################################
210# Manage how master side modules are loaded
211
212# Add any additional locations to look for master runners
213#runner_dirs: []
214
215# Enable Cython for master side modules
216#cython_enable: False
217
218
219##### State System settings #####
220##########################################
221# The state system uses a "top" file to tell the minions what environment to
222# use and what modules to use. The state_top file is defined relative to the
223# root of the base environment as defined in "File Server settings" below.
224#state_top: top.sls
225
226# The master_tops option replaces the external_nodes option by creating
227# a plugable system for the generation of external top data. The external_nodes
228# option is deprecated by the master_tops option.
229# To gain the capabilities of the classic external_nodes system, use the
230# following configuration:
231# master_tops:
232# ext_nodes: <Shell command which returns yaml>
233#
234#master_tops: {}
235
236# The external_nodes option allows Salt to gather data that would normally be
237# placed in a top file. The external_nodes option is the executable that will
238# return the ENC data. Remember that Salt will look for external nodes AND top
239# files and combine the results if both are enabled!
240#external_nodes: None
241
242# The renderer to use on the minions to render the state data
243#renderer: yaml_jinja
244
245# The failhard option tells the minions to stop immediately after the first
246# failure detected in the state execution, defaults to False
247#failhard: False
248
249# The state_verbose and state_output settings can be used to change the way
250# state system data is printed to the display. By default all data is printed.
251# The state_verbose setting can be set to True or False, when set to False
252# all data that has a result of True and no changes will be suppressed.
253#state_verbose: True
254
255# The state_output setting changes if the output is the full multi line
256# output for each changed state if set to 'full', but if set to 'terse'
257# the output will be shortened to a single line. If set to 'mixed', the output
258# will be terse unless a state failed, in which case that output will be full.
259#state_output: full
260
261
262##### File Server settings #####
263##########################################
264# Salt runs a lightweight file server written in zeromq to deliver files to
265# minions. This file server is built into the master daemon and does not
266# require a dedicated port.
267
268# The file server works on environments passed to the master, each environment
269# can have multiple root directories, the subdirectories in the multiple file
270# roots cannot match, otherwise the downloaded files will not be able to be
271# reliably ensured. A base environment is required to house the top file.
272# Example:
273# file_roots:
274# base:
275# - /srv/salt/
276# dev:
277# - /srv/salt/dev/services
278# - /srv/salt/dev/states
279# prod:
280# - /srv/salt/prod/services
281# - /srv/salt/prod/states
282
283#file_roots:
284# base:
285# - /srv/salt
286
287# The hash_type is the hash to use when discovering the hash of a file on
288# the master server. The default is md5, but sha1, sha224, sha256, sha384
289# and sha512 are also supported.
290#hash_type: md5
291
292# The buffer size in the file server can be adjusted here:
293#file_buffer_size: 1048576
294
295# A regular expression (or a list of expressions) that will be matched
296# against the file path before syncing the modules and states to the minions.
297# This includes files affected by the file.recurse state.
298# For example, if you manage your custom modules and states in subversion
299# and don't want all the '.svn' folders and content synced to your minions,
300# you could set this to '/\.svn($|/)'. By default nothing is ignored.
301#
302#file_ignore_regex:
303# - '/\.svn($|/)'
304# - '/\.git($|/)'
305
306# A file glob (or list of file globs) that will be matched against the file
307# path before syncing the modules and states to the minions. This is similar
308# to file_ignore_regex above, but works on globs instead of regex. By default
309# nothing is ignored.
310#
311# file_ignore_glob:
312# - '*.pyc'
313# - '*/somefolder/*.bak'
314# - '*.swp'
315
316# File Server Backend
317# Salt supports a modular fileserver backend system, this system allows
318# the salt master to link directly to third party systems to gather and
319# manage the files available to minions. Multiple backends can be
320# configured and will be searched for the requested file in the order in which
321# they are defined here. The default setting only enables the standard backend
322# "roots" which uses the "file_roots" option.
323#
324#fileserver_backend:
325# - roots
326#
327# To use multiple backends list them in the order they are searched:
328#
329#fileserver_backend:
330# - git
331# - roots
332#
333# By default, the Salt fileserver recurses fully into all defined environments
334# to attempt to find files. To limit this behavior so that the fileserver only
335# traverses directories with SLS files and special Salt directories like _modules,
336# enable the option below. This might be useful for installations where a file root
337# has a very large number of files and performance is impacted. Default is False.
338#
339# fileserver_limit_traversal: False
340#
341# Git fileserver backend configuration
342# When using the git fileserver backend at least one git remote needs to be
343# defined. The user running the salt master will need read access to the repo.
344#
345#gitfs_remotes:
346# - git://github.com/saltstack/salt-states.git
347# - file:///var/git/saltmaster
348#
349# The repos will be searched in order to find the file requested by a client
350# and the first repo to have the file will return it.
351# When using the git backend branches and tags are translated into salt
352# environments.
353# Note: file:// repos will be treated as a remote, so refs you want used must
354# exist in that repo as *local* refs.
355#
356# The gitfs_root option gives the ability to serve files from a subdirectory
357# within the repository. The path is defined relative to the root of the
358# repository and defaults to the repository root.
359#gitfs_root: somefolder/otherfolder
360
361
362##### Pillar settings #####
363##########################################
364# Salt Pillars allow for the building of global data that can be made selectively
365# available to different minions based on minion grain filtering. The Salt
366# Pillar is laid out in the same fashion as the file server, with environments,
367# a top file and sls files. However, pillar data does not need to be in the
368# highstate format, and is generally just key/value pairs.
369
370#pillar_roots:
371# base:
372# - /srv/pillar
373
374#ext_pillar:
375# - hiera: /etc/hiera.yaml
376# - cmd_yaml: cat /etc/salt/yaml
377
378# The pillar_opts option adds the master configuration file data to a dict in
379# the pillar called "master". This is used to set simple configurations in the
380# master config file that can then be used on minions.
381#pillar_opts: True
382
383
384##### Syndic settings #####
385##########################################
386# The Salt syndic is used to pass commands through a master from a higher
387# master. Using the syndic is simple, if this is a master that will have
388# syndic servers(s) below it set the "order_masters" setting to True, if this
389# is a master that will be running a syndic daemon for passthrough the
390# "syndic_master" setting needs to be set to the location of the master server
391# to receive commands from.
392
393# Set the order_masters setting to True if this master will command lower
394# masters' syndic interfaces.
395#order_masters: False
396
397# If this master will be running a salt syndic daemon, syndic_master tells
398# this master where to receive commands from.
399#syndic_master: masterofmaster
400
401# This is the 'ret_port' of the MasterOfMaster
402#syndic_master_port: 4506
403
404# PID file of the syndic daemon
405#syndic_pidfile: /var/run/salt-syndic.pid
406
407# LOG file of the syndic daemon
408#syndic_log_file: syndic.log
409
410##### Peer Publish settings #####
411##########################################
412# Salt minions can send commands to other minions, but only if the minion is
413# allowed to. By default "Peer Publication" is disabled, and when enabled it
414# is enabled for specific minions and specific commands. This allows secure
415# compartmentalization of commands based on individual minions.
416
417# The configuration uses regular expressions to match minions and then a list
418# of regular expressions to match functions. The following will allow the
419# minion authenticated as foo.example.com to execute functions from the test
420# and pkg modules.
421#
422#peer:
423# foo.example.com:
424# - test.*
425# - pkg.*
426#
427# This will allow all minions to execute all commands:
428#
429#peer:
430# .*:
431# - .*
432#
433# This is not recommended, since it would allow anyone who gets root on any
434# single minion to instantly have root on all of the minions!
435
436# Minions can also be allowed to execute runners from the salt master.
437# Since executing a runner from the minion could be considered a security risk,
438# it needs to be enabled. This setting functions just like the peer setting
439# except that it opens up runners instead of module functions.
440#
441# All peer runner support is turned off by default and must be enabled before
442# using. This will enable all peer runners for all minions:
443#
444#peer_run:
445# .*:
446# - .*
447#
448# To enable just the manage.up runner for the minion foo.example.com:
449#
450#peer_run:
451# foo.example.com:
452# - manage.up
453
454
455##### Logging settings #####
456##########################################
457# The location of the master log file
458# The master log can be sent to a regular file, local path name, or network
459# location. Remote logging works best when configured to use rsyslogd(8) (e.g.:
460# ``file:///dev/log``), with rsyslogd(8) configured for network logging. The URI
461# format is: <file|udp|tcp>://<host|socketpath>:<port-if-required>/<log-facility>
462#log_file: /var/log/salt/master
463#log_file: file:///dev/log
464#log_file: udp://loghost:10514
465
466#log_file: /var/log/salt/master
467#key_logfile: /var/log/salt/key
468
469# The level of messages to send to the console.
470# One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'.
471#log_level: warning
472
473# The level of messages to send to the log file.
474# One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'.
475#log_level_logfile: warning
476
477# The date and time format used in log messages. Allowed date/time formating
478# can be seen here: http://docs.python.org/library/time.html#time.strftime
479#log_datefmt: '%H:%M:%S'
480#log_datefmt_logfile: '%Y-%m-%d %H:%M:%S'
481
482# The format of the console logging messages. Allowed formatting options can
483# be seen here: http://docs.python.org/library/logging.html#logrecord-attributes
484#log_fmt_console: '[%(levelname)-8s] %(message)s'
485#log_fmt_logfile: '%(asctime)s,%(msecs)03.0f [%(name)-17s][%(levelname)-8s] %(message)s'
486
487# This can be used to control logging levels more specificically. This
488# example sets the main salt library at the 'warning' level, but sets
489# 'salt.modules' to log at the 'debug' level:
490# log_granular_levels:
491# 'salt': 'warning',
492# 'salt.modules': 'debug'
493#
494#log_granular_levels: {}
495
496
497##### Node Groups #####
498##########################################
499# Node groups allow for logical groupings of minion nodes.
500# A group consists of a group name and a compound target.
501#
502#nodegroups:
503# group1: 'L@foo.domain.com,bar.domain.com,baz.domain.com and bl*.domain.com'
504# group2: 'G@os:Debian and foo.domain.com'
505
506
507##### Range Cluster settings #####
508##########################################
509# The range server (and optional port) that serves your cluster information
510# https://github.com/grierj/range/wiki/Introduction-to-Range-with-YAML-files
511#
512#range_server: range:80
513
514
515##### Windows Software Repo settings #####
516##############################################
517# Location of the repo on the master
518#win_repo: '/srv/salt/win/repo'
519
520# Location of the master's repo cache file
521#win_repo_mastercachefile: '/srv/salt/win/repo/winrepo.p'
522
523# List of git repositories to include with the local repo
524#win_gitrepos:
525# - 'https://github.com/saltstack/salt-winrepo.git'
diff --git a/meta-openstack/recipes-support/salt/files/minion b/meta-openstack/recipes-support/salt/files/minion
new file mode 100644
index 0000000..8fdde14
--- /dev/null
+++ b/meta-openstack/recipes-support/salt/files/minion
@@ -0,0 +1,494 @@
1##### Primary configuration settings #####
2##########################################
3
4# Per default the minion will automatically include all config files
5# from minion.d/*.conf (minion.d is a directory in the same directory
6# as the main minion config file).
7#default_include: minion.d/*.conf
8
9# Set the location of the salt master server, if the master server cannot be
10# resolved, then the minion will fail to start.
11#master: salt
12
13# Set whether the minion should connect to the master via IPv6
14#ipv6: False
15
16# Set the number of seconds to wait before attempting to resolve
17# the master hostname if name resolution fails. Defaults to 30 seconds.
18# Set to zero if the minion should shutdown and not retry.
19# retry_dns: 30
20
21# Set the port used by the master reply and authentication server
22#master_port: 4506
23
24# The user to run salt
25#user: root
26
27# Specify the location of the daemon process ID file
28#pidfile: /var/run/salt-minion.pid
29
30# The root directory prepended to these options: pki_dir, cachedir, log_file,
31# sock_dir, pidfile.
32#root_dir: /
33
34# The directory to store the pki information in
35#pki_dir: /etc/salt/pki/minion
36
37# Explicitly declare the id for this minion to use, if left commented the id
38# will be the hostname as returned by the python call: socket.getfqdn()
39# Since salt uses detached ids it is possible to run multiple minions on the
40# same machine but with different ids, this can be useful for salt compute
41# clusters.
42#id:
43
44# Append a domain to a hostname in the event that it does not exist. This is
45# useful for systems where socket.getfqdn() does not actually result in a
46# FQDN (for instance, Solaris).
47#append_domain:
48
49# Custom static grains for this minion can be specified here and used in SLS
50# files just like all other grains. This example sets 4 custom grains, with
51# the 'roles' grain having two values that can be matched against:
52#grains:
53# roles:
54# - webserver
55# - memcache
56# deployment: datacenter4
57# cabinet: 13
58# cab_u: 14-15
59
60# Where cache data goes
61#cachedir: /var/cache/salt/minion
62
63# Verify and set permissions on configuration directories at startup
64#verify_env: True
65
66# The minion can locally cache the return data from jobs sent to it, this
67# can be a good way to keep track of jobs the minion has executed
68# (on the minion side). By default this feature is disabled, to enable
69# set cache_jobs to True
70#cache_jobs: False
71
72# set the directory used to hold unix sockets
73#sock_dir: /var/run/salt/minion
74
75# Set the default outputter used by the salt-call command. The default is
76# "nested"
77#output: nested
78#
79# By default output is colored, to disable colored output set the color value
80# to False
81#color: True
82
83# Backup files that are replaced by file.managed and file.recurse under
84# 'cachedir'/file_backups relative to their original location and appended
85# with a timestamp. The only valid setting is "minion". Disabled by default.
86#
87# Alternatively this can be specified for each file in state files:
88#
89# /etc/ssh/sshd_config:
90# file.managed:
91# - source: salt://ssh/sshd_config
92# - backup: minion
93#
94#backup_mode: minion
95
96# When waiting for a master to accept the minion's public key, salt will
97# continuously attempt to reconnect until successful. This is the time, in
98# seconds, between those reconnection attempts.
99#acceptance_wait_time: 10
100
101# If this is nonzero, the time between reconnection attempts will increase by
102# acceptance_wait_time seconds per iteration, up to this maximum. If this is
103# set to zero, the time between reconnection attempts will stay constant.
104#acceptance_wait_time_max: 0
105
106# When the master key changes, the minion will try to re-auth itself to receive
107# the new master key. In larger environments this can cause a SYN flood on the
108# master because all minions try to re-auth immediately. To prevent this and
109# have a minion wait for a random amount of time, use this optional parameter.
110# The wait-time will be a random number of seconds between
111# 0 and the defined value.
112#random_reauth_delay: 60
113
114
115# If you don't have any problems with syn-floods, dont bother with the
116# three recon_* settings described below, just leave the defaults!
117#
118# The ZeroMQ pull-socket that binds to the masters publishing interface tries
119# to reconnect immediately, if the socket is disconnected (for example if
120# the master processes are restarted). In large setups this will have all
121# minions reconnect immediately which might flood the master (the ZeroMQ-default
122# is usually a 100ms delay). To prevent this, these three recon_* settings
123# can be used.
124#
125# recon_default: the interval in milliseconds that the socket should wait before
126# trying to reconnect to the master (100ms = 1 second)
127#
128# recon_max: the maximum time a socket should wait. each interval the time to wait
129# is calculated by doubling the previous time. if recon_max is reached,
130# it starts again at recon_default. Short example:
131#
132# reconnect 1: the socket will wait 'recon_default' milliseconds
133# reconnect 2: 'recon_default' * 2
134# reconnect 3: ('recon_default' * 2) * 2
135# reconnect 4: value from previous interval * 2
136# reconnect 5: value from previous interval * 2
137# reconnect x: if value >= recon_max, it starts again with recon_default
138#
139# recon_randomize: generate a random wait time on minion start. The wait time will
140# be a random value between recon_default and recon_default +
141# recon_max. Having all minions reconnect with the same recon_default
142# and recon_max value kind of defeats the purpose of being able to
143# change these settings. If all minions have the same values and your
144# setup is quite large (several thousand minions), they will still
145# flood the master. The desired behaviour is to have timeframe within
146# all minions try to reconnect.
147
148# Example on how to use these settings:
149# The goal: have all minions reconnect within a 60 second timeframe on a disconnect
150#
151# The settings:
152#recon_default: 1000
153#recon_max: 59000
154#recon_randomize: True
155#
156# Each minion will have a randomized reconnect value between 'recon_default'
157# and 'recon_default + recon_max', which in this example means between 1000ms
158# 60000ms (or between 1 and 60 seconds). The generated random-value will be
159# doubled after each attempt to reconnect. Lets say the generated random
160# value is 11 seconds (or 11000ms).
161#
162# reconnect 1: wait 11 seconds
163# reconnect 2: wait 22 seconds
164# reconnect 3: wait 33 seconds
165# reconnect 4: wait 44 seconds
166# reconnect 5: wait 55 seconds
167# reconnect 6: wait time is bigger than 60 seconds (recon_default + recon_max)
168# reconnect 7: wait 11 seconds
169# reconnect 8: wait 22 seconds
170# reconnect 9: wait 33 seconds
171# reconnect x: etc.
172#
173# In a setup with ~6000 thousand hosts these settings would average the reconnects
174# to about 100 per second and all hosts would be reconnected within 60 seconds.
175#recon_default: 100
176#recon_max: 5000
177#recon_randomize: False
178
179# The loop_interval sets how long in seconds the minion will wait between
180# evaluating the scheduler and running cleanup tasks. This defaults to a
181# sane 60 seconds, but if the minion scheduler needs to be evaluated more
182# often lower this value
183#loop_interval: 60
184
185# When healing, a dns_check is run. This is to make sure that the originally
186# resolved dns has not changed. If this is something that does not happen in
187# your environment, set this value to False.
188#dns_check: True
189
190# Windows platforms lack posix IPC and must rely on slower TCP based inter-
191# process communications. Set ipc_mode to 'tcp' on such systems
192#ipc_mode: ipc
193#
194# Overwrite the default tcp ports used by the minion when in tcp mode
195#tcp_pub_port: 4510
196#tcp_pull_port: 4511
197
198# The minion can include configuration from other files. To enable this,
199# pass a list of paths to this option. The paths can be either relative or
200# absolute; if relative, they are considered to be relative to the directory
201# the main minion configuration file lives in (this file). Paths can make use
202# of shell-style globbing. If no files are matched by a path passed to this
203# option then the minion will log a warning message.
204#
205#
206# Include a config file from some other path:
207# include: /etc/salt/extra_config
208#
209# Include config from several files and directories:
210#include:
211# - /etc/salt/extra_config
212# - /etc/roles/webserver
213
214##### Minion module management #####
215##########################################
216# Disable specific modules. This allows the admin to limit the level of
217# access the master has to the minion
218#disable_modules: [cmd,test]
219#disable_returners: []
220#
221# Modules can be loaded from arbitrary paths. This enables the easy deployment
222# of third party modules. Modules for returners and minions can be loaded.
223# Specify a list of extra directories to search for minion modules and
224# returners. These paths must be fully qualified!
225#module_dirs: []
226#returner_dirs: []
227#states_dirs: []
228#render_dirs: []
229#
230# A module provider can be statically overwritten or extended for the minion
231# via the providers option, in this case the default module will be
232# overwritten by the specified module. In this example the pkg module will
233# be provided by the yumpkg5 module instead of the system default.
234#
235#providers:
236# pkg: yumpkg5
237#
238# Enable Cython modules searching and loading. (Default: False)
239#cython_enable: False
240#
241
242##### State Management Settings #####
243###########################################
244# The state management system executes all of the state templates on the minion
245# to enable more granular control of system state management. The type of
246# template and serialization used for state management needs to be configured
247# on the minion, the default renderer is yaml_jinja. This is a yaml file
248# rendered from a jinja template, the available options are:
249# yaml_jinja
250# yaml_mako
251# yaml_wempy
252# json_jinja
253# json_mako
254# json_wempy
255#
256#renderer: yaml_jinja
257#
258# The failhard option tells the minions to stop immediately after the first
259# failure detected in the state execution, defaults to False
260#failhard: False
261#
262# autoload_dynamic_modules Turns on automatic loading of modules found in the
263# environments on the master. This is turned on by default, to turn of
264# autoloading modules when states run set this value to False
265#autoload_dynamic_modules: True
266#
267# clean_dynamic_modules keeps the dynamic modules on the minion in sync with
268# the dynamic modules on the master, this means that if a dynamic module is
269# not on the master it will be deleted from the minion. By default this is
270# enabled and can be disabled by changing this value to False
271#clean_dynamic_modules: True
272#
273# Normally the minion is not isolated to any single environment on the master
274# when running states, but the environment can be isolated on the minion side
275# by statically setting it. Remember that the recommended way to manage
276# environments is to isolate via the top file.
277#environment: None
278#
279# If using the local file directory, then the state top file name needs to be
280# defined, by default this is top.sls.
281#state_top: top.sls
282#
283# Run states when the minion daemon starts. To enable, set startup_states to:
284# 'highstate' -- Execute state.highstate
285# 'sls' -- Read in the sls_list option and execute the named sls files
286# 'top' -- Read top_file option and execute based on that file on the Master
287#startup_states: ''
288#
289# list of states to run when the minion starts up if startup_states is 'sls'
290#sls_list:
291# - edit.vim
292# - hyper
293#
294# top file to execute if startup_states is 'top'
295#top_file: ''
296
297##### File Directory Settings #####
298##########################################
299# The Salt Minion can redirect all file server operations to a local directory,
300# this allows for the same state tree that is on the master to be used if
301# copied completely onto the minion. This is a literal copy of the settings on
302# the master but used to reference a local directory on the minion.
303
304# Set the file client. The client defaults to looking on the master server for
305# files, but can be directed to look at the local file directory setting
306# defined below by setting it to local.
307#file_client: remote
308
309# The file directory works on environments passed to the minion, each environment
310# can have multiple root directories, the subdirectories in the multiple file
311# roots cannot match, otherwise the downloaded files will not be able to be
312# reliably ensured. A base environment is required to house the top file.
313# Example:
314# file_roots:
315# base:
316# - /srv/salt/
317# dev:
318# - /srv/salt/dev/services
319# - /srv/salt/dev/states
320# prod:
321# - /srv/salt/prod/services
322# - /srv/salt/prod/states
323#
324#file_roots:
325# base:
326# - /srv/salt
327
328# By default, the Salt fileserver recurses fully into all defined environments
329# to attempt to find files. To limit this behavior so that the fileserver only
330# traverses directories with SLS files and special Salt directories like _modules,
331# enable the option below. This might be useful for installations where a file root
332# has a very large number of files and performance is negatively impacted.
333#
334# Default is False.
335#
336# fileserver_limit_traversal: False
337
338# The hash_type is the hash to use when discovering the hash of a file in
339# the local fileserver. The default is md5, but sha1, sha224, sha256, sha384
340# and sha512 are also supported.
341#hash_type: md5
342
343# The Salt pillar is searched for locally if file_client is set to local. If
344# this is the case, and pillar data is defined, then the pillar_roots need to
345# also be configured on the minion:
346#pillar_roots:
347# base:
348# - /srv/pillar
349
350###### Security settings #####
351###########################################
352# Enable "open mode", this mode still maintains encryption, but turns off
353# authentication, this is only intended for highly secure environments or for
354# the situation where your keys end up in a bad state. If you run in open mode
355# you do so at your own risk!
356#open_mode: False
357
358# Enable permissive access to the salt keys. This allows you to run the
359# master or minion as root, but have a non-root group be given access to
360# your pki_dir. To make the access explicit, root must belong to the group
361# you've given access to. This is potentially quite insecure.
362#permissive_pki_access: False
363
364# The state_verbose and state_output settings can be used to change the way
365# state system data is printed to the display. By default all data is printed.
366# The state_verbose setting can be set to True or False, when set to False
367# all data that has a result of True and no changes will be suppressed.
368#state_verbose: True
369#
370# The state_output setting changes if the output is the full multi line
371# output for each changed state if set to 'full', but if set to 'terse'
372# the output will be shortened to a single line.
373#state_output: full
374#
375# Fingerprint of the master public key to double verify the master is valid,
376# the master fingerprint can be found by running "salt-key -F master" on the
377# salt master.
378#master_finger: ''
379
380###### Thread settings #####
381###########################################
382# Disable multiprocessing support, by default when a minion receives a
383# publication a new process is spawned and the command is executed therein.
384#multiprocessing: True
385
386##### Logging settings #####
387##########################################
388# The location of the minion log file
389# The minion log can be sent to a regular file, local path name, or network
390# location. Remote logging works best when configured to use rsyslogd(8) (e.g.:
391# ``file:///dev/log``), with rsyslogd(8) configured for network logging. The URI
392# format is: <file|udp|tcp>://<host|socketpath>:<port-if-required>/<log-facility>
393#log_file: /var/log/salt/minion
394#log_file: file:///dev/log
395#log_file: udp://loghost:10514
396#
397#log_file: /var/log/salt/minion
398#key_logfile: /var/log/salt/key
399#
400# The level of messages to send to the console.
401# One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'.
402# Default: 'warning'
403#log_level: warning
404#
405# The level of messages to send to the log file.
406# One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'.
407# Default: 'warning'
408#log_level_logfile:
409
410# The date and time format used in log messages. Allowed date/time formating
411# can be seen here: http://docs.python.org/library/time.html#time.strftime
412#log_datefmt: '%H:%M:%S'
413#log_datefmt_logfile: '%Y-%m-%d %H:%M:%S'
414#
415# The format of the console logging messages. Allowed formatting options can
416# be seen here: http://docs.python.org/library/logging.html#logrecord-attributes
417#log_fmt_console: '[%(levelname)-8s] %(message)s'
418#log_fmt_logfile: '%(asctime)s,%(msecs)03.0f [%(name)-17s][%(levelname)-8s] %(message)s'
419#
420# This can be used to control logging levels more specificically. This
421# example sets the main salt library at the 'warning' level, but sets
422# 'salt.modules' to log at the 'debug' level:
423# log_granular_levels:
424# 'salt': 'warning',
425# 'salt.modules': 'debug'
426#
427#log_granular_levels: {}
428
429###### Module configuration #####
430###########################################
431# Salt allows for modules to be passed arbitrary configuration data, any data
432# passed here in valid yaml format will be passed on to the salt minion modules
433# for use. It is STRONGLY recommended that a naming convention be used in which
434# the module name is followed by a . and then the value. Also, all top level
435# data must be applied via the yaml dict construct, some examples:
436#
437# You can specify that all modules should run in test mode:
438#test: True
439#
440# A simple value for the test module:
441#test.foo: foo
442#
443# A list for the test module:
444#test.bar: [baz,quo]
445#
446# A dict for the test module:
447#test.baz: {spam: sausage, cheese: bread}
448
449
450###### Update settings ######
451###########################################
452# Using the features in Esky, a salt minion can both run as a frozen app and
453# be updated on the fly. These options control how the update process
454# (saltutil.update()) behaves.
455#
456# The url for finding and downloading updates. Disabled by default.
457#update_url: False
458#
459# The list of services to restart after a successful update. Empty by default.
460#update_restart_services: []
461
462
463###### Keepalive settings ######
464############################################
465# ZeroMQ now includes support for configuring SO_KEEPALIVE if supported by
466# the OS. If connections between the minion and the master pass through
467# a state tracking device such as a firewall or VPN gateway, there is
468# the risk that it could tear down the connection the master and minion
469# without informing either party that their connection has been taken away.
470# Enabling TCP Keepalives prevents this from happening.
471#
472# Overall state of TCP Keepalives, enable (1 or True), disable (0 or False)
473# or leave to the OS defaults (-1), on Linux, typically disabled. Default True, enabled.
474#tcp_keepalive: True
475#
476# How long before the first keepalive should be sent in seconds. Default 300
477# to send the first keepalive after 5 minutes, OS default (-1) is typically 7200 seconds
478# on Linux see /proc/sys/net/ipv4/tcp_keepalive_time.
479#tcp_keepalive_idle: 300
480#
481# How many lost probes are needed to consider the connection lost. Default -1
482# to use OS defaults, typically 9 on Linux, see /proc/sys/net/ipv4/tcp_keepalive_probes.
483#tcp_keepalive_cnt: -1
484#
485# How often, in seconds, to send keepalives after the first one. Default -1 to
486# use OS defaults, typically 75 seconds on Linux, see
487# /proc/sys/net/ipv4/tcp_keepalive_intvl.
488#tcp_keepalive_intvl: -1
489
490
491###### Windows Software settings ######
492############################################
493# Location of the repository cache file on the master
494#win_repo_cachefile: 'salt://win/repo/winrepo.p'
diff --git a/meta-openstack/recipes-support/salt/files/roster b/meta-openstack/recipes-support/salt/files/roster
new file mode 100644
index 0000000..3eac2fa
--- /dev/null
+++ b/meta-openstack/recipes-support/salt/files/roster
@@ -0,0 +1,8 @@
1# Sample salt-ssh config file
2#web1:
3# host: 192.168.42.1 # The IP addr or DNS hostname
4# user: fred # Remote executions will be executed as user fred
5# passwd: foobarbaz # The password to use for login, if omitted, keys are used
6# sudo: True # Whether to sudo to root, not enabled by default
7#web2:
8# host: 192.168.42.2
diff --git a/meta-openstack/recipes-support/salt/files/salt-api b/meta-openstack/recipes-support/salt/files/salt-api
new file mode 100755
index 0000000..4b45bd2
--- /dev/null
+++ b/meta-openstack/recipes-support/salt/files/salt-api
@@ -0,0 +1,110 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: salt-api
4# Required-Start: $remote_fs $network
5# Required-Stop: $remote_fs $network
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: salt api control daemon
9# Description: This is a daemon that exposes an external API
10### END INIT INFO
11
12# Author: Michael Prokop <mika@debian.org>
13
14PATH=/sbin:/usr/sbin:/bin:/usr/bin
15DESC="salt api control daemon"
16NAME=salt-api
17DAEMON=/usr/bin/salt-api
18DAEMON_ARGS="-d"
19PIDFILE=/var/run/$NAME.pid
20SCRIPTNAME=/etc/init.d/$NAME
21
22# Exit if the package is not installed
23[ -x "$DAEMON" ] || exit 0
24
25# Read configuration variable file if it is present
26[ -r /etc/default/$NAME ] && . /etc/default/$NAME
27
28# Source function library.
29. /etc/init.d/functions
30
31do_start() {
32 # Return
33 # 0 if daemon has been started
34 # 1 if daemon was already running
35 # 2 if daemon could not be started
36 pid=$(pidof -x $DAEMON)
37 if [ -n "$pid" ] ; then
38 return 1
39 fi
40
41 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS \
42 || return 2
43}
44
45do_stop() {
46 # Return
47 # 0 if daemon has been stopped
48 # 1 if daemon was already stopped
49 # 2 if daemon could not be stopped
50 # other if a failure occ
51 start-stop-daemon --stop --retry=TERM/30/KILL/5 --quiet --pidfile $PIDFILE --name $NAME
52 RETVAL=$?
53 [ "$RETVAL" = 2 ] && return 2
54 rm -f $PIDFILE
55 return "$RETVAL"
56}
57
58case "$1" in
59 start)
60 [ "$VERBOSE" != no ] && echo "Starting $DESC" "$NAME"
61 do_start
62 case "$?" in
63 0|1) [ "$VERBOSE" != no ] && echo OK ;;
64 2) [ "$VERBOSE" != no ] && echo FAILED ;;
65 esac
66 ;;
67 stop)
68 [ "$VERBOSE" != no ] && echo "Stopping $DESC" "$NAME"
69 do_stop
70 case "$?" in
71 0|1) [ "$VERBOSE" != no ] && echo OK ;;
72 2) [ "$VERBOSE" != no ] && echo FAILED ;;
73 esac
74 ;;
75 status)
76 pid=`pidof -x $DAEMON`
77 if [ -n "$pid" ]; then
78 echo "$NAME (pid $pid) is running ..."
79 else
80 echo "$NAME is stopped"
81 fi
82 ;;
83 #reload)
84 # not implemented
85 #;;
86 restart|force-reload)
87 echo "Restarting $DESC" "$NAME"
88 do_stop
89 case "$?" in
90 0|1)
91 do_start
92 case "$?" in
93 0) echo OK ;;
94 1) echo FAILED ;; # Old process is still running
95 *) echo FAILED ;; # Failed to start
96 esac
97 ;;
98 *)
99 # Failed to stop
100 echo FAILED
101 ;;
102 esac
103 ;;
104 *)
105 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
106 exit 3
107 ;;
108esac
109
110exit 0
diff --git a/meta-openstack/recipes-support/salt/files/salt-common.bash_completion b/meta-openstack/recipes-support/salt/files/salt-common.bash_completion
new file mode 100644
index 0000000..a457f4d
--- /dev/null
+++ b/meta-openstack/recipes-support/salt/files/salt-common.bash_completion
@@ -0,0 +1,332 @@
1# written by David Pravec
2# - feel free to /msg alekibango on IRC if you want to talk about this file
3
4# TODO: check if --config|-c was used and use configured config file for queries
5# TODO: solve somehow completion for salt -G pythonversion:[tab]
6# (not sure what to do with lists)
7# TODO: --range[tab] -- how?
8# TODO: -E --exsel[tab] -- how?
9# TODO: --compound[tab] -- how?
10# TODO: use history to extract some words, esp. if ${cur} is empty
11# TODO: TEST EVERYTING a lot
12# TODO: cache results of some functions? where? how long?
13# TODO: is it ok to use '--timeout 2' ?
14
15
16_salt_get_grains(){
17 if [ "$1" = 'local' ] ; then
18 salt-call --out=txt -- grains.ls | sed 's/^.*\[//' | tr -d ",']" |sed 's:\([a-z0-9]\) :\1\: :g'
19 else
20 salt '*' --timeout 2 --out=txt -- grains.ls | sed 's/^.*\[//' | tr -d ",']" |sed 's:\([a-z0-9]\) :\1\: :g'
21 fi
22}
23
24_salt_get_grain_values(){
25 if [ "$1" = 'local' ] ; then
26 salt-call --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$'
27 else
28 salt '*' --timeout 2 --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$'
29 fi
30}
31
32
33_salt(){
34 local cur prev opts _salt_grains _salt_coms pprev ppprev
35 COMPREPLY=()
36 cur="${COMP_WORDS[COMP_CWORD]}"
37 prev="${COMP_WORDS[COMP_CWORD-1]}"
38 if [ ${COMP_CWORD} -gt 2 ]; then
39 pprev="${COMP_WORDS[COMP_CWORD-2]}"
40 fi
41 if [ ${COMP_CWORD} -gt 3 ]; then
42 ppprev="${COMP_WORDS[COMP_CWORD-3]}"
43 fi
44
45 opts="-h --help -d --doc --documentation --version --versions-report -c \
46 --config-dir= -v --verbose -t --timeout= -s --static -b --batch= \
47 --batch-size= -E --pcre -L --list -G --grain --grain-pcre -N \
48 --nodegroup -R --range -C --compound -X --exsel -I --pillar \
49 --return= -a --auth= --eauth= --extended-auth= -T --make-token -S \
50 --ipcidr --out=pprint --out=yaml --out=overstatestage --out=json \
51 --out=raw --out=highstate --out=key --out=txt --no-color --out-indent= "
52
53 if [[ "${cur}" == -* ]] ; then
54 COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
55 return 0
56 fi
57
58 # 2 special cases for filling up grain values
59 case "${pprev}" in
60 -G|--grain|--grain-pcre)
61 if [ "${cur}" = ":" ]; then
62 COMPREPLY=($(compgen -W "`_salt_get_grain_values ${prev}`" ))
63 return 0
64 fi
65 ;;
66 esac
67 case "${ppprev}" in
68 -G|--grain|--grain-pcre)
69 if [ "${prev}" = ":" ]; then
70 COMPREPLY=( $(compgen -W "`_salt_get_grain_values ${pprev}`" -- ${cur}) )
71 return 0
72 fi
73 ;;
74 esac
75
76 if [ "${cur}" = "=" ] && [[ "${prev}" == --* ]]; then
77 cur=""
78 fi
79 if [ "${prev}" = "=" ] && [[ "${pprev}" == --* ]]; then
80 prev="${pprev}"
81 fi
82
83 case "${prev}" in
84
85 -c|--config)
86 COMPREPLY=($(compgen -f -- ${cur}))
87 return 0
88 ;;
89 salt)
90 COMPREPLY=($(compgen -W "\'*\' ${opts} `salt-key --no-color -l acc`" -- ${cur}))
91 return 0
92 ;;
93 -E|--pcre)
94 COMPREPLY=($(compgen -W "`salt-key --no-color -l acc`" -- ${cur}))
95 return 0
96 ;;
97 -G|--grain|--grain-pcre)
98 COMPREPLY=($(compgen -W "$(_salt_get_grains)" -- ${cur}))
99 return 0
100 ;;
101 -C|--compound)
102 COMPREPLY=() # TODO: finish this one? how?
103 return 0
104 ;;
105 -t|--timeout)
106 COMPREPLY=($( compgen -W "1 2 3 4 5 6 7 8 9 10 15 20 30 40 60 90 120 180" -- ${cur}))
107 return 0
108 ;;
109 -b|--batch|--batch-size)
110 COMPREPLY=($(compgen -W "1 2 3 4 5 6 7 8 9 10 15 20 30 40 50 60 70 80 90 100 120 150 200"))
111 return 0
112 ;;
113 -X|--exsel) # TODO: finish this one? how?
114 return 0
115 ;;
116 -N|--nodegroup)
117 MASTER_CONFIG='/etc/salt/master'
118 COMPREPLY=($(compgen -W "`awk -F ':' 'BEGIN {print_line = 0}; /^nodegroups/ {print_line = 1;getline } print_line && /^ */ {print $1} /^[^ ]/ {print_line = 0}' <${MASTER_CONFIG}`" -- ${cur}))
119 return 0
120 ;;
121 esac
122
123 _salt_coms="$(salt '*' --timeout 2 --out=txt -- sys.list_functions | sed 's/^.*\[//' | tr -d ",']" )"
124 all="${opts} ${_salt_coms}"
125 COMPREPLY=( $(compgen -W "${all}" -- ${cur}) )
126
127 return 0
128}
129
130complete -F _salt salt
131
132
133_saltkey(){
134 local cur prev opts prev pprev
135 COMPREPLY=()
136 cur="${COMP_WORDS[COMP_CWORD]}"
137 prev="${COMP_WORDS[COMP_CWORD-1]}"
138 opts="-c --config-dir= -h --help --version --versions-report -q --quiet \
139 -y --yes --gen-keys= --gen-keys-dir= --keysize= --key-logfile= \
140 -l --list= -L --list-all -a --accept= -A --accept-all \
141 -r --reject= -R --reject-all -p --print= -P --print-all \
142 -d --delete= -D --delete-all -f --finger= -F --finger-all \
143 --out=pprint --out=yaml --out=overstatestage --out=json --out=raw \
144 --out=highstate --out=key --out=txt --no-color --out-indent= "
145 if [ ${COMP_CWORD} -gt 2 ]; then
146 pprev="${COMP_WORDS[COMP_CWORD-2]}"
147 fi
148 if [ ${COMP_CWORD} -gt 3 ]; then
149 ppprev="${COMP_WORDS[COMP_CWORD-3]}"
150 fi
151 if [[ "${cur}" == -* ]] ; then
152 COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
153 return 0
154 fi
155
156 if [ "${cur}" = "=" ] && [[ "${prev}" == --* ]]; then
157 cur=""
158 fi
159 if [ "${prev}" = "=" ] && [[ "${pprev}" == --* ]]; then
160 prev="${pprev}"
161 fi
162
163 case "${prev}" in
164 -a|--accept)
165 COMPREPLY=($(compgen -W "$(salt-key -l un --no-color; salt-key -l rej --no-color)" -- ${cur}))
166 return 0
167 ;;
168 -r|--reject)
169 COMPREPLY=($(compgen -W "$(salt-key -l acc --no-color)" -- ${cur}))
170 return 0
171 ;;
172 -d|--delete)
173 COMPREPLY=($(compgen -W "$(salt-key -l acc --no-color; salt-key -l un --no-color; salt-key -l rej --no-color)" -- ${cur}))
174 return 0
175 ;;
176 -c|--config)
177 COMPREPLY=($(compgen -f -- ${cur}))
178 return 0
179 ;;
180 --keysize)
181 COMPREPLY=($(compgen -W "2048 3072 4096 5120 6144" -- ${cur}))
182 return 0
183 ;;
184 --gen-keys)
185 return 0
186 ;;
187 --gen-keys-dir)
188 COMPREPLY=($(compgen -d -- ${cur}))
189 return 0
190 ;;
191 -p|--print)
192 COMPREPLY=($(compgen -W "$(salt-key -l acc --no-color; salt-key -l un --no-color; salt-key -l rej --no-color)" -- ${cur}))
193 return 0
194 ;;
195 -l|--list)
196 COMPREPLY=($(compgen -W "pre un acc accepted unaccepted rej rejected all" -- ${cur}))
197 return 0
198 ;;
199 --accept-all)
200 return 0
201 ;;
202 esac
203 COMPREPLY=($(compgen -W "${opts} " -- ${cur}))
204 return 0
205}
206
207complete -F _saltkey salt-key
208
209_saltcall(){
210 local cur prev opts _salt_coms pprev ppprev
211 COMPREPLY=()
212 cur="${COMP_WORDS[COMP_CWORD]}"
213 prev="${COMP_WORDS[COMP_CWORD-1]}"
214 opts="-h --help -d --doc --documentation --version --versions-report \
215 -m --module-dirs= -g --grains --return= --local -c --config-dir= -l --log-level= \
216 --out=pprint --out=yaml --out=overstatestage --out=json --out=raw \
217 --out=highstate --out=key --out=txt --no-color --out-indent= "
218 if [ ${COMP_CWORD} -gt 2 ]; then
219 pprev="${COMP_WORDS[COMP_CWORD-2]}"
220 fi
221 if [ ${COMP_CWORD} -gt 3 ]; then
222 ppprev="${COMP_WORDS[COMP_CWORD-3]}"
223 fi
224 if [[ "${cur}" == -* ]] ; then
225 COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
226 return 0
227 fi
228
229 if [ "${cur}" = "=" ] && [[ ${prev} == --* ]]; then
230 cur=""
231 fi
232 if [ "${prev}" = "=" ] && [[ ${pprev} == --* ]]; then
233 prev="${pprev}"
234 fi
235
236 case ${prev} in
237 -m|--module-dirs)
238 COMPREPLY=( $(compgen -d ${cur} ))
239 return 0
240 ;;
241 -l|--log-level)
242 COMPREPLY=( $(compgen -W "info none garbage trace warning error debug" -- ${cur}))
243 return 0
244 ;;
245 -g|grains)
246 return 0
247 ;;
248 salt-call)
249 COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
250 return 0
251 ;;
252 esac
253
254 _salt_coms="$(salt-call --out=txt -- sys.list_functions|sed 's/^.*\[//' | tr -d ",']" )"
255 COMPREPLY=( $(compgen -W "${opts} ${_salt_coms}" -- ${cur} ))
256 return 0
257}
258
259complete -F _saltcall salt-call
260
261
262_saltcp(){
263 local cur prev opts target prefpart postpart helper filt pprev ppprev
264 COMPREPLY=()
265 cur="${COMP_WORDS[COMP_CWORD]}"
266 prev="${COMP_WORDS[COMP_CWORD-1]}"
267 opts="-t --timeout= -s --static -b --batch= --batch-size= \
268 -h --help --version --versions-report -c --config-dir= \
269 -E --pcre -L --list -G --grain --grain-pcre -N --nodegroup \
270 -R --range -C --compound -X --exsel -I --pillar \
271 --out=pprint --out=yaml --out=overstatestage --out=json --out=raw \
272 --out=highstate --out=key --out=txt --no-color --out-indent= "
273 if [[ "${cur}" == -* ]] ; then
274 COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
275 return 0
276 fi
277
278 if [ "${cur}" = "=" ] && [[ "${prev}" == --* ]]; then
279 cur=""
280 fi
281 if [ "${prev}" = "=" ] && [[ "${pprev}" == --* ]]; then
282 prev=${pprev}
283 fi
284
285 case ${prev} in
286 salt-cp)
287 COMPREPLY=($(compgen -W "${opts} `salt-key -l acc --no-color`" -- ${cur}))
288 return 0
289 ;;
290 -t|--timeout)
291 # those numbers are just a hint
292 COMPREPLY=($(compgen -W "2 3 4 8 10 15 20 25 30 40 60 90 120 180 240 300" -- ${cur} ))
293 return 0
294 ;;
295 -E|--pcre)
296 COMPREPLY=($(compgen -W "`salt-key -l acc --no-color`" -- ${cur}))
297 return 0
298 ;;
299 -L|--list)
300 # IMPROVEMENTS ARE WELCOME
301 prefpart="${cur%,*},"
302 postpart=${cur##*,}
303 filt="^\($(echo ${cur}| sed 's:,:\\|:g')\)$"
304 helper=($(salt-key -l acc --no-color | grep -v "${filt}" | sed "s/^/${prefpart}/"))
305 COMPREPLY=($(compgen -W "${helper[*]}" -- ${cur}))
306
307 return 0
308 ;;
309 -G|--grain|--grain-pcre)
310 COMPREPLY=($(compgen -W "$(_salt_get_grains)" -- ${cur}))
311 return 0
312 ;;
313 # FIXME
314 -R|--range)
315 # FIXME ??
316 return 0
317 ;;
318 -C|--compound)
319 # FIXME ??
320 return 0
321 ;;
322 -c|--config)
323 COMPREPLY=($(compgen -f -- ${cur}))
324 return 0
325 ;;
326 esac
327
328 # default is using opts:
329 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
330}
331
332complete -F _saltcp salt-cp
diff --git a/meta-openstack/recipes-support/salt/files/salt-common.logrotate b/meta-openstack/recipes-support/salt/files/salt-common.logrotate
new file mode 100644
index 0000000..dcfd268
--- /dev/null
+++ b/meta-openstack/recipes-support/salt/files/salt-common.logrotate
@@ -0,0 +1,10 @@
1/var/log/salt/master
2/var/log/salt/minion
3/var/log/salt/*.log
4{
5 weekly
6 missingok
7 rotate 7
8 compress
9 notifempty
10}
diff --git a/meta-openstack/recipes-support/salt/files/salt-master b/meta-openstack/recipes-support/salt/files/salt-master
new file mode 100755
index 0000000..b534b36
--- /dev/null
+++ b/meta-openstack/recipes-support/salt/files/salt-master
@@ -0,0 +1,111 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: salt-master
4# Required-Start: $remote_fs $network
5# Required-Stop: $remote_fs $network
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: salt master control daemon
9# Description: This is a daemon that controls the salt minions
10### END INIT INFO
11
12# Author: Michael Prokop <mika@debian.org>
13
14PATH=/sbin:/usr/sbin:/bin:/usr/bin
15DESC="salt master control daemon"
16NAME=salt-master
17DAEMON=/usr/bin/salt-master
18DAEMON_ARGS="-d"
19PIDFILE=/var/run/$NAME.pid
20SCRIPTNAME=/etc/init.d/$NAME
21
22# Exit if the package is not installed
23[ -x "$DAEMON" ] || exit 0
24
25# Read configuration variable file if it is present
26[ -r /etc/default/$NAME ] && . /etc/default/$NAME
27
28# Source function library.
29. /etc/init.d/functions
30
31do_start() {
32 # Return
33 # 0 if daemon has been started
34 # 1 if daemon was already running
35 # 2 if daemon could not be started
36 pid=$(pidof -x $DAEMON)
37 if [ -n "$pid" ] ; then
38 return 1
39 fi
40
41 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
42 $DAEMON_ARGS \
43 || return 2
44}
45
46do_stop() {
47 # Return
48 # 0 if daemon has been stopped
49 # 1 if daemon was already stopped
50 # 2 if daemon could not be stopped
51 # other if a failure occurred
52 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
53 RETVAL="$?"
54 [ "$RETVAL" = 2 ] && return 2
55 rm -f $PIDFILE
56 return "$RETVAL"
57}
58
59case "$1" in
60 start)
61 [ "$VERBOSE" != no ] && echo "Starting $DESC" "$NAME"
62 do_start
63 case "$?" in
64 0|1) [ "$VERBOSE" != no ] && echo OK ;;
65 2) [ "$VERBOSE" != no ] && echo FAILED ;;
66 esac
67 ;;
68 stop)
69 [ "$VERBOSE" != no ] && echo "Stopping $DESC" "$NAME"
70 do_stop
71 case "$?" in
72 0|1) [ "$VERBOSE" != no ] && echo OK ;;
73 2) [ "$VERBOSE" != no ] && echo FAILED ;;
74 esac
75 ;;
76 status)
77 pid=`pidof -x $DAEMON`
78 if [ -n "$pid" ]; then
79 echo "$NAME (pid $pid) is running ..."
80 else
81 echo "$NAME is stopped"
82 fi
83 ;;
84 #reload)
85 # not implemented
86 #;;
87 restart|force-reload)
88 echo "Restarting $DESC" "$NAME"
89 do_stop
90 case "$?" in
91 0|1)
92 do_start
93 case "$?" in
94 0) echo OK ;;
95 1) echo FAILED ;; # Old process is still running
96 *) echo FAILED ;; # Failed to start
97 esac
98 ;;
99 *)
100 # Failed to stop
101 echo FAILED
102 ;;
103 esac
104 ;;
105 *)
106 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
107 exit 3
108 ;;
109esac
110
111exit 0
diff --git a/meta-openstack/recipes-support/salt/files/salt-minion b/meta-openstack/recipes-support/salt/files/salt-minion
new file mode 100755
index 0000000..e062017
--- /dev/null
+++ b/meta-openstack/recipes-support/salt/files/salt-minion
@@ -0,0 +1,111 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: salt-minion
4# Required-Start: $remote_fs $network
5# Required-Stop: $remote_fs $network
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: salt minion control daemon
9# Description: This is a daemon that receives commands from a salt-master
10### END INIT INFO
11
12# Author: Michael Prokop <mika@debian.org>
13
14PATH=/sbin:/usr/sbin:/bin:/usr/bin
15DESC="salt minion control daemon"
16NAME=salt-minion
17DAEMON=/usr/bin/salt-minion
18DAEMON_ARGS="-d"
19PIDFILE=/var/run/$NAME.pid
20SCRIPTNAME=/etc/init.d/$NAME
21
22# Exit if the package is not installed
23[ -x "$DAEMON" ] || exit 0
24
25# Read configuration variable file if it is present
26[ -r /etc/default/$NAME ] && . /etc/default/$NAME
27
28# Source function library.
29. /etc/init.d/functions
30
31do_start() {
32 # Return
33 # 0 if daemon has been started
34 # 1 if daemon was already running
35 # 2 if daemon could not be started
36 pid=$(pidof -x $DAEMON)
37 if [ -n "$pid" ] ; then
38 return 1
39 fi
40
41 start-stop-daemon --start --quiet --background --pidfile $PIDFILE --exec $DAEMON -- \
42 $DAEMON_ARGS \
43 || return 2
44}
45
46do_stop() {
47 # Return
48 # 0 if daemon has been stopped
49 # 1 if daemon was already stopped
50 # 2 if daemon could not be stopped
51 # other if a failure occurred
52 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
53 RETVAL="$?"
54 [ "$RETVAL" = 2 ] && return 2
55 rm -f $PIDFILE
56 return "$RETVAL"
57}
58
59case "$1" in
60 start)
61 [ "$VERBOSE" != no ] && echo "Starting $DESC" "$NAME"
62 do_start
63 case "$?" in
64 0|1) [ "$VERBOSE" != no ] && echo OK ;;
65 2) [ "$VERBOSE" != no ] && echo FAILED ;;
66 esac
67 ;;
68 stop)
69 [ "$VERBOSE" != no ] && echo "Stopping $DESC" "$NAME"
70 do_stop
71 case "$?" in
72 0|1) [ "$VERBOSE" != no ] && echo OK ;;
73 2) [ "$VERBOSE" != no ] && echo FAILED ;;
74 esac
75 ;;
76 status)
77 pid=`pidof -x $DAEMON`
78 if [ -n "$pid" ]; then
79 echo "$NAME (pid $pid) is running ..."
80 else
81 echo "$NAME is stopped"
82 fi
83 ;;
84 #reload)
85 # not implemented
86 #;;
87 restart|force-reload)
88 echo "Restarting $DESC" "$NAME"
89 do_stop
90 case "$?" in
91 0|1)
92 do_start
93 case "$?" in
94 0) echo OK ;;
95 1) echo FAILED ;; # Old process is still running
96 *) echo FAILED ;; # Failed to start
97 esac
98 ;;
99 *)
100 # Failed to stop
101 echo FAILED
102 ;;
103 esac
104 ;;
105 *)
106 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
107 exit 3
108 ;;
109esac
110
111exit 0
diff --git a/meta-openstack/recipes-support/salt/files/salt-syndic b/meta-openstack/recipes-support/salt/files/salt-syndic
new file mode 100755
index 0000000..6d5cdff
--- /dev/null
+++ b/meta-openstack/recipes-support/salt/files/salt-syndic
@@ -0,0 +1,111 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: salt-syndic
4# Required-Start: $remote_fs $network
5# Required-Stop: $remote_fs $network
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: salt syndic control daemon
9# Description: This is a daemon for the master of masters
10### END INIT INFO
11
12# Author: Michael Prokop <mika@debian.org>
13
14PATH=/sbin:/usr/sbin:/bin:/usr/bin
15DESC="salt syndic control daemon"
16NAME=salt-syndic
17DAEMON=/usr/bin/salt-syndic
18DAEMON_ARGS="-d"
19PIDFILE=/var/run/$NAME.pid
20SCRIPTNAME=/etc/init.d/$NAME
21
22# Exit if the package is not installed
23[ -x "$DAEMON" ] || exit 0
24
25# Read configuration variable file if it is present
26[ -r /etc/default/$NAME ] && . /etc/default/$NAME
27
28# Source function library.
29. /etc/init.d/functions
30
31do_start() {
32 # Return
33 # 0 if daemon has been started
34 # 1 if daemon was already running
35 # 2 if daemon could not be started
36 pid=$(pidof -x $DAEMON)
37 if [ -n "$pid" ] ; then
38 return 1
39 fi
40
41 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
42 $DAEMON_ARGS \
43 || return 2
44}
45
46do_stop() {
47 # Return
48 # 0 if daemon has been stopped
49 # 1 if daemon was already stopped
50 # 2 if daemon could not be stopped
51 # other if a failure occurred
52 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
53 RETVAL="$?"
54 [ "$RETVAL" = 2 ] && return 2
55 rm -f $PIDFILE
56 return "$RETVAL"
57}
58
59case "$1" in
60 start)
61 [ "$VERBOSE" != no ] && echo "Starting $DESC" "$NAME"
62 do_start
63 case "$?" in
64 0|1) [ "$VERBOSE" != no ] && echo OK ;;
65 2) [ "$VERBOSE" != no ] && echo FAILED ;;
66 esac
67 ;;
68 stop)
69 [ "$VERBOSE" != no ] && echo "Stopping $DESC" "$NAME"
70 do_stop
71 case "$?" in
72 0|1) [ "$VERBOSE" != no ] && echo OK ;;
73 2) [ "$VERBOSE" != no ] && echo FAILED ;;
74 esac
75 ;;
76 status)
77 pid=`pidof -x $DAEMON`
78 if [ -n "$pid" ]; then
79 echo "$NAME (pid $pid) is running ..."
80 else
81 echo "$NAME is stopped"
82 fi
83 ;;
84 #reload)
85 # not implemented
86 #;;
87 restart|force-reload)
88 echo "Restarting $DESC" "$NAME"
89 do_stop
90 case "$?" in
91 0|1)
92 do_start
93 case "$?" in
94 0) echo OK ;;
95 1) echo FAILED ;; # Old process is still running
96 *) echo FAILED ;; # Failed to start
97 esac
98 ;;
99 *)
100 # Failed to stop
101 echo FAILED
102 ;;
103 esac
104 ;;
105 *)
106 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
107 exit 3
108 ;;
109esac
110
111exit 0