dj-wasabi / ansible-zabbix-agent

Installing and maintaining zabbix-agent for RedHat/Debian/Ubuntu/Windows/Suse.
https://galaxy.ansible.com/dj-wasabi/zabbix-agent
MIT License
327 stars 248 forks source link

No package matching 'zabbix-agent #197

Closed Blufaer closed 4 years ago

Blufaer commented 5 years ago

Describe the bug While running the script, I get an error fatal: [*****]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}

Installation method/version ansible 2.7.5 config file = /home/user/ansible-zabbix-agent/ansible.cfg configured module search path = [u'/home/user/.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]

Github using master

hosts - Ubuntu Debian CentOS

Additional context

playbook 
- hosts: tabak-ht
  become: true
# become_method: sudo
  roles:
   - role: dj-wasabi.zabbix-agent
     zabbix_agent_server: 10.0.0.220
     zabbix_agent_serveractive: 10.0.0.220
     zabbix_agent_package: zabbix-agent
     zabbix_version: 4.0

playbook works well up to a TASK [dj-wasabi.zabbix-agent : Debian | Installing zabbix-agent]

TASK [dj-wasabi.zabbix-agent : Debian | Installing zabbix-agent] *************************************************************************
fatal: [**********]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}
fatal: [**********]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}
fatal: [**********]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}
fatal: [**********]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}
fatal: [**********]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}
fatal: [**********]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}

On Centos i have same problem

if I go to a managed host and see the availability of the packages -

root@**********:~# apt-cache show zabbix-agent
Package: zabbix-agent
Source: zabbix
Version: 1:4.0.3-1+stretch

At the same time using the command ansible -m command -a "apt-get install zabbix-agent -y" hosts Agent setup ok

Log exsample user@***###########:~/ansible-zabbix-agent$ sudo ansible-playbook tabak-ht-playbook.yml --diff

>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name:  *******
> 
>  [WARNING]: Found both group and host with same name:  *******
> 
>  [WARNING]: Found both group and host with same name:*******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
>  [WARNING]: Found both group and host with same name: *******
> 
> 
> PLAY [tabak-ht] **************************************************************************************************************************
> 
> TASK [Gathering Facts] *******************************************************************************************************************
> ok: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Fix facts for linuxmint - distribution release] ***********************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Fix facts for linuxmint - family] *************************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Include OS-specific variables] ****************************************************************************
> ok: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : RedHat | Use EPEL package name] ***************************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : RedHat | Install basic repo file] *************************************************************************
> skipping: [*******] => (item={u'state': u'present', u'description': u'Zabbix Official Repository - $basearch', u'gpgcheck': 0, u'gpgkey': u'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX', u'baseurl': u'http://repo.zabbix.com/zabbix/4.0/rhel/9/$basearch/', u'name': u'zabbix'})
> skipping: [*******] => (item={u'state': u'present', u'description': u'Zabbix Official Repository non-supported - $basearch', u'gpgcheck': 0, u'gpgkey': u'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX', u'baseurl': u'http://repo.zabbix.com/non-supported/rhel/9/$basearch/', u'name': u'zabbix-non-supported'})
> 
> TASK [dj-wasabi.zabbix-agent : Do a yum clean] *******************************************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : RedHat | Installing zabbix-agent] *************************************************************************
> skipping: [*******] => (item=zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get)
> 
> TASK [dj-wasabi.zabbix-agent : RedHat | Installing zabbix-agent] *************************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Install policycoreutils-python] ***************************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : RedHat | Enable the service] ******************************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Include Zabbix gpg ids] ***********************************************************************************
> ok: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Set short version name] ***********************************************************************************
> ok: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Debian | Install gpg key] *********************************************************************************
> ok: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Debian | Installing deb-src repository Ubuntu] ************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Debian | Installing deb repository Debian] ****************************************************************
> ok: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Debian | Installing deb-src repository Debian] ************************************************************
> ok: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Debian | Installing deb repository Ubuntu] ****************************************************************
> skipping: [*******]
> 
> TASK [dj-wasabi.zabbix-agent : Debian | Installing zabbix-agent] *************************************************************************
> fatal: [*******]: FAILED! => {"changed": false, "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"}
>         to retry, use: --limit @/home/user/ansible-zabbix-agent/tabak-ht-playbook.retry
> 
> PLAY RECAP *******************************************************************************************************************************
> *******      : ok=7    changed=0    unreachable=0  
barma1309 commented 5 years ago

what if comment string #zabbix_agent_package: zabbix-agent and package version i don't specify package on playbook and no problem with install package

Blufaer commented 5 years ago

I tried and unfortunately it did not help, but thanks for the help

Blufaer commented 5 years ago

it seems to me that the package manager itself does not work

(1, 'sudo: unable to resolve host ht-msk-kor41-020-svirt-13\r\n\r\n\r\n{"exception": "  File \\"/tmp/ansible_apt_payload_vfq1k9c9/__main__.py\\", line 345, in package_status\\n    pkg = cache[pkgname]\\n  File \\"/usr/lib/python3/dist-packages/apt/cache.py\\", line 233, in __getitem__\\n    raise KeyError(\'The cache has no package named %r\' % key)\\n", "invocation": {"module_args": {"pkg": "zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get", "only_upgrade": false, "cache_valid_time": 0, "upgrade": null, "force_apt_get": false, "purge": false, "default_release": null, "update_cache": true, "force": false, "allow_unauthenticated": false, "autoremove": false, "dpkg_options": "force-confdef,force-confold", "autoclean": false, "package": ["zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get"], "deb": null, "state": "present", "install_recommends": null}}, "msg": "No package matching \'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get\' is available", "failed": true}\r\n', 'Shared connection to 10.0.13.43 closed.\r\n')
<10.0.****> ESTABLISH SSH CONNECTION FOR USER: extadmin
<10.0.****> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o User=extadmin -o ConnectTimeout=40 -o ControlPath=/home/user/.ansible/cp/06110fbc60 10.0.13.43 '/bin/sh -c '"'"'rm -f -r /home/extadmin/.ansible/tmp/ansible-tmp-1547119821.27-136057596517763/ > /dev/null 2>&1 && sleep 0'"'"''
<10.0.1****> (0, '', '')
The full traceback is:
  File "/tmp/ansible_apt_payload_vfq1k9c9/__main__.py", line 345, in package_status
    pkg = cache[pkgname]
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 233, in __getitem__
    raise KeyError('The cache has no package named %r' % key)

fatal: [ht-msk-kor41-020-svirt-13]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "allow_unauthenticated": false,
            "autoclean": false,
            "autoremove": false,
            "cache_valid_time": 0,
            "deb": null,
            "default_release": null,
            "dpkg_options": "force-confdef,force-confold",
            "force": false,
            "force_apt_get": false,
            "install_recommends": null,
            "only_upgrade": false,
            "package": [
                "zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get"
            ],
            "pkg": "zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get",
            "purge": false,
            "state": "present",
            "update_cache": true,
            "upgrade": null
        }
    },
    "msg": "No package matching 'zabbix-agent - zabbix-agent - zabbix-sender - zabbix-get' is available"
}
dj-wasabi commented 5 years ago

Hi @Blufaer

Is this still the case? Do you have this issue also on other hosts in your environments? It seems to me an issue with the host itself and not specifically to this role.

asurinsaka commented 5 years ago

I got the same problem.

My system is Ubuntu 18.04.3 LTS

This is the error from ansible:

TASK [dj-wasabi.zabbix-agent : Debian | Installing deb repository Ubuntu] ********************
changed: [10.0.0.204]

TASK [dj-wasabi.zabbix-agent : Debian | Installing zabbix-agent] *****************************
FAILED - RETRYING: Debian | Installing zabbix-agent (3 retries left).
FAILED - RETRYING: Debian | Installing zabbix-agent (2 retries left).
FAILED - RETRYING: Debian | Installing zabbix-agent (1 retries left).
fatal: [10.0.0.204]: FAILED! => {"attempts": 3, "changed": false, "msg": "No package matching 'zabbix-sender' is available"}

PLAY RECAP ***********************************************************************************
10.0.0.204                 : ok=7    changed=3    unreachable=0    failed=1    skipped=13   rescued=0    ignored=0   

This is out put of apt search zabbix

zabbix-agent/bionic 1:3.0.12+dfsg-1 amd64
  network monitoring solution - agent

zabbix-cli/bionic,bionic 1.7.0-1 all
  Command-line interface for Zabbix monitoring system

zabbix-frontend-php/bionic,bionic 1:3.0.12+dfsg-1 all
  network monitoring solution - PHP front-end

zabbix-java-gateway/bionic,bionic 1:3.0.12+dfsg-1 all
  network monitoring solution - Java gateway

zabbix-proxy-mysql/bionic 1:3.0.12+dfsg-1 amd64
  network monitoring solution - proxy (using MySQL)

zabbix-proxy-pgsql/bionic 1:3.0.12+dfsg-1 amd64
  network monitoring solution - proxy (using PostgreSQL)

zabbix-proxy-sqlite3/bionic 1:3.0.12+dfsg-1 amd64
  network monitoring solution - proxy (using SQLite3)

zabbix-server-mysql/bionic 1:3.0.12+dfsg-1 amd64
  network monitoring solution - server (using MySQL)

zabbix-server-pgsql/bionic 1:3.0.12+dfsg-1 amd64
  network monitoring solution - server (using PostgreSQL)
dj-wasabi commented 5 years ago

Hi @asurinsaka / @Blufaer

Is there a way to replicate this problem? I'm not able to get this issue replicated and therefor I can not solve it.

alexdjachenko commented 4 years ago

I have the same trouble: Ansible host Ubuntu 18.04 Ansible 2.9.4-1ppa~bionic

Remote host: Ubuntu 16.04 aarch64

Console: apt install zabbix-sender Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package zabbix-sender

There isn't zabbix-sender package in Ubuntu 16.04: zabbix_sander utilite is in zabbix_agent package But there is in zabbix repo. But zabbix repo only for amd64 and i386. Not for aarch64

dj-wasabi commented 4 years ago

Will close this issue as role is being transferred to the Zabbix Collection. A new issue in the collection is created for this bug.