diff options
author | Dusan Matejka <D3DeFi@users.noreply.github.com> | 2019-10-25 12:28:20 +0200 |
---|---|---|
committer | ansibot <ansibot@users.noreply.github.com> | 2019-10-25 06:28:20 -0400 |
commit | 57c36e037815b6344c24922c069b6e0b2d0bcc71 (patch) | |
tree | c5f026e6661bfc97c29db111bcfa7cd935ba8491 /test/integration/targets/setup_zabbix | |
parent | 07ed860c2b5c1fdabdd30b628e8f44c829d243b6 (diff) | |
download | ansible-57c36e037815b6344c24922c069b6e0b2d0bcc71.tar.gz |
Zabbix integration tests (#63744)
* adjusted setup_zabbix integration tests role to work on distributions from Debian family
* bumped zabbix_host integration tests role to be run against bionic
Diffstat (limited to 'test/integration/targets/setup_zabbix')
4 files changed, 58 insertions, 20 deletions
diff --git a/test/integration/targets/setup_zabbix/defaults/main.yml b/test/integration/targets/setup_zabbix/defaults/main.yml index 55c963e627..0a1664754b 100644 --- a/test/integration/targets/setup_zabbix/defaults/main.yml +++ b/test/integration/targets/setup_zabbix/defaults/main.yml @@ -3,7 +3,9 @@ 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_version: 4.0 +zabbix_apt_repository: 'deb http://repo.zabbix.com/zabbix/{{ zabbix_version }}/{{ ansible_distribution.lower() }}/ {{ ansible_distribution_release }} main' +zabbix_apt_repository_key: 'http://repo.zabbix.com/zabbix-official-repo.key' zabbix_packages: - zabbix-server-mysql diff --git a/test/integration/targets/setup_zabbix/tasks/main.yml b/test/integration/targets/setup_zabbix/tasks/main.yml index 7a6a71ca06..6d082fff21 100644 --- a/test/integration/targets/setup_zabbix/tasks/main.yml +++ b/test/integration/targets/setup_zabbix/tasks/main.yml @@ -1,6 +1,3 @@ --- - -# 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' + when: ansible_os_family == 'Debian' diff --git a/test/integration/targets/setup_zabbix/tasks/setup.yml b/test/integration/targets/setup_zabbix/tasks/setup.yml index 92d5eb811f..b3d31e5a46 100644 --- a/test/integration/targets/setup_zabbix/tasks/setup.yml +++ b/test/integration/targets/setup_zabbix/tasks/setup.yml @@ -1,23 +1,47 @@ -# sets up and starts Zabbix with default settings (works on Ubuntu 14.04, -# possibly more) using a MySQL database. +# sets up and starts Zabbix with default settings using a MySQL database. -- name: create mysql user {{ db_user }} - mysql_user: - name: "{{ db_user }}" - password: "{{ db_password }}" +- name: install zabbix repository key + apt_key: + url: "{{ zabbix_apt_repository_key }}" state: present - priv: "{{ db_name }}.*:ALL" - name: install zabbix repository - apt: deb={{ zabbix_release_deb }} state=present + apt_repository: + repo: "{{ zabbix_apt_repository }}" + filename: zabbix + state: present -- name: install zabbix debian dependencies - apt: name={{ item }} state=latest update_cache=yes - with_items: "{{ zabbix_packages }}" +- name: check if dpkg is set to exclude specific destinations + stat: + path: /etc/dpkg/dpkg.cfg.d/excludes + register: dpkg_excludes + +- name: ensure documentation installations are allowed for zabbix + lineinfile: + path: /etc/dpkg/dpkg.cfg.d/excludes + regexp: '^path-include=/usr/share/doc/zabbix*$' + line: 'path-include=/usr/share/doc/zabbix*' + state: present + when: dpkg_excludes.stat.exists + +- name: install zabbix apt dependencies + apt: + name: "{{ zabbix_packages }}" + state: latest + update_cache: yes - name: install zabbix-api python package pip: name: zabbix-api + state: latest + +- name: create mysql user {{ db_user }} + mysql_user: + name: "{{ db_user }}" + password: "{{ db_password }}" + state: present + priv: "{{ db_name }}.*:ALL" + login_unix_socket: '{{ mysql_socket }}' - name: import initial zabbix database mysql_db: @@ -31,9 +55,9 @@ template: src: zabbix_server.conf.j2 dest: /etc/zabbix/zabbix_server.conf - owner: zabbix + owner: root group: zabbix - mode: 0644 + mode: 0640 - name: deploy zabbix web frontend configuration template: @@ -41,8 +65,22 @@ dest: /etc/zabbix/web/zabbix.conf.php mode: 0644 +- name: Create proper run directory for zabbix-server + file: + path: /var/run/zabbix + state: directory + owner: zabbix + group: zabbix + mode: 0775 + - name: restart zabbix-server - service: name=zabbix-server state=restarted enabled=yes + service: + name: zabbix-server + state: restarted + enabled: yes - name: restart apache2 - service: name=apache2 state=restarted enabled=yes + service: + name: apache2 + state: restarted + enabled: yes diff --git a/test/integration/targets/setup_zabbix/templates/zabbix_server.conf.j2 b/test/integration/targets/setup_zabbix/templates/zabbix_server.conf.j2 index 672c6332a0..f4c201af59 100644 --- a/test/integration/targets/setup_zabbix/templates/zabbix_server.conf.j2 +++ b/test/integration/targets/setup_zabbix/templates/zabbix_server.conf.j2 @@ -1,3 +1,4 @@ +PidFile=/var/run/zabbix/zabbix_server.pid LogFile=/tmp/zabbix_server.log DBName={{ db_name }} DBUser={{ db_user }} |