slatsatck file模块2种写法及系统初始化

 一 . lamp搭建   file2种写法

saltstack--一键yum lamp:---请注意重点:

http://www.blogs8.cn/posts/WLjId80

知识点:

文件的2种写法:

/etc/resolv.conf:
  file.managed:
    - source: salt://files/resolv.conf
    - user: root
    - group: root
    - mode: 644

apache-service:
  file.managed:
    - name: /etc/httpd/conf/httpd.conf  #我要放到对端这里
- source: salt://init/files/
httpd.conf
- user: root - group: root - mode: 644

2, salt初始化系统

http://www.cnblogs.com/xkops/p/5483073.html

经典:<-----较全较多

http://jaminzhang.github.io/saltstack/SaltStack-systematic-learning-07-production-env-practice-case/

http://www.roddypy.com/index.php/2015/12/10/saltstack-%E5%88%9D%E5%A7%8B%E5%8C%96linux%E7%B3%BB%E7%BB%9F/

 3, 快速入门salt

http://rfyiamcool.blog.51cto.com/1030776/1262537

3,安装zabbix-agent

安装脚本:

http://www.cnblogs.com/xkops/p/5483073.html       [亮点:jinjia模版,缺点:写死了的]<---后期pillar写一个活的zabbix配置文件模版

安装脚本以下为准:

[root@linux-node1 init]# pwd
/srv/salt/base/init
[root@linux-node1 init]# cat zabbix_agent.sls 
zabbix22-agent:
  pkg.installed:
    - name: zabbix22-agent
  file.managed:
    - name: /etc/zabbix/zabbix_agentd.conf
    - source: salt://init/files/zabbix_agentd.conf
    - user: root
    - group: root
    - template: jinja
    - defaults:
      HOST: 192.168.14.129   #
此处要记得配置模板文件 {{ HOST }},如果不记得使用方法,参考配置管理state文章。
- require: - pkg: zabbix22-agent service.running: - name: zabbix-agent - enable: True - watch: - file: zabbix22-agent

 

原文地址:https://www.cnblogs.com/iiiiher/p/5744643.html