saltstack配置apache

Posted 从零开始的linux

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了saltstack配置apache相关的知识,希望对你有一定的参考价值。

saltstack配置apache

  • 在master上面配置

  • [root@node01 salt]# vim /etc/salt/master

  • 打开注释

     
     file_roots:
       base:
         - /srv/salt/
     
    创建目录
    [root@node01 salt]# mkdir /srv/salt
    [root@node01 salt]# cd /srv/salt
    [root@node01 salt]# vim top.sls
     
    base:
      '*':
        - apache

    [root@node01 salt]# vim apache.sls

     
    apache-service:
      pkg.installed:
        - names:
          - httpd
          - httpd-devel
      service.running:
        - name: httpd
        - enable: True                     
  • 执行命令

    salt 'node02' state.highstate

     
    node02:
    ----------
              ID: apache-service
        Function: pkg.installed
            Name: httpd
          Result: True
         Comment: Package httpd is already installed.
         Started: 06:54:53.098683
        Duration: 578.804 ms
         Changes:   
    ----------
              ID: apache-service
        Function: pkg.installed
            Name: httpd-devel
          Result: True
         Comment: Package httpd-devel is already installed.
         Started: 06:54:53.677770
        Duration: 0.805 ms
         Changes:   
    ----------
              ID: apache-service
        Function: service.running
            Name: httpd
          Result: True
         Comment: Service httpd is already enabled, and is in the desired state
         Started: 06:54:53.679299
        Duration: 46.398 ms
         Changes:   
    Summary
    ------------
    Succeeded: 3
    Failed:    0
    ------------
    Total states run:     3



以上是关于saltstack配置apache的主要内容,如果未能解决你的问题,请参考以下文章

Saltstack批量部署apache

集中化管理平台saltstack——自动化实现apache的安装与配置

saltstack详解+部署apache服务

SaltStack的配置管理--jinja

SaltStack自动化批量部署Apache

SaltStack配置管理--状态间的关系