码迷,mamicode.com
首页 > 其他好文 > 详细

SaltStack 之 在从机上安装nginx软件

时间:2018-06-09 21:14:34      阅读:254      评论:0      收藏:0      [点我收藏+]

标签:saltstack

SaltStack 之 在从机上安装nginx软件

一、在salt目录下创建参数文件

[root@SlatStack-Master salt]# vi install_nginx.sls
nginx-install:                      #文件标识
     pkg.installed:                  #pak:模块     installed:方法
         - names:                       #names:所需安装的软件,在下面可列多个
             - nginx                        #安装的软件名
     service.running:             #service:模块      running:方法     #用于服务启动
         - names:                      #names:所需安装的软件,在下面可列多个
             - nginx                       #要启动的软件名可多个

二、在master主机上为BackupServer安装nginx

[root@SlatStack-Master salt]# salt ‘BackupServer‘ state.sls install_nginx
BackupServer:
                    ID: nginx-install
        Function: pkg.installed
                Name: nginx
            Result: True
         Comment: The following packages were installed/updated: nginx
         Started: 20:47:29.068431
        Duration: 20994.535 ms
         Changes:   
                            ----------
                            GeoIP:
                                    ----------
                                    new:
                                            1.6.5-1.el6
                                    old:
                            GeoIP-GeoLite-data:
                                    ----------
                                    new:
                                            2018.04-1.el6
                                    old:
                            GeoIP-GeoLite-data-extra:
                                    ----------
                                    new:
                                            2018.04-1.el6
                                    old:
                            gd:
                                    ----------
                                    new:
                                            2.0.35-11.el6
                                    old:
                            geoipupdate:
                                    ----------
                                    new:
                                            2.2.1-2.el6
                                    old:
                            libXpm:
                                    ----------
                                    new:
                                            3.5.10-2.el6
                                    old:
                            nginx:
                                    ----------
                                    new:
                                            1.10.2-1.el6
                                    old:
                            nginx-all-modules:
                                    ----------
                                    new:
                                            1.10.2-1.el6
                                    old:
                            nginx-filesystem:
                                    ----------
                                    new:
                                            1.10.2-1.el6
                                    old:
                            nginx-mod-http-geoip:
                                    ----------
                                    new:
                                            1.10.2-1.el6
                                    old:
                            nginx-mod-http-image-filter:
                                    ----------
                                    new:
                                            1.10.2-1.el6
                                    old:
                            nginx-mod-http-perl:
                                    ----------
                                    new:
                                            1.10.2-1.el6
                                    old:
                            nginx-mod-http-xslt-filter:
                                    ----------
                                    new:
                                            1.10.2-1.el6
                                    old:
                            nginx-mod-mail:
                                    ----------
                                    new:
                                            1.10.2-1.el6
                                    old:
                            nginx-mod-stream:
                                    ----------
                                    new:
                                            1.10.2-1.el6
                                    old:
----------
                    ID: nginx-install
        Function: service.running
                Name: nginx
            Result: True
         Comment: Started Service nginx
         Started: 20:47:50.065061
        Duration: 240.281 ms
         Changes:   
                            ----------
                            nginx:
                                    True

Summary
------------
Succeeded: 2 (changed=2)
Failed:    0
------------
Total states run:     2

三、查看BackupServer 是否安装了nginx,并启动成功

[root@SlatStack-Master salt]# curl -I BackupServer
HTTP/1.1 200 OK

SaltStack 之 在从机上安装nginx软件

标签:saltstack

原文地址:http://blog.51cto.com/12965094/2126808

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!