{"action":"opened","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3574","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3574/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3574/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3574/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/3574","id":151975612,"number":3574,"title":"yum: disablerepo not working as expected","user":{"login":"smalenfant","id":3803592,"avatar_url":"https://avatars.githubusercontent.com/u/3803592?v=3","gravatar_id":"","url":"https://api.github.com/users/smalenfant","html_url":"https://github.com/smalenfant","followers_url":"https://api.github.com/users/smalenfant/followers","following_url":"https://api.github.com/users/smalenfant/following{/other_user}","gists_url":"https://api.github.com/users/smalenfant/gists{/gist_id}","starred_url":"https://api.github.com/users/smalenfant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smalenfant/subscriptions","organizations_url":"https://api.github.com/users/smalenfant/orgs","repos_url":"https://api.github.com/users/smalenfant/repos","events_url":"https://api.github.com/users/smalenfant/events{/privacy}","received_events_url":"https://api.github.com/users/smalenfant/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-29T21:48:56Z","updated_at":"2016-04-29T21:48:56Z","closed_at":null,"body":"<!--- Verify first that your issue/request is not already reported in GitHub -->\r\n\r\n##### ISSUE TYPE\r\n - Bug Report\r\n\r\n\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.0.2.0\r\n  config file = /etc/ansible/ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\n##### CONFIGURATION\r\n- default\r\n\r\n##### OS / ENVIRONMENT\r\nCentos 6.7\r\n\r\n##### SUMMARY\r\nThere is a few problems related to yum in Ansible 2.0.\r\n\r\nFirst, when using `disablerepo=repoid enablerepo=cdn*` and the repoid doesn't exist, the installation fails. Used to work in Ansible 1.9. Regression.\r\n\r\nSecond, when using `disablerepo=* enablerepo=cdn*`, the tasks is skipped (the tasks has a tag) and the packages gets installed. This used to NOT work in Ansible 1.9\r\n\r\nFinding myself in a position where Ansible 1.9 and 2.0 can't work with same yum commands.\r\n\r\n##### STEPS TO REPRODUCE\r\n\r\nMake sure there is no repo with tags `base,updates,extras` in /etc/yum.repos.d. You also need to have a mirror (or simply rename the base tag to cdn-base for example)\r\n\r\n```\r\n- name: Install YUM repo package dependancies\r\n  yum: name={{ item }} disablerepo=base,updates,extras enablerepo=cdn* state=present\r\n  with_items:\r\n   - yum-utils\r\n   - libselinux-python\r\n```\r\n\r\n##### EXPECTED RESULTS\r\n\r\nExpanded packages to be installed like ansible 1.9\r\n\r\n##### ACTUAL RESULTS\r\n<!--- What actually happened? If possible run with high verbosity (-vvvv) -->\r\n\r\n```\r\nTASK [yum-repo : Install YUM repo package dependancies] ************************\r\nfailed: [cdn1cdes0001.coxlab.net] (item=[u'yum-utils', u'libselinux-python']) => {\"failed\": true, \"invocation\": {\"module_args\": {\"conf_file\": null, \"disable_gpg_check\": false, \"disablerepo\": \"base,updates,extras\", \"enablerepo\": \"cdn*\", \"exclude\": null, \"install_repoquery\": true, \"list\": null, \"name\": [\"yum-utils\", \"libselinux-python\"], \"state\": \"present\", \"update_cache\": false}, \"module_name\": \"yum\"}, \"item\": [\"yum-utils\", \"libselinux-python\"], \"msg\": \"Failure talking to yum: Error getting repository data for base, repository not found\"}\r\n\r\n```\r\n\r\nOutput from Ansible 1.9.2 :\r\n\r\n```\r\nTASK: [yum-repo | Install YUM repo package dependancies] **********************\r\nok: [cdn1cdes0001.coxlab.net] => (item=yum-utils,libselinux-python\r\n```\r\n\r\n##### Additional comments, Skipped when was actually changed.\r\n\r\nI'm a bit confused here. I changed disablerepo=* and it worked. But the task was **skipped** and the **packages** got installed. This actually doesn't work in Ansible 1.9.x. I'm finding myself\r\n\r\n```\r\n- name: Install YUM repo package dependancies\r\n  yum: name={{ item }} disablerepo=* enablerepo=cdn* state=present\r\n  with_items:\r\n   - yum-utils\r\n   - libselinux-python\r\n```\r\n\r\n```\r\nTASK [yum-repo : Install YUM repo package dependancies] ************************\r\nskipping: [cdn1cdes0001.coxlab.net] => (item=[u'yum-utils', u'libselinux-python'])\r\n\r\n/var/log/yum.log :\r\nApr 28 09:57:28 cdn1cdes0001 ansible-yum: Invoked with name=['yum-utils', 'libselinux-python'] list=None install_repoquery=True conf_file=None disable_gpg_check=False state=present disablerepo=* update_cache=False enablerepo=cdn* exclude=None\r\nApr 28 09:57:29 cdn1cdes0001 yum[6170]: Installed: libselinux-python-2.0.94-5.8.el6.x86_64\r\nApr 28 09:57:29 cdn1cdes0001 yum[6170]: Installed: yum-utils-1.1.30-30.el6.noarch\r\n```"}}