saundy 发表于 2018-7-31 08:15:59

Saltstack-4:数据系统pillar

  目的
  给minion指定的数据,pillar定义参数和变量
  默认关闭,开启方法
  修改master /etc/salt/master
  pillar_opts: Ture
  pillar默认文件位置/srv/pillar
  # cat apache.sls
  {% if grains['os'] == 'CentOS' %}
  apache:httpd
  {% elif grains['os'] == 'Debian' %}
  apche:apche2
  {% endif %}
  pillar的top.sls
  # cat top.sls
  base:
  '*'


[*]apche
salt '*'pillar.items
  结果:
  master.test.com:
  

apache:  httpd
  

slaver.test.com:
  

apache:  httpd
  

  设置完以后要刷新pillar
  salt ‘*’ saltutil.refresh_pillar
  执行命令
  salt -I ‘apache:httpd’ test.ping
页: [1]
查看完整版本: Saltstack-4:数据系统pillar