{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/47413","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/47413/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/47413/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/47413/events","html_url":"https://github.com/ansible/ansible/issues/47413","id":372460847,"node_id":"MDU6SXNzdWUzNzI0NjA4NDc=","number":47413,"title":"gcp_compute dynamic inventory doesn't properly handle keyed_groups separator key","user":{"login":"flamein","id":22610677,"node_id":"MDQ6VXNlcjIyNjEwNjc3","avatar_url":"https://avatars0.githubusercontent.com/u/22610677?v=4","gravatar_id":"","url":"https://api.github.com/users/flamein","html_url":"https://github.com/flamein","followers_url":"https://api.github.com/users/flamein/followers","following_url":"https://api.github.com/users/flamein/following{/other_user}","gists_url":"https://api.github.com/users/flamein/gists{/gist_id}","starred_url":"https://api.github.com/users/flamein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flamein/subscriptions","organizations_url":"https://api.github.com/users/flamein/orgs","repos_url":"https://api.github.com/users/flamein/repos","events_url":"https://api.github.com/users/flamein/events{/privacy}","received_events_url":"https://api.github.com/users/flamein/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-22T10:03:02Z","updated_at":"2018-10-23T00:10:50Z","closed_at":null,"author_association":"NONE","body":"<!--- Verify first that your issue is not already reported on GitHub -->\r\n<!--- Also test if the latest release and devel branch are affected too -->\r\n<!--- Complete *all* sections as described, this form is processed automatically -->\r\n\r\n##### SUMMARY\r\nLooking at https://github.com/ansible/ansible/blob/stable-2.7/lib/ansible/plugins/inventory/__init__.py#L334 the keyed_groups should support the following structure:\r\n```yaml\r\n    keyed_groups:\r\n    - prefix: gcp\r\n      separator: '-'\r\n      keys: labels['group']\r\n```\r\ninstead '_' separator is used or overridden by Google API (as existing labels are also stripped of '-' in favor of '_'\r\n\r\nI am aware this key is not documented in the module: https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/inventory/gcp_compute.py\r\n\r\n##### ISSUE TYPE\r\n- Bug Report\r\n\r\n##### COMPONENT NAME\r\n<!--- Write the short name of the module, plugin, task or feature below -->\r\nhttps://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/inventory/gcp_compute.py\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste verbatim output from \"ansible --version\" between quotes -->\r\n```paste below\r\nansible 2.7.0\r\n  config file = /home/f_lamein/projects/ansible-devops/ansible.cfg\r\n  configured module search path = [u'/home/f_lamein/projects/ansible-devops/library']\r\n  ansible python module location = /home/f_lamein/PythonEnvironments/ansible-2.7/lib/python2.7/site-packages/ansible\r\n  executable location = /home/f_lamein/PythonEnvironments/ansible-2.7/bin/ansible\r\n  python version = 2.7.15 (default, Sep 21 2018, 23:26:48) [GCC 8.1.1 20180712 (Red Hat 8.1.1-5)]\r\n```\r\n\r\n##### CONFIGURATION\r\n<!--- Paste verbatim output from \"ansible-config dump --only-changed\" between quotes -->\r\n```paste below\r\nirrelevant\r\n```\r\n\r\n##### OS / ENVIRONMENT\r\n<!--- Provide all relevant information below, e.g. target OS versions, network device firmware, etc. -->\r\n\r\n##### STEPS TO REPRODUCE\r\n<!--- Describe exactly how to reproduce the problem, using a minimal test-case -->\r\nansible-inventory -i hosts.gcp.yml\r\n<!--- Paste example playbooks or commands between quotes below -->\r\n```yaml\r\nplugin: gcp_compute\r\nzones: # populate inventory with instances in these regions\r\n  - europe-west4-a\r\nprojects:\r\n  - dev\r\nauth_kind: application\r\nfilters:\r\nscopes:\r\n  - https://www.googleapis.com/auth/compute\r\n  - https://www.googleapis.com/auth/container\r\nhostnames:\r\n  - name\r\n  - private_ip\r\n  - public_ip\r\nkeyed_groups:\r\n  - prefix: gc\r\n    separator: '-'\r\n    key: labels['group']\r\n  - prefix: tag\r\n    separator: '-'\r\n    key: tags['items']\r\ncompose:\r\n  # Set an inventory parameter to use the Public IP address to connect to the host\r\n  # For Private ip use \"networkInterfaces[0].networkIP\"\r\n  # ansible_host: networkInterfaces[0].accessConfigs[0].natIP\r\n  ansible_host: networkInterfaces[0].networkIP\r\n```\r\n\r\n<!--- HINT: You can paste gist.github.com links for larger files -->\r\n\r\n##### EXPECTED RESULTS\r\n<!--- Describe what you expected to happen when running the steps above -->\r\nGet groups with gc-dev-app.\r\n\r\n##### ACTUAL RESULTS\r\n<!--- Describe what actually happened. If possible run with extra verbosity (-vvvv) -->\r\nGetting groups with gc_dev_app\r\n\r\n<!--- Paste verbatim command output between quotes -->\r\n```json\r\n    \"gc_dev_app\": {\r\n        \"hosts\": [\r\n            \"gc-dev-app0\"\r\n        ]\r\n    }, \r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/432035639","html_url":"https://github.com/ansible/ansible/issues/47413#issuecomment-432035639","issue_url":"https://api.github.com/repos/ansible/ansible/issues/47413","id":432035639,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMjAzNTYzOQ==","user":{"login":"ansibot","id":6585283,"node_id":"MDQ6VXNlcjY1ODUyODM=","avatar_url":"https://avatars0.githubusercontent.com/u/6585283?v=4","gravatar_id":"","url":"https://api.github.com/users/ansibot","html_url":"https://github.com/ansibot","followers_url":"https://api.github.com/users/ansibot/followers","following_url":"https://api.github.com/users/ansibot/following{/other_user}","gists_url":"https://api.github.com/users/ansibot/gists{/gist_id}","starred_url":"https://api.github.com/users/ansibot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansibot/subscriptions","organizations_url":"https://api.github.com/users/ansibot/orgs","repos_url":"https://api.github.com/users/ansibot/repos","events_url":"https://api.github.com/users/ansibot/events{/privacy}","received_events_url":"https://api.github.com/users/ansibot/received_events","type":"User","site_admin":false},"created_at":"2018-10-23T00:10:50Z","updated_at":"2018-10-23T00:10:50Z","author_association":"CONTRIBUTOR","body":"Hi @flamein, thank you for submitting this issue!\n\n[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)\n<!--- boilerplate: thank_submitter --->"}}
{"actor":{"display_login":"ansibot"}}