dj-wasabi / ansible-zabbix-web

Installing and maintaining zabbix-web for RedHat/Debian/Ubuntu.
https://galaxy.ansible.com/dj-wasabi/zabbix-web/
MIT License
25 stars 56 forks source link

php-mysql installation on Debian 9 #57

Closed vhalholl closed 5 years ago

vhalholl commented 5 years ago

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 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