Deploy Saltstack and bulk install HTTPD services

Source: Internet
Author: User
Tags saltstack

  • Saltstack Introduction
  • Salt is a basic platform management tool. The saltstack uses the C/s mode, and the server side is the master,client end of the salt, which communicates between Minion,minion and master through ZEROMQ Message Queuing. Master listens on 4505 and 4506 ports, 4505 is the master and Minion authenticated communication ports, and 4506 performs return information for commands that Master uses to send commands or to receive Minion.
    ?

      • Saltstack Common Modules
      • Saltstack provides a number of functional modules to facilitate operation of the operating system's underlying functions and common tools.

    1:PKG module: Is package management, including additions and deletions updates.
    2:file module: Manages file operations, including synchronizing files, setting file permissions and owning user groups, deleting files, and more.
    3:cmd module: A command or script is executed on the minion.
    4:user module: Manage system account operations.
    5:service module: Managing system service operations
    6:cron module: Managing Cron Service operations

    ?
    Deployment environment

    role Host name IP
    Master Master.saltstack.com 192.168.200.128
    Minion Web01.saltstack.com 192.168.200.129
    Minion Web02.saltstack.com 192.168.200.130

    ?
    Operation Steps

    • Saltstack Installation

    • 1: Modify host Name

      # vim /etc/hostname三台主机分别为:master.saltstack.com    //(管理)web01.saltstack.com     //(被管理)web02.saltstack.com     //(被管理)
    • 2: Modify three Hosts files

      # vim /etc/hosts192.168.200.128 master.saltstack.com192.168.200.129 web01.saltstack.com192.168.200.130 web02.saltstack.com
    • 3: Installation

      # systemctl stop firewalld   # setenforce 0                   //关闭防火墙# yum install -y epel-release# yum install -y salt-master      //管理端安装# yum install -y epel-release# yum install -y salt-minion      //被管理端安装
    • 4: Management-side configuration

      # vim /etc/salt/masterinterface: 192.168.200.128    //15行 监听地址改为本地IP............auto_accept: True                //215  证书认证............file_roots:                          //416行 站点目录开启    base:         - /srv/salt............nodegroups:                          //710行 组分类    group1: ‘web01.saltstack.com‘     group2: ‘web02.saltstack.com‘............pillar_opts: True              //552行  pillar开启pillar_roots:                     //529行     base:        - /srv/pillar# cat /etc/salt/master | grep -v ^$ | grep -v ^#       //查看修改好的配置项

    ?

      • 5: Create the Salt file root directory and the pillar directory

        # mkdir /srv/salt# mkdir /srv/pillar# systemctl start salt-master.service    //开启服务# netstat -natp | egrep ‘4505|4506‘       //查看4505、4506端口

    ?

      • 6: Managed Side configuration

        # vim /etc/salt/minionmaster: 192.168.200.128     //16行 指定管理端IPid: web01.saltstack.com      //78行 指定被控的主机名 (另外一台为 web02.saltstack.com)# systemctl start salt-minion.service  //开启服务

    ?

      • 7: Test on the management side. ' * ' refers to all hosts

        # salt ‘*‘ test.ping     //查看通信状态# salt ‘*‘ cmd.run ‘df -h‘   //查看所有被管理端的挂载情况# salt ‘web01.saltstack.com‘ cmd.run ‘df -h‘   //查看指定主机的挂载情况# salt ‘*‘ grains.items   //查看grains值# salt ‘*‘ pillar.items   //查看pillar(动态信息)# salt-key  //查看已经被接受过的客户端


        ?
        ?

      • Saltstack Configuration Management installation Apache

        注意:‘*‘  表示所有客户端执行apache模块# vim /srv/salt/top.slsbase: ‘*‘:     - apache

        # vim /srv/salt/apache.sls   //注意apache-service  是自定义的id名apache-service:    pkg.installed:        - names:            - httpd            - httpd-devel    service.running:        - name: httpd        - enable: True

      • Restart Service

      • To perform a flush state configuration command on the management side

        # salt ‘*‘ state.highstate


        ?
        ?

      • Go to Minion verify that the httpd installation was successful

    Deploy Saltstack and bulk install httpd services

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.