mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
zabbix_host integration tests (#33184)
* Integration tests for zabbix_host using Zabbix on Ubuntu 14.04. * fix duplicate yaml key in test * .changed -> is changed, |failed -> is failed, trim configfile * zabbix_host integration test does not need BOTMETA entry, inherited from module
This commit is contained in:
5
test/integration/targets/setup_zabbix/aliases
Normal file
5
test/integration/targets/setup_zabbix/aliases
Normal file
@@ -0,0 +1,5 @@
|
||||
destructive
|
||||
posix/ci/group1
|
||||
skip/osx
|
||||
skip/freebsd
|
||||
skip/rhel
|
||||
10
test/integration/targets/setup_zabbix/defaults/main.yml
Normal file
10
test/integration/targets/setup_zabbix/defaults/main.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
db_name: 'zabbix'
|
||||
db_user: 'zabbix'
|
||||
db_password: 'fLhijUs3PgekNhwJ'
|
||||
|
||||
zabbix_release_deb: 'http://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+trusty_all.deb'
|
||||
|
||||
zabbix_packages:
|
||||
- zabbix-server-mysql
|
||||
- zabbix-frontend-php
|
||||
2
test/integration/targets/setup_zabbix/meta/main.yml
Normal file
2
test/integration/targets/setup_zabbix/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- setup_mysql_db
|
||||
6
test/integration/targets/setup_zabbix/tasks/main.yml
Normal file
6
test/integration/targets/setup_zabbix/tasks/main.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
|
||||
# This integration test is only for Ubuntu 14.04 at the moment. This makes
|
||||
# installation of a Zabbix quite a bit easier.
|
||||
- include: setup.yml
|
||||
when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'trusty'
|
||||
48
test/integration/targets/setup_zabbix/tasks/setup.yml
Normal file
48
test/integration/targets/setup_zabbix/tasks/setup.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
# sets up and starts Zabbix with default settings (works on Ubuntu 14.04,
|
||||
# possibly more) using a MySQL database.
|
||||
|
||||
- name: create mysql user {{ db_user }}
|
||||
mysql_user:
|
||||
name: "{{ db_user }}"
|
||||
password: "{{ db_password }}"
|
||||
state: present
|
||||
priv: "{{ db_name }}.*:ALL"
|
||||
|
||||
- name: install zabbix repository
|
||||
apt: deb={{ zabbix_release_deb }} state=present
|
||||
|
||||
- name: install zabbix debian dependencies
|
||||
apt: name={{ item }} state=latest update_cache=yes
|
||||
with_items: "{{ zabbix_packages }}"
|
||||
|
||||
- name: install zabbix-api python package
|
||||
pip:
|
||||
name: zabbix-api
|
||||
|
||||
- name: import initial zabbix database
|
||||
mysql_db:
|
||||
name: "{{ db_name }}"
|
||||
login_user: "{{ db_user }}"
|
||||
login_password: "{{ db_password }}"
|
||||
state: import
|
||||
target: /usr/share/doc/zabbix-server-mysql/create.sql.gz
|
||||
|
||||
- name: deploy zabbix-server configuration
|
||||
template:
|
||||
src: zabbix_server.conf.j2
|
||||
dest: /etc/zabbix/zabbix_server.conf
|
||||
owner: zabbix
|
||||
group: zabbix
|
||||
mode: 0644
|
||||
|
||||
- name: deploy zabbix web frontend configuration
|
||||
template:
|
||||
src: zabbix.conf.php.j2
|
||||
dest: /etc/zabbix/web/zabbix.conf.php
|
||||
mode: 0644
|
||||
|
||||
- name: restart zabbix-server
|
||||
service: name=zabbix-server state=restarted enabled=yes
|
||||
|
||||
- name: restart apache2
|
||||
service: name=apache2 state=restarted enabled=yes
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// Zabbix GUI configuration file
|
||||
global $DB;
|
||||
|
||||
$DB['TYPE'] = 'MYSQL';
|
||||
$DB['SERVER'] = 'localhost';
|
||||
$DB['PORT'] = '0';
|
||||
$DB['DATABASE'] = '{{ db_name }}';
|
||||
$DB['USER'] = '{{ db_user }}';
|
||||
$DB['PASSWORD'] = '{{ db_password }}';
|
||||
|
||||
// SCHEMA is relevant only for IBM_DB2 database
|
||||
$DB['SCHEMA'] = '';
|
||||
|
||||
$ZBX_SERVER = 'localhost';
|
||||
$ZBX_SERVER_PORT = '10051';
|
||||
$ZBX_SERVER_NAME = '';
|
||||
|
||||
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
|
||||
?>
|
||||
@@ -0,0 +1,6 @@
|
||||
LogFile=/tmp/zabbix_server.log
|
||||
DBName={{ db_name }}
|
||||
DBUser={{ db_user }}
|
||||
DBPassword={{ db_password }}
|
||||
Timeout=4
|
||||
LogSlowQueries=3000
|
||||
Reference in New Issue
Block a user