{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/28292","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/28292/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/28292/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/28292/events","html_url":"https://github.com/ansible/ansible/pull/28292","id":250717851,"number":28292,"title":"Fixes #28159 : Added redhat_repository module","user":{"login":"giovannisciortino","id":30353557,"avatar_url":"https://avatars3.githubusercontent.com/u/30353557?v=4","gravatar_id":"","url":"https://api.github.com/users/giovannisciortino","html_url":"https://github.com/giovannisciortino","followers_url":"https://api.github.com/users/giovannisciortino/followers","following_url":"https://api.github.com/users/giovannisciortino/following{/other_user}","gists_url":"https://api.github.com/users/giovannisciortino/gists{/gist_id}","starred_url":"https://api.github.com/users/giovannisciortino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giovannisciortino/subscriptions","organizations_url":"https://api.github.com/users/giovannisciortino/orgs","repos_url":"https://api.github.com/users/giovannisciortino/repos","events_url":"https://api.github.com/users/giovannisciortino/events{/privacy}","received_events_url":"https://api.github.com/users/giovannisciortino/received_events","type":"User","site_admin":false},"labels":[{"id":562292166,"url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.4","name":"affects_2.4","color":"ededed","default":false},{"id":496359346,"url":"https://api.github.com/repos/ansible/ansible/labels/module","name":"module","color":"1d76db","default":false},{"id":61436281,"url":"https://api.github.com/repos/ansible/ansible/labels/needs_revision","name":"needs_revision","color":"eb6450","default":false},{"id":503572087,"url":"https://api.github.com/repos/ansible/ansible/labels/needs_triage","name":"needs_triage","color":"0e8a16","default":false},{"id":473225334,"url":"https://api.github.com/repos/ansible/ansible/labels/new_module","name":"new_module","color":"ededed","default":false},{"id":153577825,"url":"https://api.github.com/repos/ansible/ansible/labels/new_plugin","name":"new_plugin","color":"bfe5bf","default":false},{"id":636327968,"url":"https://api.github.com/repos/ansible/ansible/labels/support:community","name":"support:community","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-08-16T18:27:26Z","updated_at":"2017-08-16T20:05:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ansible/ansible/pulls/28292","html_url":"https://github.com/ansible/ansible/pull/28292","diff_url":"https://github.com/ansible/ansible/pull/28292.diff","patch_url":"https://github.com/ansible/ansible/pull/28292.patch"},"body":"##### SUMMARY\r\n\r\nFixes #28159\r\n\r\nA new module to manage subscription-manager repositories based on the discussion reported in #28159 based on the comment https://github.com/ansible/ansible/issues/28159#issuecomment-322184760 https://github.com/ansible/ansible/issues/28159#issuecomment-322184773 a new module called \"redhat_repository\" to go alongside \"redhat_subscription\" has been created. \r\n\r\nIt allows to list enabled/disable/all repositories\r\nIt allows to execute the needs described in https://github.com/ansible/ansible/issues/28159#issuecomment-322184754\r\nIt allows to enable and disable repositories(also using wildcard * and ?) in a single task in order to perform the following tasks in a idempotent way(reporting a valid changed value in the result):\r\n- Enable repositories foo and bar and disable all the other available repositories\r\n- Enable all the available repositories excluding only foo and bar\r\n\r\nIt supports also the check mode\r\n\r\nI tested the module on RHEL 6.7 ( subscription-manager-1.14.10-1.el6.x86_64 ) and RHEL 7.2 ( subscription-manager-1.15.9-15.el7.x86_64 ) with a rhsm account with about 500 repositories avaialable.\r\nI tested the module also on RHEL 7.2 with subscription-manager register to Red Hat Satellite 6.2\r\n\r\n##### ISSUE TYPE\r\n - New Module Pull Request\r\n\r\n##### COMPONENT NAME\r\nredhat_repository\r\n\r\n##### ANSIBLE VERSION\r\n```\r\n$ build/scripts-2.7/ansible --version\r\nansible 2.3.0.0\r\n  config file = /etc/ansible/ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n  python version = 2.7.13 (default, May 10 2017, 20:04:28) [GCC 6.3.1 20161221 (Red Hat 6.3.1-1)]\r\n\r\n```\r\n\r\n\r\n##### ADDITIONAL INFORMATION\r\nI report below some examples and their output:\r\n\r\n**List all repositories**\r\n```\r\n$ ./build/scripts-2.7/ansible -b gs-client01 -m redhat_repository -a list=enabled \r\ngs-client01 | SUCCESS => {\r\n    \"changed\": false, \r\n    \"failed\": false, \r\n    \"repositories\": [\r\n        {\r\n            \"enabled\": true, \r\n            \"id\": \"rhel-7-server-optional-rpms\", \r\n            \"name\": \"Red Hat Enterprise Linux 7 Server - Optional (RPMs)\", \r\n            \"url\": \"https://sat62.localdomain/pulp/repos/Org1/Library/RHEL7/content/dist/rhel/server/7/$releasever/$basearch/optional/os\"\r\n        }, \r\n        {\r\n            \"enabled\": true, \r\n            \"id\": \"rhel-7-server-satellite-tools-6.2-rpms\", \r\n            \"name\": \"Red Hat Satellite Tools 6.2 (for RHEL 7 Server) (RPMs)\", \r\n            \"url\": \"https://sat62.localdomain/pulp/repos/Org1/Library/RHEL7/content/dist/rhel/server/7/7Server/$basearch/sat-tools/6.2/os\"\r\n        }, \r\n        {\r\n            \"enabled\": true, \r\n            \"id\": \"rhel-7-server-rpms\", \r\n            \"name\": \"Red Hat Enterprise Linux 7 Server (RPMs)\", \r\n            \"url\": \"https://sat62.localdomain/pulp/repos/Org1/Library/RHEL7/content/dist/rhel/server/7/$releasever/$basearch/os\"\r\n        }\r\n    ]\r\n}\r\n\r\n```\r\n\r\n\r\n**Enable rhel-?-server-rpms and disable all the other repositories**\r\n```\r\n$ ./build/scripts-2.7/ansible -b gs-client01 -m redhat_repository -a \"enable=rhel-?-server-rpms disable=*\"\r\ngs-client01 | SUCCESS => {\r\n    \"changed\": false, \r\n    \"failed\": false, \r\n    \"repositories\": [\r\n        [\r\n            {\r\n                \"enabled\": true, \r\n                \"id\": \"rhel-7-server-rpms\", \r\n                \"name\": \"Red Hat Enterprise Linux 7 Server (RPMs)\", \r\n                \"url\": \"https://sat62.localdomain/pulp/repos/Org1/Library/RHEL7/content/dist/rhel/server/7/$releasever/$basearch/os\"\r\n            }\r\n        ], \r\n        [\r\n            {\r\n                \"enabled\": false, \r\n                \"id\": \"rhel-7-server-optional-rpms\", \r\n                \"name\": \"Red Hat Enterprise Linux 7 Server - Optional (RPMs)\", \r\n                \"url\": \"https://sat62.localdomain/pulp/repos/Org1/Library/RHEL7/content/dist/rhel/server/7/$releasever/$basearch/optional/os\"\r\n            }, \r\n            {\r\n                \"enabled\": false, \r\n                \"id\": \"rhel-7-server-satellite-tools-6.2-rpms\", \r\n                \"name\": \"Red Hat Satellite Tools 6.2 (for RHEL 7 Server) (RPMs)\", \r\n                \"url\": \"https://sat62.localdomain/pulp/repos/Org1/Library/RHEL7/content/dist/rhel/server/7/7Server/$basearch/sat-tools/6.2/os\"\r\n            }\r\n        ]\r\n    ]\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/322883477","html_url":"https://github.com/ansible/ansible/pull/28292#issuecomment-322883477","issue_url":"https://api.github.com/repos/ansible/ansible/issues/28292","id":322883477,"user":{"login":"giovannisciortino","id":30353557,"avatar_url":"https://avatars3.githubusercontent.com/u/30353557?v=4","gravatar_id":"","url":"https://api.github.com/users/giovannisciortino","html_url":"https://github.com/giovannisciortino","followers_url":"https://api.github.com/users/giovannisciortino/followers","following_url":"https://api.github.com/users/giovannisciortino/following{/other_user}","gists_url":"https://api.github.com/users/giovannisciortino/gists{/gist_id}","starred_url":"https://api.github.com/users/giovannisciortino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giovannisciortino/subscriptions","organizations_url":"https://api.github.com/users/giovannisciortino/orgs","repos_url":"https://api.github.com/users/giovannisciortino/repos","events_url":"https://api.github.com/users/giovannisciortino/events{/privacy}","received_events_url":"https://api.github.com/users/giovannisciortino/received_events","type":"User","site_admin":false},"created_at":"2017-08-16T20:05:24Z","updated_at":"2017-08-16T20:05:24Z","body":"I have fixed all the error reported in the failed test except the following:\r\n\r\n> lib/ansible/modules/packaging/os/redhat_repository.py:0:0: E316 ANSIBLE_METADATA.metadata_version: not a valid value for dictionary value @ data['metadata_version']. Got '1.0'\r\n\r\nThe ANSIBLE_METADATA dictionary is the similar to other module as redhat_subscription.\r\nPlease suggest me how to fix this failed test. "}}
{"actor":{"display_login":"giovannisciortino"}}