Pillar可以給minion指定需要的數(shù)據(jù)
- 在master上設(shè)置
vim /etc/salt/master
pillar_opts: True
- 第一步怎么定義pillar的數(shù)據(jù)
vim /etc/salt/master
pillar_roots:
base:
- /srv/pillar
** pillar的top.sls必須放在base環(huán)境下**
vim /etc/pillar/appache.sls
{% if grains['os'] == 'CentOS' %}
apache: httpd
{% elif grains['os'] == 'Debian' %}
apache: apache2
{% endif %}
vim /srv/salt/top.sls
base:
'*':
- apache
刷新
salt '*' pillar.items
- 先刷新一下
salt '*' saltutil.refresh_pillar
使用pillar定位主機
salt -I 'apache:httpd' test.ping