173 lines
4.1 KiB
YAML
173 lines
4.1 KiB
YAML
|
---
|
||
|
|
||
|
- name: "Debian | Set some facts"
|
||
|
set_fact:
|
||
|
apache_log: apache2
|
||
|
datafiles_path: /usr/share/zabbix-server-{{ database_type }}
|
||
|
when: zabbix_version < 3.0
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
- config
|
||
|
|
||
|
- name: "Debian | Set some facts for Zabbix 3.0"
|
||
|
set_fact:
|
||
|
apache_log: apache2
|
||
|
datafiles_path: /usr/share/doc/zabbix-server-{{ database_type }}
|
||
|
when: zabbix_version >= 3.0
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
- config
|
||
|
|
||
|
- name: "Debian | Installing repository Debian"
|
||
|
apt_repository: repo="deb http://repo.zabbix.com/zabbix/{{ zabbix_version }}/debian/ {{ ansible_distribution_release }} main"
|
||
|
state=present
|
||
|
when: ansible_distribution == "Debian" and zabbix_repo == "zabbix"
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
- config
|
||
|
|
||
|
- name: "Debian | Installing repository Debian"
|
||
|
apt_repository: repo="deb-src http://repo.zabbix.com/zabbix/{{ zabbix_version }}/debian/ {{ ansible_distribution_release }} main"
|
||
|
state=present
|
||
|
when: ansible_distribution == "Debian" and zabbix_repo == "zabbix"
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
- config
|
||
|
|
||
|
- name: "Debian | Installing repository Ubuntu"
|
||
|
apt_repository: repo="deb http://repo.zabbix.com/zabbix/{{ zabbix_version }}/ubuntu/ {{ ansible_distribution_release }} main"
|
||
|
state=present
|
||
|
when: ansible_distribution == "Ubuntu" and zabbix_repo == "zabbix"
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
- config
|
||
|
|
||
|
- name: "Debian | Installing repository Ubuntu"
|
||
|
apt_repository: repo="deb-src http://repo.zabbix.com/zabbix/{{ zabbix_version }}/ubuntu/ {{ ansible_distribution_release }} main"
|
||
|
state=present
|
||
|
when: ansible_distribution == "Ubuntu" and zabbix_repo == "zabbix"
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
- config
|
||
|
|
||
|
- name: "Debian | Install gpg key"
|
||
|
apt_key: id=79EA5ED4
|
||
|
url=http://repo.zabbix.com/zabbix-official-repo.key
|
||
|
when: zabbix_repo == "zabbix"
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
- config
|
||
|
|
||
|
- name: "Debian | Installing zabbix-server-{{ database_type }}"
|
||
|
apt: pkg=zabbix-server-{{ database_type }}
|
||
|
state=present
|
||
|
update_cache=yes
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
|
||
|
- name: "Debian | Installing zabbix-clients"
|
||
|
apt: pkg={{ item }}
|
||
|
state=present
|
||
|
update_cache=yes
|
||
|
with_items:
|
||
|
- zabbix-agent
|
||
|
- zabbix-get
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
|
||
|
- name: "Debian | Install php7.0-{{ database_type }}"
|
||
|
apt: pkg=php7.0-{{ database_type }}
|
||
|
state=present
|
||
|
update_cache=yes
|
||
|
cache_valid_time=3600
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
|
||
|
- name: "Debian | Install php requisites"
|
||
|
apt: pkg={{ item }}
|
||
|
state=present
|
||
|
update_cache=yes
|
||
|
cache_valid_time=3600
|
||
|
with_items:
|
||
|
- php-bcmath
|
||
|
- php-mbstring
|
||
|
- php-xml
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
|
||
|
- name: "Debian | Install zabbix-web"
|
||
|
apt: pkg=zabbix-frontend-php
|
||
|
state=present
|
||
|
update_cache=yes
|
||
|
cache_valid_time=3600
|
||
|
when: zabbix_web
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
- config
|
||
|
|
||
|
- name: "Debian | install apache vhost"
|
||
|
template: src=apache_vhost.conf.j2
|
||
|
dest=/etc/zabbix/apache.conf
|
||
|
owner=root
|
||
|
group=root
|
||
|
mode=0644
|
||
|
when: zabbix_vhost and zabbix_web
|
||
|
notify: restart apache
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
- config
|
||
|
- apache
|
||
|
|
||
|
- name: "Debian | Install Ansible module dependencies"
|
||
|
apt: name=python-psycopg2
|
||
|
state=present
|
||
|
when: zabbix_database_creation
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
|
||
|
#- name: "Debian | Install Mysql Client package"
|
||
|
# apt: name={{ item }}
|
||
|
# state=present
|
||
|
# with_items:
|
||
|
# - mysql-client
|
||
|
# - MySQL-python
|
||
|
# when: database_type == 'mysql' and ansible_distribution == "Debian"
|
||
|
# tags:
|
||
|
# - zabbix-server
|
||
|
# - init
|
||
|
# - database
|
||
|
|
||
|
- name: "Debian | Install Mysql Client package"
|
||
|
apt: name={{ item }}
|
||
|
state=present
|
||
|
with_items:
|
||
|
- mysql-client
|
||
|
- python-mysqldb
|
||
|
when: database_type == 'mysql'
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
- database
|
||
|
|
||
|
- name: "Debian | Install PostgreSQL Client package"
|
||
|
apt: name=postgresql state=present
|
||
|
when: database_type == 'pgsql'
|
||
|
tags:
|
||
|
- zabbix-server
|
||
|
- init
|
||
|
- database
|