saltstack数据系统之Pillar
2015-11-18 15:36
537 查看
在master上面打开系统自带的pillar:
[root@linux-node1 ~]# vim /etc/salt/master
556 pillar_opts: True
[root@linux-node1 ~]# /etc/init.d/salt-master restart
Stopping salt-master daemon: [确定]
Starting salt-master daemon: [确定]
[root@linux-node1 ~]# salt '*' pillar.items =======>显示系统自带的pillar
pillar的应用场景:
1 敏感数据:如用户名与密码
2 处理差异性变量
[root@linux-node1 ~]# vim /etc/salt/master ==========>打开如下选项
533 pillar_roots:
534 base:
535 - /srv/pillar
556 pillar_opts: False
[root@linux-node1 srv]# mkdir pillar
[root@linux-node1 srv]# /etc/init.d/salt-master restart
Stopping salt-master daemon: [确定]
Starting salt-master daemon: [确定]
实例1:
[root@linux-node1 pillar]# cat /srv/pillar/apache.sls
{% if grains['os'] == 'CentOS' %} 如果系统是CentOS
apache: httpd 则显示httpd
{% elif grains['os'] == 'Debian' %} 如果系统是Debian
apache: apache2 则显示apache2
{% endif %}
[root@linux-node1 pillar]# cat /srv/pillar/top.sls ========>pillar的top file文件
base:
'*':
- apache
[root@linux-node1 pillar]# salt '*' pillar.items ========>获取pillar的值
linux-node2.example.com:
----------
apache:
httpd
linux-node1.example.com:
----------
apache:
httpd
实例2:定位主机
[root@linux-node1 pillar]# salt '*' saltutil.refresh_pillar =======>刷新pillar
linux-node1.example.com:
True
linux-node2.example.com:
True
[root@linux-node1 pillar]# salt -I 'apache:httpd' test.ping =========>定位主机
linux-node2.example.com:
True
linux-node1.example.com:
True
老男孩网址:http://www.etiantian.org/
qq:406564728
欢迎提出宝贵建议
[root@linux-node1 ~]# vim /etc/salt/master
556 pillar_opts: True
[root@linux-node1 ~]# /etc/init.d/salt-master restart
Stopping salt-master daemon: [确定]
Starting salt-master daemon: [确定]
[root@linux-node1 ~]# salt '*' pillar.items =======>显示系统自带的pillar
pillar的应用场景:
1 敏感数据:如用户名与密码
2 处理差异性变量
[root@linux-node1 ~]# vim /etc/salt/master ==========>打开如下选项
533 pillar_roots:
534 base:
535 - /srv/pillar
556 pillar_opts: False
[root@linux-node1 srv]# mkdir pillar
[root@linux-node1 srv]# /etc/init.d/salt-master restart
Stopping salt-master daemon: [确定]
Starting salt-master daemon: [确定]
实例1:
[root@linux-node1 pillar]# cat /srv/pillar/apache.sls
{% if grains['os'] == 'CentOS' %} 如果系统是CentOS
apache: httpd 则显示httpd
{% elif grains['os'] == 'Debian' %} 如果系统是Debian
apache: apache2 则显示apache2
{% endif %}
[root@linux-node1 pillar]# cat /srv/pillar/top.sls ========>pillar的top file文件
base:
'*':
- apache
[root@linux-node1 pillar]# salt '*' pillar.items ========>获取pillar的值
linux-node2.example.com:
----------
apache:
httpd
linux-node1.example.com:
----------
apache:
httpd
实例2:定位主机
[root@linux-node1 pillar]# salt '*' saltutil.refresh_pillar =======>刷新pillar
linux-node1.example.com:
True
linux-node2.example.com:
True
[root@linux-node1 pillar]# salt -I 'apache:httpd' test.ping =========>定位主机
linux-node2.example.com:
True
linux-node1.example.com:
True
老男孩网址:http://www.etiantian.org/
qq:406564728
欢迎提出宝贵建议
相关文章推荐
- 计算WWW在线人数
- 文件遍历排序函数
- 网站当前的在线人数
- 一个目录遍历函数
- 获取jsp各种参数
- 随机生成文件名的函数
- Java获得指定区间数的方法
- 模拟xcopy的函数
- html5 图表FineReport 数据钻取
- 网络中的计算
- saltstack UI界面安装
- salt 常用模块介绍
- 显示salt进程具体名称
- Salt Master外部Job Cache配置
- saltstack 自动认证
- SaltStack Job 管理 及 saltutil.signal_job 模块的问题
- Saltstack:Crontab部署
- Saltstack:Multi-Master搭建
- saltstack安装配置(面向零基础的,求大神不吐槽)
- jmeter 线程 上的参数解释理解的误区~