saltstack master端配置文件
cat /etc/salt/master | egrep -v ‘^$|^#‘ worker_threads: 60 cachedir: /data1/var/cache/salt/master ##存储缓存信息,特别是salt工作执行的命令 timeout: 30 open_mode: True auto_accept: True autosign_timeout: 0 modules: - cmd runner_dirs: [] file_roots: base: - /srv/salt/ dev: - /srv/salt/dev/services - /srv/salt/dev/states prod: - /srv/salt/prod/services - /srv/salt/prod/states pillar_roots: base: - /srv/pillar log_level: info log_level_logfile: info
base,dev,prod为多环境目录配置,默认是启动在base环境下
saltstack minion端配置文件 cat /etc/salt/minion | egrep -v ‘^$|^#‘ master: *****.com.cn id: 192.168.1.11 cachedir: /data1/var/cache/salt/minion ##缓存信息目录,可以用来缓存master端要同步的文件/目录 random_reauth_delay: 600 auth_timeout: 160 auth_tries: 5 recon_default: 6000 recon_max: 590000 recon_randomize: True
master端:
[root@eos197 salt]# pwd /srv/salt [root@eos197 salt]# ll drwxr-xr-x 3 root root 4096 Jul 24 17:38 dappcluster drwxr-xr-x 3 root root 4096 Oct 27 14:57 dbcluster drwxr-xr-x 2 root root 4096 Aug 25 15:11 filepool drwxr-xr-x 2 root root 4096 Oct 8 17:09 _grains drwxr-xr-x 2 root root 4096 Aug 29 06:18 _modules drwxr-xr-x 2 root root 4096 Aug 26 11:08 _returners drwxr-xr-x 3 root root 4096 Jul 20 21:21 rpms -rw-r--r-- 1 root root 101510 Oct 20 15:33 salt.log drwxr-xr-x 5 root root 4096 Sep 16 14:02 sysinit -rw-r--r-- 1 root root 199 Aug 27 11:50 top.sls [root@eos197 salt]# more top.sls #state的入口文件,top.sls,同步文件操作的入口文件 base: ‘*‘: - dappcluster.init - dbcluster.init - sysinit.conf - sysinit.package
[root@eos197 salt]# more dbcluster/init.sls /etc/dbCluster: ##如果没有这个目录,则创建这个目录 file.directory: ##目录管理 - user: root ##权限 - group: root - dir_mode: 755 - file_mode: 755 - makedirs: True##如果没有则创建 /etc/dbCluster/2slave_become_1slave.sh: ##同步文件,如果检测到文件有改动,则会同步文件 保持master、minion一致 file.managed: - source: salt://dbcluster/script/2slave_become_1slave.sh - mode: 644 - user: root - group: root /etc/dbCluster/alert.pl:##同步文件 file.managed: - source: salt://dbcluster/script/alert.pl - mode: 755 - user: root - group: root
minion端:
pwd/data1/var/cache/salt/minion/files/base ##缓存目录,从master端同步的目录及文件都缓存在这 ll total 24 drwx------ 2 root root 4096 Oct 26 15:19 dappcluster drwx------ 3 root root 4096 Oct 26 15:19 dbcluster drwx------ 2 root root 4096 Oct 26 15:19 _grains drwx------ 2 root root 4096 Oct 26 15:19 _modules drwx------ 3 root root 4096 Oct 26 15:19 sysinit -rw------- 1 root root 199 Oct 26 15:19 top.sls more top.sls base: ‘*‘: - dappcluster.init - dbcluster.init - sysinit.conf - sysinit.package ##可以看到minion端缓存的同步文件是根据master端定义的top.sls文件来缓存的,dappcluster/dbcluster/ sysinit 尔_modules与_grains是salt本身缓存的,具体缓存的哪些文件,需要看每个目录下面的sls 是怎么定义的
本文出自 “python散记” 博客,请务必保留此出处http://6252961.blog.51cto.com/6242961/1706834
原文地址:http://6252961.blog.51cto.com/6242961/1706834