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 249 forks source link

yum error - Repository zabbix-non-supported is listed more than once in the configuration #301

Closed ironbishop closed 4 years ago

ironbishop commented 4 years ago

On a Zabbix-Proxy, which also needs the Agent, the Agent Role fails to install and complains about a duplicated repository.

TASK [dj-wasabi.zabbix-agent : RedHat | Installing zabbix-agent] *****************************************************************************************************************************
FAILED - RETRYING: RedHat | Installing zabbix-agent (3 retries left).
FAILED - RETRYING: RedHat | Installing zabbix-agent (2 retries left).
FAILED - RETRYING: RedHat | Installing zabbix-agent (1 retries left).
fatal: [...]: FAILED! => {"attempts": 3, "changed": false, "msg": "Repository zabbix-non-supported is listed more than once in the configuration\n\n\n One of the configured repositories failed (Unknown),\n and yum doesn't have enough cached data to continue. At this point the only\n safe thing yum can do is fail. There are a few ways to work \"fix\" this:\n\n     1. Contact the upstream for the repository and get them to fix the problem.\n\n     2. Reconfigure the baseurl/etc. for the repository, to point to a working\n        upstream. This is most often useful if you are using a newer\n        distribution release than is supported by the repository (and the\n        packages for the previous distribution release still work).\n\n     3. Run the command with the repository temporarily disabled\n            yum --disablerepo=<repoid> ...\n\n     4. Disable the repository permanently, so yum won't use it by default. Yum\n        will then just ignore the repository until you permanently enable it\n        again or use --enablerepo for temporary usage:\n\n            yum-config-manager --disable <repoid>\n        or\n            subscription-manager repos --disable=<repoid>\n\n     5. Configure the failing repository to be skipped, if it is unavailable.\n        Note that yum will try to contact the repo. when it runs most commands,\n        so will have to try and fail each time (and thus. yum will be be much\n        slower). If it is a very temporary problem though, this is often a nice\n        compromise:\n\n            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true\n\nCannot find a valid baseurl for repo: base/7/x86_64\n", "rc": 1, "results": []}

Possible cause is the different naming between roles. The following variables are passed to yum_repository_module.

$ grep -R -B2 zabbix.com/non-supported/
roles/dj-wasabi.zabbix-proxy/defaults/main.yml-  - name: zabbix-supported
roles/dj-wasabi.zabbix-proxy/defaults/main.yml-    description: Zabbix Official Repository non-supported - $basearch
roles/dj-wasabi.zabbix-proxy/defaults/main.yml:    baseurl: http://repo.zabbix.com/non-supported/rhel/{{ ansible_distribution_major_version }}/$basearch/
--
roles/dj-wasabi.zabbix-agent/defaults/main.yml-  - name: zabbix-non-supported
roles/dj-wasabi.zabbix-agent/defaults/main.yml-    description: Zabbix Official Repository non-supported - $basearch
roles/dj-wasabi.zabbix-agent/defaults/main.yml:    baseurl: http://repo.zabbix.com/non-supported/rhel/{{ zabbix_agent_distribution_major_version }}/$basearch/
--
roles/dj-wasabi.zabbix-server/defaults/main.yml-  - name: zabbix-supported
roles/dj-wasabi.zabbix-server/defaults/main.yml-    description: Zabbix Official Repository non-supported - $basearch
roles/dj-wasabi.zabbix-server/defaults/main.yml:    baseurl: http://repo.zabbix.com/non-supported/rhel/{{ ansible_distribution_major_version }}/$basearch/

Versions:

ansible 2.8.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/.../.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)]

- dj-wasabi.zabbix-proxy, 1.6.0
- dj-wasabi.zabbix-agent, 2.1.0
- dj-wasabi.zabbix-server, 1.7.0
dj-wasabi commented 4 years ago

Hi @ironbishop

I created and merged PR's on the zabbix-server and zabbix-proxy repos. This would fix your issue.

ironbishop commented 4 years ago

Thank you. 👍