{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/4078","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/4078/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/4078/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/4078/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/4078","id":163101408,"number":4078,"title":"ec2_ami not handling wait:no and tags correctly","user":{"login":"hyperized","id":827954,"avatar_url":"https://avatars.githubusercontent.com/u/827954?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperized","html_url":"https://github.com/hyperized","followers_url":"https://api.github.com/users/hyperized/followers","following_url":"https://api.github.com/users/hyperized/following{/other_user}","gists_url":"https://api.github.com/users/hyperized/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperized/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperized/subscriptions","organizations_url":"https://api.github.com/users/hyperized/orgs","repos_url":"https://api.github.com/users/hyperized/repos","events_url":"https://api.github.com/users/hyperized/events{/privacy}","received_events_url":"https://api.github.com/users/hyperized/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/aws","name":"aws","color":"c5def5"},{"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/bug_report","name":"bug_report","color":"fbca04"},{"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/cloud","name":"cloud","color":"c7def8"},{"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/waiting_on_maintainer","name":"waiting_on_maintainer","color":"d93f0b"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-30T07:43:49Z","updated_at":"2016-07-29T22:43:00Z","closed_at":null,"body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\nec2_ami.py\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.1.0.0\r\n```\r\n\r\n##### CONFIGURATION\r\nN/A\r\n\r\n##### OS / ENVIRONMENT\r\nN/A\r\n\r\n##### SUMMARY\r\nI have three problems with the current execution:\r\n\r\n1. wait: no still waits. It still waits till the AMI is available or a time_out.\r\n2. As shown below, the tags are present but not displayed as output.\r\n3. When the wait time expires, the AMI is created however the tags are ignored, suggesting they are only added after the wait has expired. I would expect this to happen before on wait: no\r\n\r\n##### STEPS TO REPRODUCE\r\nPlaybook:\r\n\r\n```\r\n    - name: create AMI backup\r\n      ec2_ami:\r\n        region: \"{{ ec2_region }}\"\r\n        instance_id: \"{{ ec2_id }}\"\r\n        wait: no\r\n        no_reboot: yes\r\n        name: \"{{ ec2_tag_Name }}\"\r\n        tags:\r\n          creation: \"{{ ansible_date_time.epoch }}\"\r\n          expiration: \"{{ expiration_date.stdout }}\"\r\n      register: output\r\n```\r\n\r\n##### EXPECTED RESULTS\r\nI expected the following results:\r\n\r\n1. The playbook moves on and does not wait for results\r\n2. Tags are shown in the output\r\n3. Tags show in the AWS console after a time_out has been reached.\r\n\r\n##### ACTUAL RESULTS\r\nOutput on a normal run (after waiting for the task to complete):\r\n\r\n```\r\nTASK [create AMI backup] *******************************************************\r\nchanged: [*.*.*.*]\r\n\r\nTASK [debug] *******************************************************************\r\nok: [*.*.*.*] => {\r\n    \"output\": {\r\n        \"architecture\": \"x86_64\",\r\n        \"block_device_mapping\": {\r\n            \"/dev/sda1\": {\r\n                \"delete_on_termination\": true,\r\n                \"encrypted\": false,\r\n                \"size\": 8,\r\n                \"snapshot_id\": \"snap-*******\",\r\n                \"volume_type\": \"gp2\"\r\n            }\r\n        },\r\n        \"changed\": true,\r\n        \"creationDate\": \"2016-06-29T09:31:56.000Z\",\r\n        \"description\": null,\r\n        \"hypervisor\": \"xen\",\r\n        \"image_id\": \"ami-******\",\r\n        \"is_public\": false,\r\n        \"location\": \"*******/*****-2016-06-monthly\",\r\n        \"msg\": \"AMI creation operation complete\",\r\n        \"ownerId\": \"*******\",\r\n        \"root_device_name\": \"/dev/sda1\",\r\n        \"root_device_type\": \"ebs\",\r\n        \"state\": \"available\",\r\n        \"tags\": {},\r\n        \"virtualization_type\": \"hvm\"\r\n    }\r\n}\r\n```\r\nIn the situation where a time_out occurs:\r\n```\r\n09:12:36\t\t\tTASK [create AMI backup] *******************************************************\r\n09:28:18\t\t\tfatal: [*.*.*.* -> localhost]: FAILED! => {\"changed\": false, \"failed\": true, \"msg\": \"Error while trying to find the new image. Using wait=yes and/or a longer wait_timeout may help.\"}\r\n```\r\n\r\nAlso notice how this is by no means the 300 seconds ( 5 minutes ) specified as the default.\r\n\r\nI think this module needs a good once over to verify the combination of delegation, tags and wait functions properly. Thanks!\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/comments/236311834","html_url":"https://github.com/ansible/ansible-modules-core/issues/4078#issuecomment-236311834","issue_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/4078","id":236311834,"user":{"login":"jjshoe","id":2053992,"avatar_url":"https://avatars.githubusercontent.com/u/2053992?v=3","gravatar_id":"","url":"https://api.github.com/users/jjshoe","html_url":"https://github.com/jjshoe","followers_url":"https://api.github.com/users/jjshoe/followers","following_url":"https://api.github.com/users/jjshoe/following{/other_user}","gists_url":"https://api.github.com/users/jjshoe/gists{/gist_id}","starred_url":"https://api.github.com/users/jjshoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjshoe/subscriptions","organizations_url":"https://api.github.com/users/jjshoe/orgs","repos_url":"https://api.github.com/users/jjshoe/repos","events_url":"https://api.github.com/users/jjshoe/events{/privacy}","received_events_url":"https://api.github.com/users/jjshoe/received_events","type":"User","site_admin":false},"created_at":"2016-07-29T22:43:00Z","updated_at":"2016-07-29T22:43:00Z","body":"@hyperized I think I see the bug, can you test setting wait_timeout to 1 for me?"}}
{"actor":{"display_login":"jjshoe"}}