saltstack之master配置檔案
阿新 • • 發佈:2018-11-21
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: <no default> # 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: <no default> # - /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