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