Saltstack部署zabbix

本文详细介绍了如何利用Saltstack自动化部署Zabbix监控系统,包括部署LAMP架构,PHP、MySQL和Apache的安装配置,以及Zabbix的安装和配置。通过执行特定的Saltstack状态文件和脚本,实现Zabbix的全自动化部署。
摘要由CSDN通过智能技术生成

Saltstack部署zabbix

目录树

[root@master ~]# cd /srv/salt/prod/
[root@master prod]# tree
.
|-- modules
|   |-- application
|   |   `-- php
|   |       |-- files
|   |       |   |-- install.sh
|   |       |   |-- oniguruma-devel-6.8.2-2.el8.x86_64.rpm
|   |       |   |-- php-7.4.24.tar.gz
|   |       |   |-- php-fpm
|   |       |   |-- php-fpm.conf
|   |       |   |-- php-fpm.service
|   |       |   |-- php.ini
|   |       |   `-- www.conf
|   |       `-- install.sls
|   |-- database
|   |   `-- mysql
|   |       |-- files
|   |       |   |-- install.sh
|   |       |   |-- mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz
|   |       |   |-- mysql.server
|   |       |   `-- mysqld.service
|   |       `-- install.sls
|   `-- web
|       `-- apache
|           |-- files
|           |   |-- apr-1.7.0.tar.gz
|           |   |-- apr-util-1.6.1.tar.gz
|           |   |-- httpd-2.4.48.tar.gz
|           |   |-- httpd.conf
|           |   |-- httpd.service
|           |   `-- install.sh
|           `-- install.sls
`-- zabbix
    |-- apache.sls
    |-- files
    |   |-- index.php
    |   |-- my.cnf
    |   |-- mysql.conf
    |   `-- vhosts.conf
    |-- main.sls
    |-- mysql.sls
    `-- zabbix
        |-- install.sh
        |-- zabbix-5.4.4.tar.gz
        `-- zabbix.sls

13 directories, 31 files
[root@master prod]#
先部署LAMP架构
PHP安装部分

/srv/salt/prod/modules/application/php/install.sls

/usr/src/oniguruma-devel-6.8.2-2.el8.x86_64.rpm:
  file.managed:
    - source: salt://modules/application/php/files/oniguruma-devel-6.8.2-2.el8.x86_64.rpm
    - user: root
    - group: root
    - mode: '0644'
  cmd.run:
    - name: yum -y install /usr/src/oniguruma-devel-6.8.2-2.el8.x86_64.rpm

dnf -y install epel-release:
  cmd.run

dep-pkckages-install:
  pkg.installed:
    - pkgs:
      - sqlite-devel
      - libzip-devel
      - libxml2
      - libxml2-devel
      - openssl
      - openssl-devel
      - bzip2
      - bzip2-devel
      - libcurl
      - libcurl-devel
      - libicu-devel
      - libjpeg-turbo
      - libjpeg-turbo-devel
      - libpng
      - libpng-devel
      - openldap-devel
      - pcre-devel
      - freetype
      - freetype-devel
      - gmp
      - gmp-devel
      - libmcrypt
      - libmcrypt-devel
      - readline
      - readline-devel
      - libxslt
      - libxslt-devel
      - mhash
      - mhash-devel

/usr/src/php-7.4.24.tar.gz:
  file.managed:
    - source: salt://modules/application/php/files/php-7.4.24.tar.gz
    - user: root
    - group: root
    - mode: '0644'

salt://modules/application/php/files/install.sh:
  cmd.script

copy-php:
  file.managed:
    - names:
      - /etc/init.d/php-fpm:
        - source: salt://modules/application/php/files/php-fpm
        - user: root
        - group: root
        - mode: '0755'
      - /usr/local/php7/etc/php-fpm.conf:
        - source: salt://modules/application/php/files/php-fpm.conf
      - /usr/local/php7/etc/php-fpm.d/www.conf:
        - source: salt://modules/application/php/files/www.conf
      - /usr/lib/systemd/system/php-fpm.service:
        - source: salt://modules/application/php/files/php-fpm.service
      - /etc/php.ini:
        - source: salt://modules/application/php/files/php.ini

php-fpm.se
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值