dj-wasabi / ansible-zabbix-web Goto Github PK
View Code? Open in Web Editor NEWInstalling and maintaining zabbix-web for RedHat/Debian/Ubuntu.
Home Page: https://galaxy.ansible.com/dj-wasabi/zabbix-web/
License: MIT License
Installing and maintaining zabbix-web for RedHat/Debian/Ubuntu.
Home Page: https://galaxy.ansible.com/dj-wasabi/zabbix-web/
License: MIT License
Describe the bug
On Debian 9.9 with PIP installed Ansible version 2.8.1,
when i' run this playbook:
playbook.yml
---
- hosts: zabbix-front
become: yes
vars_files:
- zabbix-web.yml
roles:
- { role: dj-wasabi.zabbix-web }
zabbix-web.yml
zabbix_server_database: mysql
zabbix_server_database_long: mysql
like this : ansible-playbook playbook.yml
I have this output :
TASK [dj-wasabi.zabbix-web : Debian | Install php5-mysql] *********************************************************************************************************************************************
fatal: [zbxhost]: FAILED! => {"changed": false, "msg": "No package matching 'php5-mysql' is available"
Installation method/version
ansible-galaxy install dj-wasabi.zabbix-web
Ansible Version
ansible 2.8.1
config file = None
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.13 (default, Sep 26 2018, 18:42:22) [GCC 6.3.0 20170516
Targetted hosts
Expected behavior
TASK [dj-wasabi.zabbix-web : Debian | Install php5-mysql] ***************************************************************************************************************************************
stripping: [zbxhost]TASK [dj-wasabi.zabbix-web : Debian | Install php7-mysql] ***************************************************************************************************************************************
changed: [zbxhost]
Additional context
Juste replace in /roles/dj-wasabi.zabbix-web/tasks/Debian.yml
- name: "Debian | Install php5-{{ zabbix_server_database }}"
apt:
pkg: php5-{{ zabbix_server_database }}
state: present
update_cache: yes
cache_valid_time: 3600
when: >
( ansible_distribution == 'Ubuntu' and (ansible_distribution_version is version_compare('16.04', '<')))
or ( ansible_distribution == 'Debian' and (ansible_distribution_version is version_compare('9.0', '<')) )
tags:
- zabbix-web
- init
- name: "Ubuntu | Install php7-{{ zabbix_server_database }}"
apt:
pkg: "{{ ubuntu_packages }}"
state: present
update_cache: yes
cache_valid_time: 3600
when: >
( ansible_distribution == 'Ubuntu' and (ansible_distribution_version is version_compare('16.04', '>=')))
or ( ansible_distribution == 'Debian' and (ansible_distribution_version is version_compare('9.0', '>=')) )
tags:
- zabbix-server
- init
by the following :
- name: "Debian/Ubuntu | Install php5-{{ zabbix_server_database }}"
apt:
pkg: "php5-{{ zabbix_server_database }}"
state: present
update_cache: yes
cache_valid_time: 3600
when: >
( ansible_distribution == 'Ubuntu' and (ansible_distribution_version is version_compare('16.04', '<')))
or ( ansible_distribution == 'Debian' and (ansible_distribution_major_version is version_compare('9', '<')) )
tags:
- zabbix-web
- init
- name: "Debian/Ubuntu | Install php7-{{ zabbix_server_database }}"
apt:
#pkg: "{{ ubuntu_packages }}"
pkg: "php-{{ zabbix_server_database }}"
state: present
update_cache: yes
cache_valid_time: 3600
when: >
( ansible_distribution == 'Ubuntu' and (ansible_distribution_version is version_compare('16.04', '>=')))
or ( ansible_distribution == 'Debian' and (ansible_distribution_major_version is version_compare('9', '>=')) )
tags:
- zabbix-server
- init
And it's Works
I think you should add check mode option for this step:
dj-wasabi.zabbix-web : Get Apache version
At present during dry run we get:
TASK [dj-wasabi.zabbix-web : Get Apache version] *******************************
skipping: [opsv0011]
TASK [dj-wasabi.zabbix-web : Set correct apache_version] ***********************
fatal: [opsv0011]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'stdout'\n\nThe error appears to have been in '/var/lib/awx/projects/_21__common_master104645/roles/dj-wasabi.zabbix-web/tasks/main.yml': line 20, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: "Set correct apache_version"\n ^ here\n"}
Check this out: https://docs.ansible.com/ansible/latest/user_guide/playbooks_checkmode.html
Describe the bug
Role always remove default /etc/apache2/conf-available/zabbix.conf
config on Debian
even user do not want to install vhost for zabbix
Installation method/version
Ansible Version
2.8
Targetted hosts
Expected behavior
Role should not remove default conf-xxx/Zabbix.conf
when User do not want to install vhost conf
Possible solution
--- apache_Debian_old.yml Thu Jun 25 09:29:00 2019
+++ apache_Debian.yml Wed Jun 26 15:19:40 2019
@@ -27,6 +27,7 @@
file:
path: "{{ item }}"
state: absent
+ when: zabbix_vhost
with_items:
- /etc/apache2/conf-available/zabbix.conf
- /etc/apache2/conf-enabled/zabbix.conf
but may be the role configuration should be like
zabbix_apache_config_style: vhost | conf | skip
Is your feature request related to a problem? Please describe.
<VirtualHost *:80>
I'd like to change an asterisk to ip
Describe the solution you'd like
Ability to set IP interface to listen on.
Hi @dj-wasabi,
I'm experiencing some troubles when i install over Debian 9x. The first try stops with this error:
MODULE FAILURE
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: apt.cache.FetchFailedException: W:GPG error: http://repo.zabbix.com/zabbix/3.4/debian stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 082AB56BA14FE591, E:The repository 'http://repo.zabbix.com/zabbix/3.4/debian stretch InRelease' is not signed.
failed: [35.227.67.118] (item=deb) => {
"changed": false,
"item": "deb",
"module_stderr": "Traceback (most recent call last):\n File "/tmp/ansible_ukaNXF/ansible_module_apt_repository.py", line 556, in \n main()\n File "/tmp/ansible_ukaNXF/ansible_module_apt_repository.py", line 544, in main\n cache.update()\n File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 464, in update\n raise FetchFailedException(e)\napt.cache.FetchFailedException: W:GPG error: http://repo.zabbix.com/zabbix/3.4/debian stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 082AB56BA14FE591, E:The repository 'http://repo.zabbix.com/zabbix/3.4/debian stretch InRelease' is not signed.\n",
"module_stdout": "",
"rc": 1
}
If i try a second time, does not stop at this step, but when you are doing operations with APT over shell shows the same warning.
So, my fix for this problem are the next:
name: "Debian | Install gpg key"
apt_key:
keyserver: keyserver.ubuntu.com
id: 082AB56BA14FE591
state: present
when:
- zabbix_repo == "zabbix"
tags:- zabbix-server
- init
- config
name: "Debian | Installing repository {{ ansible_distribution }}"
apt_repository:
repo: "{{ item }} http://repo.zabbix.com/zabbix/{{ zabbix_version }}/{{ ansible_distribution.lower() }}/ {{ ansible_distribution_release }} main"
state: present
when:
- zabbix_repo == "zabbix"
with_items:- deb-src
- deb
tags:- zabbix-server
- init
- config
As you can see, i removed the sign keys from Zabbix and replaced with the Ubuntu keyserver and now i can run the first run without any errors.
Do you suggest another workaround for this problem?
Describe the bug
There are some php_value parameters set in the file /etc/httpd/conf.d/zabbix.conf
Apache 2.4.37 (centos 8) doesn't accept that and this should therefore be placed in the php-fpm pool instead.
This is the output from systemctl, when trying to start httpd:
Feb 24 12:47:02 psg1-zabbix-001.local systemd[1]: Starting The Apache HTTP Server...
Feb 24 12:47:02 psg1-zabbix-001.local httpd[8975]: AH00526: Syntax error on line 41 of /etc/httpd/conf.d/zabbix.conf:
Feb 24 12:47:02 psg1-zabbix-001.local httpd[8975]: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
Feb 24 12:47:02 psg1-zabbix-001.local systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
Feb 24 12:47:02 psg1-zabbix-001.local systemd[1]: httpd.service: Failed with result 'exit-code'.
Feb 24 12:47:02 psg1-zabbix-001.local systemd[1]: Failed to start The Apache HTTP Server.
Installation method/version
Ansible Version
ansible 2.9.3
config file = /etc/ansible/ansible.cfg
configured module search path = ['/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]
Targetted hosts
Concerns the following OS(es):
Expected behavior
We should place the php_value things in php-fpm pool instead.. Example here:
php_value[max_execution_time] = 300
php_value[memory_limit] = 128M
php_value[post_max_size] = 16M
php_value[upload_max_filesize] = 2M
php_value[max_input_time] = 300
php_value[max_input_vars] = 10000
php_value[date.timezone] = Europe/Stockholm
Additional context
Describe the bug
I'm trying to upgrade my current zabbix server from 3.4.11 to 4.0. When using this role, I notice the following task doesn't upgrade my zabbix-web-mysql package:
- name: "RedHat | Install zabbix-web-{{ zabbix_server_database }}"
yum:
pkg: zabbix-web-{{ zabbix_server_database }}
state: present
tags:
- zabbix-web
As a result, zabbix server service successfully starts, but there becomes a database error. Specifically, from the WebUI you get The frontend does not match Zabbix database
.
Installation method/version
Ansible Version
Targetted hosts
Concerns the following OS(es):
Expected behavior
At the completion of the role, zabbix server should successfully be able to access database.
Additional context
To validate, after manually installing the latest zabbix-web-mysql package, I'm successfully able to access Zabbix Web UI.
Hi,
Thanks for the awesome library of roles you have done.
I am quite new to Ansible and looking forward to learn while I improve my systems.
Describe the bug
When trying to use this role to deploy a deploy a zabbix server+zabbix web frontend I get an error running the TASK: postgresql | create database...
The weird thing is I configured the role to use mysql not postgresql at all.
Does postgresql need to be installed and configured for me to use this role?
Installation method/version
Ansible Version
ansible 2.6.2
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/marco/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609]
Targetted hosts
Concerns the following OS(es):
marco@zabbix-djwasabi:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
Expected behavior
I expect zabbix to get provisioned on the target machine using mysql, not postgresql, I was hoping the postgrep bit to be skipped.
Additional context
here is my playbook
- hosts: all
become: yes
roles:
- { role: geerlingguy.apache }
- { role: dj-wasabi.zabbix-server, zabbix_server_database_type: mysql, zabbix_server_database_type_long: mysql, zabbix_server_dbport: 3306 }
- { role: dj-wasabi.zabbix-web, zabbix_url: monitoring.marco.com, zabbix_server_database_type: mysql, zabbix_server_database_type_long: mysql, zabbix_server_dbport: 3306, zabbix_server_dbuser: root, zabbix_server_dbpassword: super-secure-password }
here is the -vvv output of the task failing
TASK [dj-wasabi.zabbix-server : PostgreSQL | Delegated | Create database] **********
task path: /home/marco/.ansible/roles/dj-wasabi.zabbix-server/tasks/postgresql.yml:10
<192.168.0.67> ESTABLISH SSH CONNECTION FOR USER: None
<192.168.0.67> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/marco/.ansible/cp/1ed75950e5 192.168.0.67 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<192.168.0.67> (0, '/home/marco\n', '')
<192.168.0.67> ESTABLISH SSH CONNECTION FOR USER: None
<192.168.0.67> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/marco/.ansible/cp/1ed75950e5 192.168.0.67 '/bin/sh -c '"'"'( umask 77 && mkdir -p "echo /var/tmp/ansible-tmp-1547164926.76-214840398311343
" && echo ansible-tmp-1547164926.76-214840398311343="echo /var/tmp/ansible-tmp-1547164926.76-214840398311343
" ) && sleep 0'"'"''
<192.168.0.67> (0, 'ansible-tmp-1547164926.76-214840398311343=/var/tmp/ansible-tmp-1547164926.76-214840398311343\n', '')
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/database/postgresql/postgresql_db.py
<192.168.0.67> PUT /home/marco/.ansible/tmp/ansible-local-3425CZuHTn/tmpujrhUs TO /var/tmp/ansible-tmp-1547164926.76-214840398311343/postgresql_db.py
<192.168.0.67> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/marco/.ansible/cp/1ed75950e5 '[192.168.0.67]'
<192.168.0.67> (0, 'sftp> put /home/marco/.ansible/tmp/ansible-local-3425CZuHTn/tmpujrhUs /var/tmp/ansible-tmp-1547164926.76-214840398311343/postgresql_db.py\n', '')
<192.168.0.67> ESTABLISH SSH CONNECTION FOR USER: None
<192.168.0.67> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/marco/.ansible/cp/1ed75950e5 192.168.0.67 '/bin/sh -c '"'"'setfacl -m u:postgres:r-x /var/tmp/ansible-tmp-1547164926.76-214840398311343/ /var/tmp/ansible-tmp-1547164926.76-214840398311343/postgresql_db.py && sleep 0'"'"''
<192.168.0.67> (0, '', '')
<192.168.0.67> ESTABLISH SSH CONNECTION FOR USER: None
<192.168.0.67> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/marco/.ansible/cp/1ed75950e5 -tt 192.168.0.67 '/bin/sh -c '"'"'sudo -H -S -p "[sudo via ansible, key=nnxudphfmqmhngmwlwyzvlqktbdvmgnq] password: " -u postgres /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-nnxudphfmqmhngmwlwyzvlqktbdvmgnq; /usr/bin/python /var/tmp/ansible-tmp-1547164926.76-214840398311343/postgresql_db.py'"'"'"'"'"'"'"'"' && sleep 0'"'"''
Escalation succeeded
<192.168.0.67> (1, '\r\n\r\n\r\n{"msg": "unable to connect to database: could not connect to server: No such file or directory\n\tIs the server running locally and accepting\n\tconnections on Unix domain socket \"/var/run/postgresql/.s.PGSQL.3306\"?\n", "failed": true, "exception": "Traceback (most recent call last):\n File \"/tmp/ansible_MDHVwW/ansible_module_postgresql_db.py\", line 421, in main\n db_connection = psycopg2.connect(database=maintenance_db, **kw)\n File \"/usr/lib/python2.7/dist-packages/psycopg2/init.py\", line 130, in connect\n conn = _connect(dsn, connection_factory=connection_factory, **kwasync)\nOperationalError: could not connect to server: No such file or directory\n\tIs the server running locally and accepting\n\tconnections on Unix domain socket \"/var/run/postgresql/.s.PGSQL.3306\"?\n\n", "invocation": {"module_args": {"ssl_rootcert": null, "ssl_mode": "prefer", "target": "", "lc_collate": "", "encoding": "", "login_user": "postgres", "login_host": "", "target_opts": "", "db": "zabbix-server", "lc_ctype": "", "maintenance_db": "postgres", "login_unix_socket": "", "state": "present", "template": "", "login_password": "", "owner": "", "port": 3306, "name": "zabbix-server"}}}\r\n', 'Shared connection to 192.168.0.67 closed.\r\n')
<192.168.0.67> ESTABLISH SSH CONNECTION FOR USER: None
<192.168.0.67> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/marco/.ansible/cp/1ed75950e5 192.168.0.67 '/bin/sh -c '"'"'rm -f -r /var/tmp/ansible-tmp-1547164926.76-214840398311343/ > /dev/null 2>&1 && sleep 0'"'"''
<192.168.0.67> (0, '', '')
The full traceback is:
Traceback (most recent call last):
File "/tmp/ansible_MDHVwW/ansible_module_postgresql_db.py", line 421, in main
db_connection = psycopg2.connect(database=maintenance_db, **kw)
File "/usr/lib/python2.7/dist-packages/psycopg2/init.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.3306"?fatal: [192.168.0.67 -> 192.168.0.67]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"db": "zabbix-server",
"encoding": "",
"lc_collate": "",
"lc_ctype": "",
"login_host": "",
"login_password": "",
"login_unix_socket": "",
"login_user": "postgres",
"maintenance_db": "postgres",
"name": "zabbix-server",
"owner": "",
"port": 3306,
"ssl_mode": "prefer",
"ssl_rootcert": null,
"state": "present",
"target": "",
"target_opts": "",
"template": ""
}
},
"msg": "unable to connect to database: could not connect to server: No such file or directory\n\tIs the server running locally and accepting\n\tconnections on Unix domain socket "/var/run/postgresql/.s.PGSQL.3306"?\n"
}
to retry, use: --limit @/home/marco/ansible-playbooks/zabbix/zabbix-djwasabi/site.retryPLAY RECAP *************************************************************************
192.168.0.67 : ok=26 changed=0 unreachable=0 failed=1
but of course this is expected to fail as not configured, I would expect this task to be skipped.
@dj-wasabi We like your work here and want to contribute ๐ Instead of ending up like so often writing an own one we rather like to enrich this role. First we like to make the Apache usage optional for getting internally rid of it's role dependency but keep it as default for compatibility. Will send you the PR later ...
ok: [vagrant-cms-zabbix.cyclops]
TASK [dj-wasabi.zabbix-web : RedHat | Install basic repo file] *********************************************************************************
ok: [vagrant-cms-zabbix.cyclops] => (item={u'description': u'Zabbix Official Repository - $basearch', u'gpgkey': u'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX', u'baseurl': u'http://repo.zabbix.com/zabbix/3.2/rhel/7/$basearch/', u'state': u'present', u'gpgcheck': 0, u'name': u'zabbix'})
changed: [vagrant-cms-zabbix.cyclops] => (item={u'description': u'Zabbix Official Repository non-supported - $basearch', u'gpgkey': u'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX', u'baseurl': u'http://repo.zabbix.com/non-supported/rhel/7/$basearch/', u'state': u'present', u'gpgcheck': 0, u'name': u'zabbix'})
TASK [dj-wasabi.zabbix-web : RedHat | Install zabbix-web-mysql] ********************************************************************************
fatal: [vagrant-cms-zabbix.cyclops]: FAILED! => {"changed": true, "failed": true, "msg": "http://repo.zabbix.com/non-supported/rhel/7/x86_64/zabbix-web-3.2.7-1.el7.noarch.rpm: [Errno 14] HTTP Error 404 - Not Found\nTrying other mirror.\nTo address this issue please refer to the below knowledge base article \n\nhttps://access.redhat.com/articles/1320623\n\nIf above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/\n\nhttp://repo.zabbix.com/non-supported/rhel/7/x86_64/zabbix-web-mysql-3.2.7-1.el7.noarch.rpm: [Errno 14] HTTP Error 404 - Not Found\nTrying other mirror.\n\n\nError downloading packages:\n zabbix-web-3.2.7-1.el7.noarch: [Errno 256] No more mirrors to try.\n zabbix-web-mysql-3.2.7-1.el7.noarch: [Errno 256] No more mirrors to try.\n\n", "rc": 1, "results": ["Loaded plugins: fastestmirror\nLoading mirror speeds from cached hostfile\n * base: mirror.cogentco.com\n * epel: mirror.oss.ou.edu\n * extras: mirror.tzulo.com\n * updates: denver.gaminghost.co\nResolving Dependencies\n--> Running transaction check\n---> Package zabbix-web-mysql.noarch 0:3.2.7-1.el7 will be installed\n--> Processing Dependency: zabbix-web = 3.2.7-1.el7 for package: zabbix-web-mysql-3.2.7-1.el7.noarch\n--> Processing Dependency: php-mysql for package: zabbix-web-mysql-3.2.7-1.el7.noarch\n--> Running transaction check\n---> Package php-mysql.x86_64 0:5.4.16-42.el7 will be installed\n--> Processing Dependency: php-pdo(x86-64) = 5.4.16-42.el7 for package: php-mysql-5.4.16-42.el7.x86_64\n---> Package zabbix-web.noarch 0:3.2.7-1.el7 will be installed\n--> Processing Dependency: php >= 5.4 for package: zabbix-web-3.2.7-1.el7.noarch\n--> Processing Dependency: php-gd for package: zabbix-web-3.2.7-1.el7.noarch\n--> Processing Dependency: php-mbstring for package: zabbix-web-3.2.7-1.el7.noarch\n--> Processing Dependency: dejavu-sans-fonts for package: zabbix-web-3.2.7-1.el7.noarch\n--> Processing Dependency: php-bcmath for package: zabbix-web-3.2.7-1.el7.noarch\n--> Processing Dependency: php-xml for package: zabbix-web-3.2.7-1.el7.noarch\n--> Processing Dependency: php-ldap for package: zabbix-web-3.2.7-1.el7.noarch\n--> Running transaction check\n---> Package dejavu-sans-fonts.noarch 0:2.33-6.el7 will be installed\n---> Package php.x86_64 0:5.4.16-42.el7 will be installed\n--> Processing Dependency: php-common(x86-64) = 5.4.16-42.el7 for package: php-5.4.16-42.el7.x86_64\n--> Processing Dependency: php-cli(x86-64) = 5.4.16-42.el7 for package: php-5.4.16-42.el7.x86_64\n---> Package php-bcmath.x86_64 0:5.4.16-42.el7 will be installed\n---> Package php-gd.x86_64 0:5.4.16-42.el7 will be installed\n--> Processing Dependency: libt1.so.5()(64bit) for package: php-gd-5.4.16-42.el7.x86_64\n---> Package php-ldap.x86_64 0:5.4.16-42.el7 will be installed\n---> Package php-mbstring.x86_64 0:5.4.16-42.el7 will be installed\n---> Package php-pdo.x86_64 0:5.4.16-42.el7 will be installed\n---> Package php-xml.x86_64 0:5.4.16-42.el7 will be installed\n--> Running transaction check\n---> Package php-cli.x86_64 0:5.4.16-42.el7 will be installed\n---> Package php-common.x86_64 0:5.4.16-42.el7 will be installed\n--> Processing Dependency: libzip.so.2()(64bit) for package: php-common-5.4.16-42.el7.x86_64\n---> Package t1lib.x86_64 0:5.1.2-14.el7 will be installed\n--> Running transaction check\n---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package Arch Version Repository Size\n================================================================================\nInstalling:\n zabbix-web-mysql noarch 3.2.7-1.el7 zabbix 5.8 k\nInstalling for dependencies:\n dejavu-sans-fonts noarch 2.33-6.el7 base 1.4 M\n libzip x86_64 0.10.1-8.el7 base 48 k\n php x86_64 5.4.16-42.el7 base 1.4 M\n php-bcmath x86_64 5.4.16-42.el7 base 57 k\n php-cli x86_64 5.4.16-42.el7 base 2.7 M\n php-common x86_64 5.4.16-42.el7 base 564 k\n php-gd x86_64 5.4.16-42.el7 base 127 k\n php-ldap x86_64 5.4.16-42.el7 base 52 k\n php-mbstring x86_64 5.4.16-42.el7 base 505 k\n php-mysql x86_64 5.4.16-42.el7 base 101 k\n php-pdo x86_64 5.4.16-42.el7 base 98 k\n php-xml x86_64 5.4.16-42.el7 base 125 k\n t1lib x86_64 5.1.2-14.el7 base 166 k\n zabbix-web noarch 3.2.7-1.el7 zabbix 3.7 M\n\nTransaction Summary\n================================================================================\nInstall 1 Package (+14 Dependent packages)\n\nTotal download size: 11 M\nInstalled size: 57 M\nDownloading packages:\n"]}```
On Ubuntu 18.04 PHP 7.0 is not shipped by default. The new default version is PHP 7.2.
This leads to the follwing problem:
TASK [dj-wasabi.zabbix-web : Ubuntu | Install php7-mysql] *****************************************************************************
[DEPRECATION WARNING]: Using tests as filters is deprecated. Instead of using `result|version_compare` instead use `result is
version_compare`. This feature will be removed in version 2.9. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
failed: [HOSTNAME] (item=[u'libapache2-mod-php7.0', u'php7.0-bcmath', u'php7.0-mbstring', u'php7.0-ldap', u'php7.0-mysql', u'php7.0-xml']) => {"changed": false, "item": ["libapache2-mod-php7.0", "php7.0-bcmath", "php7.0-mbstring", "php7.0-ldap", "php7.0-mysql", "php7.0-xml"],
"msg": "No package matching 'libapache2-mod-php7.0' is available"}
Available packages are libapache2-mod-php
and libapache2-mod-php7.2
.
Hi!
I suggest add variable zabbix_install_php
which can be set to false
. Some servers already have php installed (for example, with ansible role geerlingguy.php). I had php7.1 installed and running, and after installing zabbix-web, I had to manually remove php7.0 packages.
Updated: actually, I'm only trying to remove 7.0 packages. It is now a mess. Removing any php-7.0 package with apt-get
suggests to upgrade php to 7.2. This is annoying. And I can't remove them with dpkg
because "dependency problems prevent removal of ..."
Describe the bug
When everything completes, ansible playbook script is successful, it appears that the apache.conf file is not placed correctly inside the conf-enabled folder. When we copy the apache.conf from /etc/zabbix to /etc/apache2/conf-enabled it functions correctly. Version 1.3 worked correctly and it looks like the commit on Feb 02, 2019 broke this.
I understand that the zabbix.conf file in the sites-enabled directory is supposed to make it function, but from what I can tell that file does nothing...not sure why.
Installation method/version
Latest version as of 02/25/2019
Ansible Version
ansible 2.5.1
config file = /home/adminlocal/zabbix-server.playbook/ansible.cfg
configured module search path = [u'/home/adminlocal/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
Targetted hosts
Concerns the following OS(es):
Expected behavior
Install Zabbix with Apache, PGSQL and an agent installed on target
Additional context
Web Error:
Not Found
The requested URL /zabbix was not found on this server.
Apache/2.4.18 (Ubuntu) Server at 192.168.122.209 Port 80
Ansible Playbook
- hosts: zabbix-server
become: yes
roles:
- { role: postgresql}
- { role: apache }
- { role: zabbix-server, zabbix_server_database_type: pgsql, zabbix_server_database_type_long: postgresql, zabbix_server_dbport: 5432 }
- { role: zabbix-web, zabbix_url: superserver.secmet.co, zabbix_server_database_type: pgsql, zabbix_server_database_type_long: postgresql, zabbix_server_dbport: 5432, zabbix_timezone: America/Denver}
- { role: zabbix-agent, zabbix_agent_become_on_localhost: False}
Describe the bug
The template for apache_vhost contains SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog
This seems to be a default setting, however this does not exists on my Ubuntu 18.04.
If I remove this line in the template, all works fine.
Installation method/version
Ansible Version
ansible 2.6.1
Targetted hosts
Concerns the following OS(es):
Expected behavior
When TLS enabled for zabbix web, I expected it to work with default settings, when cert and key path has been applied.
Additional context
Using certbot to generate SSL certificates
Server version: Apache/2.4.29 (Ubuntu)
Server built: 2018-06-07T21:10:10
Server's Module Magic Number: 20120211:68
Server loaded: APR 1.6.3, APR-UTIL 1.6.1
Compiled using: APR 1.6.3, APR-UTIL 1.6.1
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/etc/apache2"
-D SUEXEC_BIN="/usr/lib/apache2/suexec"
-D DEFAULT_PIDLOG="/var/run/apache2.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="mime.types"
-D SERVER_CONFIG_FILE="apache2.conf"
Is your feature request related to a problem? Please describe.
yes. I updated zabbix-server version 4.2 -> 4.4, but dj-wasabi/ansible-zabbix-web did not yet support 4.4.
Describe the solution you'd like
dj-wasabi/ansible-zabbix-{server, agent, proxy} already supported 4.4.
is dj-wasabi/ansible-zabbix-web plannning to support zabbix 4.4?
Some setups are in need of some environment variables in the php context.
I suppose inserting them via templating using the variables zabbix_web_env
For example:
zabbix_web_env:
LDAPTLS_CACERT: /etc/ssl/certs/ourcert.pem
resulting in this entry in zabbix.conf.php
putenv("LDAPTLS_CACERT=/etc/ssl/certs/ourcert.pem")
Pull request coming.
So, I'm running Apache 2.4 (installed only using zabbix-server/zabbix-web roles, on master
branch). But for some reason, when my vhost template gets set, it doesn't think it's actually running 2.4, because it has Allow from all
instead of Require all granted
.
# apachectl -v | grep 'version' | awk -F '/' '{ print $2 }'| awk '{ print $1 }' | cut -c 1-3
2.4
TASK [dj-wasabi.zabbix-web : Get Apache version] **********************************************************************************************************************************************************************
ok: [lab-zabbix.rogue] => {"changed": false, "cmd": "apachectl -v | grep 'version' | awk -F '/' '{ print $2 }'| awk '{ print $1 }' | cut -c 1-3", "delta": "0:00:00.009662", "end": "2017-08-28 20:18:15.502167", "rc": 0, "start": "2017-08-28 20:18:15.492505", "stderr": "/bin/sh: apachectl: command not found", "stderr_lines": ["/bin/sh: apachectl: command not found"], "stdout": "", "stdout_lines": []}
playbook.yml
- hosts: all
become: yes
roles:
- { role: anxs.postgresql}
- { role: dj-wasabi.zabbix-server }
- { role: dj-wasabi.zabbix-web }
- { role: dj-wasabi.zabbix-agent }
TASK [dj-wasabi.zabbix-web : RedHat | Install zabbix-web-pgsql] ****************
fatal: [zabbix]: FAILED! => {"changed": false, "msg": "http://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-web-4.2.4-1.el7.noarch.rpm: [Errno 14] curl#18 - \"transfer closed with 1167213 bytes remaining to read\"\nTrying other mirror.\n\n\nError downloading packages:\n zabbix-web-4.2.4-1.el7.noarch: [Errno 256] No more mirrors to try.\n\n", "rc": 1, "results": ["Loaded plugins: fastestmirror\nLoading mirror speeds from cached hostfile\n * base: mirror.corbina.net\n * epel: mirror.linux-ia64.org\n * extras: mirror.linux-ia64.org\n * updates: mirror.linux-ia64.org\nResolving Dependencies\n--> Running transaction check\n---> Package zabbix-web-pgsql.noarch 0:4.2.4-1.el7 will be installed\n--> Processing Dependency: zabbix-web = 4.2.4-1.el7 for package: zabbix-web-pgsql-4.2.4-1.el7.noarch\n--> Processing Dependency: php-pgsql for package: zabbix-web-pgsql-4.2.4-1.el7.noarch\n--> Running transaction check\n---> Package php-pgsql.x86_64 0:5.4.16-46.el7 will be installed\n--> Processing Dependency: php-pdo(x86-64) = 5.4.16-46.el7 for package: php-pgsql-5.4.16-46.el7.x86_64\n---> Package zabbix-web.noarch 0:4.2.4-1.el7 will be installed\n--> Processing Dependency: php >= 5.4 for package: zabbix-web-4.2.4-1.el7.noarch\n--> Processing Dependency: php-gd for package: zabbix-web-4.2.4-1.el7.noarch\n--> Processing Dependency: php-mbstring for package: zabbix-web-4.2.4-1.el7.noarch\n--> Processing Dependency: dejavu-sans-fonts for package: zabbix-web-4.2.4-1.el7.noarch\n--> Processing Dependency: php-bcmath for package: zabbix-web-4.2.4-1.el7.noarch\n--> Processing Dependency: php-ldap for package: zabbix-web-4.2.4-1.el7.noarch\n--> Processing Dependency: php-xml for package: zabbix-web-4.2.4-1.el7.noarch\n--> Running transaction check\n---> Package dejavu-sans-fonts.noarch 0:2.33-6.el7 will be installed\n--> Processing Dependency: dejavu-fonts-common = 2.33-6.el7 for package: dejavu-sans-fonts-2.33-6.el7.noarch\n---> Package php.x86_64 0:5.4.16-46.el7 will be installed\n--> Processing Dependency: php-common(x86-64) = 5.4.16-46.el7 for package: php-5.4.16-46.el7.x86_64\n--> Processing Dependency: php-cli(x86-64) = 5.4.16-46.el7 for package: php-5.4.16-46.el7.x86_64\n---> Package php-bcmath.x86_64 0:5.4.16-46.el7 will be installed\n---> Package php-gd.x86_64 0:5.4.16-46.el7 will be installed\n--> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: php-gd-5.4.16-46.el7.x86_64\n--> Processing Dependency: libt1.so.5()(64bit) for package: php-gd-5.4.16-46.el7.x86_64\n--> Processing Dependency: libjpeg.so.62()(64bit) for package: php-gd-5.4.16-46.el7.x86_64\n--> Processing Dependency: libXpm.so.4()(64bit) for package: php-gd-5.4.16-46.el7.x86_64\n--> Processing Dependency: libX11.so.6()(64bit) for package: php-gd-5.4.16-46.el7.x86_64\n---> Package php-ldap.x86_64 0:5.4.16-46.el7 will be installed\n---> Package php-mbstring.x86_64 0:5.4.16-46.el7 will be installed\n---> Package php-pdo.x86_64 0:5.4.16-46.el7 will be installed\n---> Package php-xml.x86_64 0:5.4.16-46.el7 will be installed\n--> Running transaction check\n---> Package dejavu-fonts-common.noarch 0:2.33-6.el7 will be installed\n--> Processing Dependency: fontpackages-filesystem for package: dejavu-fonts-common-2.33-6.el7.noarch\n---> Package libX11.x86_64 0:1.6.5-2.el7 will be installed\n--> Processing Dependency: libX11-common >= 1.6.5-2.el7 for package: libX11-1.6.5-2.el7.x86_64\n--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.5-2.el7.x86_64\n---> Package libXpm.x86_64 0:3.5.12-1.el7 will be installed\n---> Package libjpeg-turbo.x86_64 0:1.2.90-6.el7 will be installed\n---> Package php-cli.x86_64 0:5.4.16-46.el7 will be installed\n---> Package php-common.x86_64 0:5.4.16-46.el7 will be installed\n--> Processing Dependency: libzip.so.2()(64bit) for package: php-common-5.4.16-46.el7.x86_64\n---> Package t1lib.x86_64 0:5.1.2-14.el7 will be installed\n--> Running transaction check\n---> Package fontpackages-filesystem.noarch 0:1.44-8.el7 will be installed\n---> Package libX11-common.noarch 0:1.6.5-2.el7 will be installed\n---> Package libxcb.x86_64 0:1.13-1.el7 will be installed\n--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.13-1.el7.x86_64\n---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed\n--> Running transaction check\n---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package Arch Version Repository Size\n================================================================================\nInstalling:\n zabbix-web-pgsql noarch 4.2.4-1.el7 zabbix 9.0 k\nInstalling for dependencies:\n dejavu-fonts-common noarch 2.33-6.el7 base 64 k\n dejavu-sans-fonts noarch 2.33-6.el7 base 1.4 M\n fontpackages-filesystem noarch 1.44-8.el7 base 9.9 k\n libX11 x86_64 1.6.5-2.el7 base 606 k\n libX11-common noarch 1.6.5-2.el7 base 164 k\n libXau x86_64 1.0.8-2.1.el7 base 29 k\n libXpm x86_64 3.5.12-1.el7 base 55 k\n libjpeg-turbo x86_64 1.2.90-6.el7 base 134 k\n libxcb x86_64 1.13-1.el7 base 214 k\n libzip x86_64 0.10.1-8.el7 base 48 k\n php x86_64 5.4.16-46.el7 base 1.4 M\n php-bcmath x86_64 5.4.16-46.el7 base 58 k\n php-cli x86_64 5.4.16-46.el7 base 2.7 M\n php-common x86_64 5.4.16-46.el7 base 565 k\n php-gd x86_64 5.4.16-46.el7 base 128 k\n php-ldap x86_64 5.4.16-46.el7 base 53 k\n php-mbstring x86_64 5.4.16-46.el7 base 505 k\n php-pdo x86_64 5.4.16-46.el7 base 99 k\n php-pgsql x86_64 5.4.16-46.el7 base 86 k\n php-xml x86_64 5.4.16-46.el7 base 126 k\n t1lib x86_64 5.1.2-14.el7 base 166 k\n zabbix-web noarch 4.2.4-1.el7 zabbix 2.8 M\n\nTransaction Summary\n================================================================================\nInstall 1 Package (+22 Dependent packages)\n\nTotal download size: 11 M\nInstalled size: 46 M\nDownloading packages:\n"]}
RUNNING HANDLER [anxs.postgresql : restart postgresql] *************************
RUNNING HANDLER [dj-wasabi.zabbix-server : zabbix-server restarted] ************
RUNNING HANDLER [geerlingguy.apache : restart apache] **************************
to retry, use: --limit @/home/user/github/vagrant-ansible-zabbix-server/playbook.retry
PLAY RECAP *********************************************************************
zabbix : ok=58 changed=24 unreachable=0 failed=1
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
The issue is with the task to install php7 on Ubuntu systems. This task should be excluded on Oracle Linux systems which are RedHat based. But the task defines 'with_items: "{{ ubuntu_packages }}"', which ansible must be trying to resolve before it processes the when clause.
I'm pretty new to ansible and I'm not sure how to fix this. For my use case I just removed the task completely because we only use Oracle Linux at work.
Thanks for creating / maintaining these roles.
Describe the bug
If not specified and defaults hits zabbix_server_hostname will be inventory_hostname.
This easily results into a non resolvable $ZBX_SERVER being configured in zabbix.conf.php:
Installation method/version
Ansible Version
ansible 2.8.3
Targetted hosts
Concerns the following OS(es):
Expected behavior
For typical setup with zabbix-server and zabbix-web on the same box /etc/hosts shall be used.
Describe the bug
When installing zabbix-web, setting SELinux flags fails because of a missing Python library.
TASK [dj-wasabi.zabbix-web : Allow httpd to connect to db (SELinux)] ***********
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: No module named semanage
fatal: [zabbix]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (libsemanage-python) on localhost.localdomain's Python /usr/bin/python. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
Installation method/version
The lastest master branch version was downloaded via Ansible Galaxy.
Ansible Version
ansible 2.9.1
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/vagrant/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Apr 9 2019, 14:30:50) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
Targetted hosts
Expected behavior
It would be great if the role automatically installs the missing dependency.
Describe the bug
Create vhost file for apache 2.4 not correct. In apache 2.2 subdirectory deny all but for apache 2.4 subdirectory allow all.
{% for my_path in directory_paths %}
<Directory "{{ my_path }}">
{% if apache_version|string() == '2.4' %}
Require all granted
{% else %}
AllowOverride None
Order Deny,Allow
Deny from all
{% endif %}
</Directory>
Example rules from apache site http://httpd.apache.org/docs/current/upgrading.html
Installation method/version
Ansible Version
ansible 2.7.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/ansible/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Targetted hosts
Concerns the following OS(es):
Expected behavior
{% for my_path in directory_paths %}
<Directory "{{ my_path }}">
{% if apache_version|string() == '2.4' %}
Require all denied
{% else %}
AllowOverride None
Order Deny,Allow
Deny from all
{% endif %}
</Directory>
Require all granted -> Require all denied
Describe the bug
Role examples are incorrect and do not match role parameters
Installation method/version
Describe the bug
Declaring zabbix_timezone
has no effect on apache.conf
file.
Lines remains commented.
Installation method/version
Ansible Version
2.7.6
Targetted hosts
Concerns the following OS(es):
Expected behavior
By default, the line below is commented in /etc/zabbix/apache.conf
# php_value date.timezone Europe/Riga
Declaring zabbix_timezone: America/Fortaleza
for example has no effect. It doesn't change.
Additional context
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.