{"action":"created","comment":{"url":"https://api.github.com/repos/ansible/ansible/pulls/comments/62526205","id":62526205,"diff_hunk":"@@ -530,6 +539,55 @@ def get_rds_instances_by_region(self, region):\n                 error = \"Looks like AWS RDS is down:\\n%s\" % e.message\n             self.fail_with_error(error, 'getting RDS instances')\n \n+    def get_db_clusters_by_region(self, region):\n+        client = boto3.client('rds', region_name=region)\n+        clusters = client.describe_db_clusters()[\"DBClusters\"]\n+        account_id = boto.connect_iam().get_user().arn.split(':')[4]\n+        c_dict = {}\n+        for c in clusters:\n+            # remove these datetime objects as there is no serialisation to json\n+            # currently in place and we don't need the data yet\n+            if 'EarliestRestorableTime' in c:\n+                del c['EarliestRestorableTime']\n+            if 'LatestRestorableTime' in c:\n+                del c['LatestRestorableTime']\n+\n+            matches_filter = False\n+\n+            try:\n+                # arn:aws:rds:<region>:<account number>:<resourcetype>:<name>\n+                tags = client.list_tags_for_resource(\n+                    ResourceName='arn:aws:rds:' + region + ':' + account_id + ':cluster:' + c['DBClusterIdentifier'])\n+                c['Tags'] = tags['TagList']\n+\n+                if self.ec2_instance_filters:\n+                    for filter_key, filter_values in self.ec2_instance_filters.items():\n+                        # get AWS tag key e.g. tag:env will be 'env'\n+                        tag_name = filter_key.split(\":\", 1)[1]\n+                        # Filter values is a list (if you put commas into the value it will be multiple items) - ignore the rest of the items for now","path":"contrib/inventory/ec2.py","position":68,"original_position":68,"commit_id":"15bb55594d89ea14f2d4dc45825b614198064ff1","original_commit_id":"15bb55594d89ea14f2d4dc45825b614198064ff1","user":{"login":"ryansb","id":636610,"avatar_url":"https://avatars.githubusercontent.com/u/636610?v=3","gravatar_id":"","url":"https://api.github.com/users/ryansb","html_url":"https://github.com/ryansb","followers_url":"https://api.github.com/users/ryansb/followers","following_url":"https://api.github.com/users/ryansb/following{/other_user}","gists_url":"https://api.github.com/users/ryansb/gists{/gist_id}","starred_url":"https://api.github.com/users/ryansb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryansb/subscriptions","organizations_url":"https://api.github.com/users/ryansb/orgs","repos_url":"https://api.github.com/users/ryansb/repos","events_url":"https://api.github.com/users/ryansb/events{/privacy}","received_events_url":"https://api.github.com/users/ryansb/received_events","type":"User","site_admin":false},"body":"Ahhh, I see what you're saying. That'll need to get fixed either in this PR or I can submit a followup. ","created_at":"2016-05-09T16:10:55Z","updated_at":"2016-05-09T16:10:55Z","html_url":"https://github.com/ansible/ansible/pull/15609#discussion_r62526205","pull_request_url":"https://api.github.com/repos/ansible/ansible/pulls/15609","_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible/pulls/comments/62526205"},"html":{"href":"https://github.com/ansible/ansible/pull/15609#discussion_r62526205"},"pull_request":{"href":"https://api.github.com/repos/ansible/ansible/pulls/15609"}}},"pull_request":{"url":"https://api.github.com/repos/ansible/ansible/pulls/15609","id":67920680,"html_url":"https://github.com/ansible/ansible/pull/15609","diff_url":"https://github.com/ansible/ansible/pull/15609.diff","patch_url":"https://github.com/ansible/ansible/pull/15609.patch","issue_url":"https://api.github.com/repos/ansible/ansible/issues/15609","number":15609,"state":"open","locked":false,"title":"Provide full and filtered RDS Aurora details in ec2 inventory","user":{"login":"aioue","id":1254905,"avatar_url":"https://avatars.githubusercontent.com/u/1254905?v=3","gravatar_id":"","url":"https://api.github.com/users/aioue","html_url":"https://github.com/aioue","followers_url":"https://api.github.com/users/aioue/followers","following_url":"https://api.github.com/users/aioue/following{/other_user}","gists_url":"https://api.github.com/users/aioue/gists{/gist_id}","starred_url":"https://api.github.com/users/aioue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aioue/subscriptions","organizations_url":"https://api.github.com/users/aioue/orgs","repos_url":"https://api.github.com/users/aioue/repos","events_url":"https://api.github.com/users/aioue/events{/privacy}","received_events_url":"https://api.github.com/users/aioue/received_events","type":"User","site_admin":false},"body":"##### ISSUE TYPE\r\n - Feature Pull Request\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.0.2.0\r\n  config file =\r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\n##### SUMMARY\r\n<!--- Describe the change, including rationale and design decisions -->\r\nAdd db_clusters to the ec2 inventory. Show tags. Only show clusters matching tags in the .ini.\r\n\r\nUse boto3 to get the clusters.\r\n\r\n```\r\n  \"db_clusters\": {\r\n    \"test-eu-west-1\": {\r\n      \"AllocatedStorage\": 1,\r\n      \"AvailabilityZones\": [\r\n        \"eu-west-1a\",\r\n        \"eu-west-1b\",\r\n        \"eu-west-1c\"\r\n      ],\r\n      \"BackupRetentionPeriod\": 3,\r\n      \"DBClusterIdentifier\": \"test-eu-west-1\",\r\n      \"DBClusterMembers\": [\r\n        {\r\n          \"DBClusterParameterGroupStatus\": \"in-sync\",\r\n          \"DBInstanceIdentifier\": \"test-eu-west-1-0\",\r\n          \"IsClusterWriter\": true,\r\n          \"PromotionTier\": 1\r\n        },\r\n        {\r\n          \"DBClusterParameterGroupStatus\": \"in-sync\",\r\n          \"DBInstanceIdentifier\": \"test-eu-west-1-1\",\r\n          \"IsClusterWriter\": false,\r\n          \"PromotionTier\": 1\r\n        }\r\n      ],\r\n      \"DBClusterParameterGroup\": \"aurora-cluster-test\",\r\n      \"DBSubnetGroup\": \"dev_test_db_group\",\r\n      \"Endpoint\": \"test-eu-west-1.cluster-sdfsdfsd.eu-west-1.rds.amazonaws.com\",\r\n      \"Engine\": \"aurora\",\r\n      \"EngineVersion\": \"5.6.10a\",\r\n      \"KmsKeyId\": \"arn:aws:kms:eu-west-1:345345345345:key/sfsdfsdfsdfsdf\",\r\n      \"MasterUsername\": \"sdfsdfsdfs\",\r\n      \"Port\": 33306,\r\n      \"PreferredBackupWindow\": \"05:21-05:51\",\r\n      \"PreferredMaintenanceWindow\": \"sat:03:18-sat:03:48\",\r\n      \"Status\": \"available\",\r\n      \"StorageEncrypted\": true,\r\n      \"Tags\": [\r\n        {\r\n          \"Key\": \"env\",\r\n          \"Value\": \"test\"\r\n        }\r\n      ],\r\n      \"VpcSecurityGroups\": [\r\n        {\r\n          \"Status\": \"active\",\r\n          \"VpcSecurityGroupId\": \"sg-234234234\"\r\n        }\r\n      ]\r\n    }\r\n  }\r\n```","created_at":"2016-04-26T16:53:33Z","updated_at":"2016-05-09T16:10:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"033950ccd7ea15fce5f2ef72cb25ccad50487530","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ansible/ansible/pulls/15609/commits","review_comments_url":"https://api.github.com/repos/ansible/ansible/pulls/15609/comments","review_comment_url":"https://api.github.com/repos/ansible/ansible/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/15609/comments","statuses_url":"https://api.github.com/repos/ansible/ansible/statuses/15bb55594d89ea14f2d4dc45825b614198064ff1","head":{"label":"aioue:devel","ref":"devel","sha":"15bb55594d89ea14f2d4dc45825b614198064ff1","user":{"login":"aioue","id":1254905,"avatar_url":"https://avatars.githubusercontent.com/u/1254905?v=3","gravatar_id":"","url":"https://api.github.com/users/aioue","html_url":"https://github.com/aioue","followers_url":"https://api.github.com/users/aioue/followers","following_url":"https://api.github.com/users/aioue/following{/other_user}","gists_url":"https://api.github.com/users/aioue/gists{/gist_id}","starred_url":"https://api.github.com/users/aioue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aioue/subscriptions","organizations_url":"https://api.github.com/users/aioue/orgs","repos_url":"https://api.github.com/users/aioue/repos","events_url":"https://api.github.com/users/aioue/events{/privacy}","received_events_url":"https://api.github.com/users/aioue/received_events","type":"User","site_admin":false},"repo":{"id":43013740,"name":"ansible","full_name":"aioue/ansible","owner":{"login":"aioue","id":1254905,"avatar_url":"https://avatars.githubusercontent.com/u/1254905?v=3","gravatar_id":"","url":"https://api.github.com/users/aioue","html_url":"https://github.com/aioue","followers_url":"https://api.github.com/users/aioue/followers","following_url":"https://api.github.com/users/aioue/following{/other_user}","gists_url":"https://api.github.com/users/aioue/gists{/gist_id}","starred_url":"https://api.github.com/users/aioue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aioue/subscriptions","organizations_url":"https://api.github.com/users/aioue/orgs","repos_url":"https://api.github.com/users/aioue/repos","events_url":"https://api.github.com/users/aioue/events{/privacy}","received_events_url":"https://api.github.com/users/aioue/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aioue/ansible","description":"Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications— automate in a language that approaches plain English, using SSH, with no agents to install on remote systems.","fork":true,"url":"https://api.github.com/repos/aioue/ansible","forks_url":"https://api.github.com/repos/aioue/ansible/forks","keys_url":"https://api.github.com/repos/aioue/ansible/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aioue/ansible/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aioue/ansible/teams","hooks_url":"https://api.github.com/repos/aioue/ansible/hooks","issue_events_url":"https://api.github.com/repos/aioue/ansible/issues/events{/number}","events_url":"https://api.github.com/repos/aioue/ansible/events","assignees_url":"https://api.github.com/repos/aioue/ansible/assignees{/user}","branches_url":"https://api.github.com/repos/aioue/ansible/branches{/branch}","tags_url":"https://api.github.com/repos/aioue/ansible/tags","blobs_url":"https://api.github.com/repos/aioue/ansible/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aioue/ansible/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aioue/ansible/git/refs{/sha}","trees_url":"https://api.github.com/repos/aioue/ansible/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aioue/ansible/statuses/{sha}","languages_url":"https://api.github.com/repos/aioue/ansible/languages","stargazers_url":"https://api.github.com/repos/aioue/ansible/stargazers","contributors_url":"https://api.github.com/repos/aioue/ansible/contributors","subscribers_url":"https://api.github.com/repos/aioue/ansible/subscribers","subscription_url":"https://api.github.com/repos/aioue/ansible/subscription","commits_url":"https://api.github.com/repos/aioue/ansible/commits{/sha}","git_commits_url":"https://api.github.com/repos/aioue/ansible/git/commits{/sha}","comments_url":"https://api.github.com/repos/aioue/ansible/comments{/number}","issue_comment_url":"https://api.github.com/repos/aioue/ansible/issues/comments{/number}","contents_url":"https://api.github.com/repos/aioue/ansible/contents/{+path}","compare_url":"https://api.github.com/repos/aioue/ansible/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aioue/ansible/merges","archive_url":"https://api.github.com/repos/aioue/ansible/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aioue/ansible/downloads","issues_url":"https://api.github.com/repos/aioue/ansible/issues{/number}","pulls_url":"https://api.github.com/repos/aioue/ansible/pulls{/number}","milestones_url":"https://api.github.com/repos/aioue/ansible/milestones{/number}","notifications_url":"https://api.github.com/repos/aioue/ansible/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aioue/ansible/labels{/name}","releases_url":"https://api.github.com/repos/aioue/ansible/releases{/id}","deployments_url":"https://api.github.com/repos/aioue/ansible/deployments","created_at":"2015-09-23T16:40:47Z","updated_at":"2016-04-26T16:43:52Z","pushed_at":"2016-04-26T16:46:34Z","git_url":"git://github.com/aioue/ansible.git","ssh_url":"git@github.com:aioue/ansible.git","clone_url":"https://github.com/aioue/ansible.git","svn_url":"https://github.com/aioue/ansible","homepage":"http://ansible.com/","size":34527,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"devel"}},"base":{"label":"ansible:devel","ref":"devel","sha":"8c2701803805bf3bfe73ab81ba760ea5cb70f3e4","user":{"login":"ansible","id":1507452,"avatar_url":"https://avatars.githubusercontent.com/u/1507452?v=3","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"repo":{"id":3638964,"name":"ansible","full_name":"ansible/ansible","owner":{"login":"ansible","id":1507452,"avatar_url":"https://avatars.githubusercontent.com/u/1507452?v=3","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ansible/ansible","description":"Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications— automate in a language that approaches plain English, using SSH, with no agents to install on remote systems.","fork":false,"url":"https://api.github.com/repos/ansible/ansible","forks_url":"https://api.github.com/repos/ansible/ansible/forks","keys_url":"https://api.github.com/repos/ansible/ansible/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ansible/ansible/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ansible/ansible/teams","hooks_url":"https://api.github.com/repos/ansible/ansible/hooks","issue_events_url":"https://api.github.com/repos/ansible/ansible/issues/events{/number}","events_url":"https://api.github.com/repos/ansible/ansible/events","assignees_url":"https://api.github.com/repos/ansible/ansible/assignees{/user}","branches_url":"https://api.github.com/repos/ansible/ansible/branches{/branch}","tags_url":"https://api.github.com/repos/ansible/ansible/tags","blobs_url":"https://api.github.com/repos/ansible/ansible/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ansible/ansible/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ansible/ansible/git/refs{/sha}","trees_url":"https://api.github.com/repos/ansible/ansible/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ansible/ansible/statuses/{sha}","languages_url":"https://api.github.com/repos/ansible/ansible/languages","stargazers_url":"https://api.github.com/repos/ansible/ansible/stargazers","contributors_url":"https://api.github.com/repos/ansible/ansible/contributors","subscribers_url":"https://api.github.com/repos/ansible/ansible/subscribers","subscription_url":"https://api.github.com/repos/ansible/ansible/subscription","commits_url":"https://api.github.com/repos/ansible/ansible/commits{/sha}","git_commits_url":"https://api.github.com/repos/ansible/ansible/git/commits{/sha}","comments_url":"https://api.github.com/repos/ansible/ansible/comments{/number}","issue_comment_url":"https://api.github.com/repos/ansible/ansible/issues/comments{/number}","contents_url":"https://api.github.com/repos/ansible/ansible/contents/{+path}","compare_url":"https://api.github.com/repos/ansible/ansible/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ansible/ansible/merges","archive_url":"https://api.github.com/repos/ansible/ansible/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ansible/ansible/downloads","issues_url":"https://api.github.com/repos/ansible/ansible/issues{/number}","pulls_url":"https://api.github.com/repos/ansible/ansible/pulls{/number}","milestones_url":"https://api.github.com/repos/ansible/ansible/milestones{/number}","notifications_url":"https://api.github.com/repos/ansible/ansible/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ansible/ansible/labels{/name}","releases_url":"https://api.github.com/repos/ansible/ansible/releases{/id}","deployments_url":"https://api.github.com/repos/ansible/ansible/deployments","created_at":"2012-03-06T14:58:02Z","updated_at":"2016-05-09T15:59:13Z","pushed_at":"2016-05-09T15:46:27Z","git_url":"git://github.com/ansible/ansible.git","ssh_url":"git@github.com:ansible/ansible.git","clone_url":"https://github.com/ansible/ansible.git","svn_url":"https://github.com/ansible/ansible","homepage":"http://ansible.com/","size":60578,"stargazers_count":16678,"watchers_count":16678,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4994,"mirror_url":null,"open_issues_count":1381,"forks":4994,"open_issues":1381,"watchers":16678,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible/pulls/15609"},"html":{"href":"https://github.com/ansible/ansible/pull/15609"},"issue":{"href":"https://api.github.com/repos/ansible/ansible/issues/15609"},"comments":{"href":"https://api.github.com/repos/ansible/ansible/issues/15609/comments"},"review_comments":{"href":"https://api.github.com/repos/ansible/ansible/pulls/15609/comments"},"review_comment":{"href":"https://api.github.com/repos/ansible/ansible/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ansible/ansible/pulls/15609/commits"},"statuses":{"href":"https://api.github.com/repos/ansible/ansible/statuses/15bb55594d89ea14f2d4dc45825b614198064ff1"}}}}