-
Notifications
You must be signed in to change notification settings - Fork 0
/
userdata.yaml
31 lines (31 loc) · 1.86 KB
/
userdata.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#cloud-config
ssh_pwauth: true
users:
- name: ${admin_user}
groups: sudo
lock_passwd: false
passwd: ${admin_password}
shell: /bin/bash
timezone: Europe/Moscow
runcmd:
- wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+$(lsb_release -c -s)_all.deb
- dpkg -i zabbix-release_5.0-1+$(lsb_release -c -s)_all.deb
- apt-get update -y
- apt-get upgrade -y
- apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent mariadb-server -y
- systemctl enable --now mariadb
- mysql -e "UPDATE mysql.user SET Password=PASSWORD('${mariadb_root_password}') WHERE User='root';"
- mysql -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
- mysql -e "DELETE FROM mysql.user WHERE User='';"
- mysql -e "FLUSH PRIVILEGES;"
- mysql -uroot -p'${mariadb_root_password}' -e "create database zabbix character set utf8 collate utf8_bin;"
- mysql -uroot -p'${mariadb_root_password}' -e "grant all privileges on zabbix.* to zabbix@localhost identified by '${zbx_db_password}';"
- mysql -uroot -p'${mariadb_root_password}' zabbix -e "set global innodb_strict_mode='OFF';"
- zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p'${zbx_db_password}' zabbix
- mysql -uroot -p'${mariadb_root_password}' zabbix -e "set global innodb_strict_mode='ON';"
- sed -i 's/# DBPassword=/DBPassword=${zbx_db_password}/' /etc/zabbix/zabbix_server.conf
- cp /usr/share/zabbix/conf/zabbix.conf.php.example /etc/zabbix/web/zabbix.conf.php
- sed -i "s/\\['PASSWORD'\\]\\s*=\\s''/\\['PASSWORD'\\] = '${zbx_db_password}'/g" /etc/zabbix/web/zabbix.conf.php
- sed -i "s/# php_value date.timezone Europe\/Riga/php_value date.timezone Europe\/Moscow/" /etc/zabbix/apache.conf
- systemctl restart apache2
- systemctl enable --now zabbix-server zabbix-agent