{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3434","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3434/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3434/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3434/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/3434","id":148344580,"number":3434,"title":"rax module not idempotent when creating single instance without group","user":{"login":"tuuling","id":2890729,"avatar_url":"https://avatars.githubusercontent.com/u/2890729?v=3","gravatar_id":"","url":"https://api.github.com/users/tuuling","html_url":"https://github.com/tuuling","followers_url":"https://api.github.com/users/tuuling/followers","following_url":"https://api.github.com/users/tuuling/following{/other_user}","gists_url":"https://api.github.com/users/tuuling/gists{/gist_id}","starred_url":"https://api.github.com/users/tuuling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuuling/subscriptions","organizations_url":"https://api.github.com/users/tuuling/orgs","repos_url":"https://api.github.com/users/tuuling/repos","events_url":"https://api.github.com/users/tuuling/events{/privacy}","received_events_url":"https://api.github.com/users/tuuling/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-14T12:24:12Z","updated_at":"2016-04-14T12:35:44Z","closed_at":null,"body":"<!--- Verify first that your issue/request is not already reported in GitHub -->\r\n\r\n##### ISSUE TYPE\r\n<!--- Pick one below and delete the rest: -->\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\n```\r\nrax\r\n```\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.1.0 (devel)\r\n```\r\n\r\n##### OS / ENVIRONMENT\r\n<!---\r\nMention the OS you are running Ansible from, and the OS you are\r\nmanaging, or say “N/A” for anything that is not platform-specific.\r\n-->\r\nN/A\r\n##### SUMMARY\r\n<!--- Explain the problem briefly -->\r\nWhen creating a single instance without group and exact_count the command is not idempotent as is expected.\r\n\r\n##### STEPS TO REPRODUCE\r\n<!---\r\nFor bugs, show exactly how to reproduce the problem.\r\nFor new features, show how the feature would be used.\r\n-->\r\nRun the following code twice.\r\n```\r\n\r\n    - name: Server create request\r\n      local_action:\r\n        module: rax\r\n        credentials: ~/.raxpub\r\n        name: asdf\r\n        flavor: general1-1\r\n        image: cf16c435-7bed-4dc3-b76e-57b09987866d #Debian 8\r\n        disk_config: manual\r\n        networks:\r\n          - private\r\n          - public\r\n        region: IAD\r\n        state: present\r\n        meta:\r\n          groups:\r\n            - asdf1\r\n            - web\r\n      register: rax\r\n```\r\n\r\n<!--- You can also paste gist.github.com links for larger files -->\r\n\r\n##### EXPECTED RESULTS\r\n<!--- What did you expect to happen when running the steps above? -->\r\nShould create only 1 instance.\r\n##### POSSIBLE CAUSE\r\nWhen looking into the code itself. It checks for matching metadata to confirm if the server(s) match.\r\nline 688 in rax.py\r\n```\r\nif server.metadata != meta\r\n```\r\nWhen creating the server it shows the metadata as \r\n```\r\n            \"rax_metadata\": {\r\n                \"groups\": \"asdf1,web\", \r\n            },\r\n```\r\nWhen I use rax_facts on the same machine after creation it shows as:\r\n```\r\n            \"rax_metadata\": {\r\n                \"groups\": \"asdf1,web\", \r\n                \"rax_service_level_automation\": \"Complete\"\r\n            }, \r\n```\r\nI can only assume that this addtional item in metadata fails the check and server.metadata can never equal meta supplied as the argument."},"comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/comments/209916490","html_url":"https://github.com/ansible/ansible-modules-core/issues/3434#issuecomment-209916490","issue_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3434","id":209916490,"user":{"login":"tuuling","id":2890729,"avatar_url":"https://avatars.githubusercontent.com/u/2890729?v=3","gravatar_id":"","url":"https://api.github.com/users/tuuling","html_url":"https://github.com/tuuling","followers_url":"https://api.github.com/users/tuuling/followers","following_url":"https://api.github.com/users/tuuling/following{/other_user}","gists_url":"https://api.github.com/users/tuuling/gists{/gist_id}","starred_url":"https://api.github.com/users/tuuling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuuling/subscriptions","organizations_url":"https://api.github.com/users/tuuling/orgs","repos_url":"https://api.github.com/users/tuuling/repos","events_url":"https://api.github.com/users/tuuling/events{/privacy}","received_events_url":"https://api.github.com/users/tuuling/received_events","type":"User","site_admin":false},"created_at":"2016-04-14T12:35:44Z","updated_at":"2016-04-14T12:35:44Z","body":"It seems the only way to force it is to use:\r\n```\r\n        count: 1\r\n        group: asdf\r\n        exact_count: yes\r\n        auto_increment: no\r\n```\r\n\r\nIn that case it takes a different path in the code and only the group property is matched."}}