salt配置文件
master:
1.主要配置信息
#可以将主配置文件拆分不同文件放置到此目录中 default_include: master.d/*.conf #绑定地址 interface: 0.0.0.0 #设置ipv6地址监听 ipv6: False #消息发布使用端口TCP publish_port: 4505 #运行master的用户 user: root #最大文件打开限制 max_open_files: 20000 #salt管理线程数目 worker_threads: 5 #return接口端口,支持认证、文件服务、结构收集 ret_port: 4506 #pid文件位置 pidfile: /var/run/salt-master.pid #salt运行的根目录 root_dir: / #pki认证密钥目录 pki_dir: /etc/salt/pki/master #salt工作和缓存数据目录 cachedir: /var/cache/salt/master # Directory for custom modules. This directory can contain subdirectories for # each of Salt's module types such as "runners", "output", "wheel", "modules", # "states", "returners", etc. #extension_modules:# Directory for custom modules. This directory can contain subdirectories for # each of Salt's module types such as "runners", "output", "wheel", "modules", # "states", "returners", etc. # Like 'extension_modules' but can take an array of paths #module_dirs: # - /var/cache/salt/minion/extmods #服务启动时,验证和设置配置目录权限 verify_env: True #设置工作缓存中所存储的旧工作信息的小时数 keep_jobs: 24 #设置salt和api命令超时时间 timeout: 3 #salt进程检测周期,此选项控制master的维护进程检测周期秒数,更新文件服务器后台清空工作缓存并执行日志 loop_interval: 60 #salt输出类型 output: nested #show_timeout: True #输出是否彩色 color: True #strip_colors: False #socket目录 sock_dir: /var/run/salt/master #设置grains收集gpu信息 enable_gpu_grains: False #开启工作缓存记录 job_cache: True #minion的grains和pillar缓存在cache中 minion_data_cache: True #event_return: mysql # event_return_whitelist: # - salt/master/a_tag # - salt/master/another_tag # event_return_blacklist: # - salt/master/not_this_tag # - salt/master/or_this_one #max_event_size: 1048576 # ping_on_rotate: False #preserve_minion_cache: False # include: /etc/salt/extra_config # include: # - /etc/salt/extra_config
2.安全设置
#开放模式,危险操作。当密钥失效时此选项开启后,master会接受所有minions并会清理所有pki open_mode: False #是否开启自动接收,若指定了autosign-file,则会自动接受autosign-file指定的密钥。 auto_accept: True #认证超时时间 autosign_timeout: 120 #autosign_file文件目录 autosign_file: /etc/salt/autosign.conf #autoreject_file: /etc/salt/autoreject.conf #设置pki文件的访问权限 permissive_pki_access: False #定义用户模块执行权限 #client_acl: # larry: # - test.ping # - network.* #定义用户模块和黑名单 #client_acl_blacklist: # users: # - root # - '^(?!sudo_).*$' # all non sudo users # modules: # - cmd # Enforce client_acl & client_acl_blacklist when users have sudo # access to the salt command. # #sudo_acl: False # The external auth system uses the Salt auth modules to authenticate and # validate users to access areas of the Salt system. #external_auth: # pam: # fred: # - test.* # # Time (in seconds) for a newly generated token to live. Default: 12 hours #token_expire: 43200 # Allow minions to push files to the master. This is disabled by default, for # security purposes. #file_recv: False # Set a hard-limit on the size of the files that can be pushed to the master. # It will be interpreted as megabytes. Default: 100 #file_recv_max_size: 100 # Signature verification on messages published from the master. # This causes the master to cryptographically sign all messages published to its event # bus, and minions then verify that signature before acting on the message. # This is False by default. # # Note that to facilitate interoperability with masters and minions that are different # versions, if sign_pub_messages is True but a message is received by a minion with # no signature, it will still be accepted, and a warning message will be logged. # Conversely, if sign_pub_messages is False, but a minion receives a signed # message it will be accepted, the signature will not be checked, and a warning message # will be logged. This behavior went away in Salt 2014.1.0 and these two situations # will cause minion to throw an exception and drop the message. # sign_pub_messages: False
3.ssh管理
#roster文件目录 roster_file: /etc/salt/roster # Pass in minion option overrides that will be inserted into the SHIM for # salt-ssh calls. The local minion config is not used for salt-ssh. Can be # overridden on a per-minion basis in the roster (`minion_opts`) #ssh_minion_opts: # gpg_keydir: /root/gpg
4.master模块管理
#模块加载方式 # Add any additional locations to look for master runners: #runner_dirs: [] # Enable Cython for master side modules: #cython_enable: False
5.state系统设置
#state入口文件 state_top: top.sls #设置外部top方式 master_tops: {} #设置external_nodes external_nodes: None #state默认模版 renderer: yaml_jinja jinja_trim_blocks: False jinja_lstrip_blocks: False failhard: False state_verbose: True # state_output: full # state_aggregate: # - pkg # #state_aggregate: False #state_events: False
6.文件服务器设置
file_roots: base: - /srv/salt #设置文件校验hash类型 hash_type: md5 #文件缓存区大小 file_buffer_size: 1048576 #同步文件忽略前面正则 #file_ignore_regex: # - '/\.svn($|/)' # - '/\.git($|/)' #同步文件忽略glob # file_ignore_glob: # - '*.pyc' # - '*/somefolder/*.bak' # - '*.swp' #是否允许第三方系统管理文件并提供给minions fileserver_backend: - roots #允许文件链接 fileserver_followsymlinks: False #忽略文件链接 fileserver_ignoresymlinks: True #限制遍历 fileserver_limit_traversal: False #设置fileserver-events fileserver_events: False #gitfs_remotes: # - git://github.com/saltstack/salt-states.git # - #gitfs_root: somefolder/otherfolder
7.pillar系统设置
#pillar目录设置 pillar_roots: base: - /srv/pillar #是否开启ext_pillar #ext_pillar: # - hiera: /etc/hiera.yaml # - cmd_yaml: cat /etc/salt/yaml #开启ext_pillar_first #ext_pillar_first: False #开启ssl验证 #pillar_gitfs_ssl_verify: True #开启pillar读取opts参数 pillar_opts: False #render错误信息 #pillar_safe_render_error: True #合并策略 #pillar_source_merging_strategy: smart
8.syndic设置
#order_masters: False # If this master will be running a salt syndic daemon, syndic_master tells # this master where to receive commands from. #syndic_master: masterofmaster # This is the 'ret_port' of the MasterOfMaster: #syndic_master_port: 4506 # PID file of the syndic daemon: #syndic_pidfile: /var/run/salt-syndic.pid # LOG file of the syndic daemon: #syndic_log_file: syndic.log
9.
##### Peer Publish settings ##### ########################################## # Salt minions can send commands to other minions, but only if the minion is # allowed to. By default "Peer Publication" is disabled, and when enabled it # is enabled for specific minions and specific commands. This allows secure # compartmentalization of commands based on individual minions. # The configuration uses regular expressions to match minions and then a list # of regular expressions to match functions. The following will allow the # minion authenticated as foo.example.com to execute functions from the test # and pkg modules. #peer: # foo.example.com: # - test.* # - pkg.* # # This will allow all minions to execute all commands: #peer: # .*: # - .* # # This is not recommended, since it would allow anyone who gets root on any # single minion to instantly have root on all of the minions! # Minions can also be allowed to execute runners from the salt master. # Since executing a runner from the minion could be considered a security risk, # it needs to be enabled. This setting functions just like the peer setting # except that it opens up runners instead of module functions. # # All peer runner support is turned off by default and must be enabled before # using. This will enable all peer runners for all minions: #peer_run: # .*: # - .* # # To enable just the manage.up runner for the minion foo.example.com: #peer_run: # foo.example.com: # - manage.up
10.mine settings
##### Mine settings ##### ########################################## # Restrict mine.get access from minions. By default any minion has a full access # to get all mine data from master cache. In acl definion below, only pcre matches # are allowed. # mine_get: # .*: # - .* # # The example below enables minion foo.example.com to get 'network.interfaces' mine # data only, minions web* to get all network.* and disk.* mine data and all other # minions won't get any mine data. # mine_get: # foo.example.com: # - network.interfaces # web.*: # - network.* # - disk.*
11.日志管理
#日志文件 log_file: /var/log/salt/master #key日志文件 key_logfile: /var/log/salt/key #日志级别 log_level: warning #日志记录级别 log_level_logfile: warning #日志时间格式 log_datefmt: '%H:%M:%S' log_datefmt_logfile: '%Y-%m-%d %H:%M:%S' #记录日志时间格式 log_fmt_console: '[%(levelname)-8s] %(message)s' log_fmt_logfile: '%(asctime)s,%(msecs)03.0f [%(name)-17s][%(levelname)-8s] %(message)s' #lib库的日志级别 # log_granular_levels: # 'salt': 'warning' # 'salt.modules': 'debug' # log_granular_levels: {}
12.其他设置(Node Groups...)
##### Node Groups ##### ########################################## # Node groups allow for logical groupings of minion nodes. A group consists of a group # name and a compound target. nodegroups: web: '136 or 137' test: '138 or 139' ##### Range Cluster settings ##### ########################################## # The range server (and optional port) that serves your cluster information # https://github.com/ytoolshed/range/wiki/%22yamlfile%22-module-file-spec # #range_server: range:80 ##### Windows Software Repo settings ##### ############################################## # Location of the repo on the master: #win_repo: '/srv/salt/win/repo' # # Location of the master's repo cache file: #win_repo_mastercachefile: '/srv/salt/win/repo/winrepo.p' # # List of git repositories to include with the local repo: #win_gitrepos: # - 'https://github.com/saltstack/salt-winrepo.git' ##### Returner settings ###### ############################################ # Which returner(s) will be used for minion's result: #return: mysql