{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3231","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3231/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3231/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3231/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/3231","id":140324273,"number":3231,"title":"Docker pull: always and state: reloaded redeploys named containers every time","user":{"login":"MrMMorris","id":1494248,"avatar_url":"https://avatars.githubusercontent.com/u/1494248?v=3","gravatar_id":"","url":"https://api.github.com/users/MrMMorris","html_url":"https://github.com/MrMMorris","followers_url":"https://api.github.com/users/MrMMorris/followers","following_url":"https://api.github.com/users/MrMMorris/following{/other_user}","gists_url":"https://api.github.com/users/MrMMorris/gists{/gist_id}","starred_url":"https://api.github.com/users/MrMMorris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrMMorris/subscriptions","organizations_url":"https://api.github.com/users/MrMMorris/orgs","repos_url":"https://api.github.com/users/MrMMorris/repos","events_url":"https://api.github.com/users/MrMMorris/events{/privacy}","received_events_url":"https://api.github.com/users/MrMMorris/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-12T00:20:21Z","updated_at":"2016-03-12T01:15:46Z","closed_at":null,"body":"##### Issue Type:\r\n\r\n - Bug Report\r\n\r\n##### Plugin Name:\r\n\r\nDocker\r\n\r\n##### Ansible Version:\r\n\r\nDoesn't work in 1.9.1 to 2.0.0.2\r\n\r\n##### Ansible Configuration:\r\n\r\n```\r\n[defaults]\r\nhost_key_checking=False\r\ndisplay_skipped_hosts=False\r\nforce_handlers = True\r\nhostfile = inventory/ec2.py\r\nretry_files_enabled = False\r\n\r\n[ssh_connection]\r\npipelining=True\r\n```\r\n\r\n##### Environment:\r\n\r\nUbuntu 14.04 from OSX 10.10\r\n\r\n##### Summary:\r\n\r\nI'm not sure if it ever worked, or if I just imagined it worked, but according to the documentation: \r\n\r\n`\"reloaded\" (added in Ansible 1.9) asserts that all matching containers are running and restarts any that have any images or configuration out of date.`\r\n\r\nThis does not seem to be the case, as named containers that have nothing changed, will be reloaded every time.\r\n\r\nI'm almost positive this was properly working at some point so if someone could try it out to see if maybe it's just something with my setup, that would be great :smile: \r\n\r\n##### Steps To Reproduce:\r\n\r\n```yaml\r\n- name: create redis container\r\n  docker:\r\n    name: redis-test\r\n    image: \"redis:3.0.3\"\r\n    pull: always\r\n    state: reloaded\r\n```\r\n\r\n##### Expected Results:\r\n\r\nWhen a container already exists and it has all the same settings except the dynamically assigned name is different, nothing should happen:\r\n\r\n**First run:**\r\n```\r\nGATHERING FACTS ***************************************************************\r\nok: [x.x.x.x]\r\n\r\nTASK: [docker | create named redis container] *********************\r\nchanged: [x.x.x.x]\r\n```\r\n\r\n**Second run:**\r\n```\r\nGATHERING FACTS ***************************************************************\r\nok: [x.x.x.x]\r\n\r\nTASK: [docker | create named redis container] *********************\r\nok: [x.x.x.x]\r\n```\r\n\r\n##### Actual Results:\r\n\r\nIt will create a new, separate container every time:\r\n\r\n**First run:**\r\n```\r\nGATHERING FACTS ***************************************************************\r\nok: [x.x.x.x]\r\n\r\nTASK: [docker | create redis container] *********************\r\nchanged: [x.x.x.x]\r\n```\r\n\r\n**Second run:**\r\n```\r\nGATHERING FACTS ***************************************************************\r\nok: [x.x.x.x]\r\n\r\nTASK: [docker | create redis container] *********************\r\nchanged: [x.x.x.x]\r\n```\r\n\r\n**Debug output (v1.9.1):**\r\n\r\n```yaml\r\nchanged: [54.209.183.233] => \r\n{\r\n\t\"ansible_facts\": {\r\n\t\t\"docker_containers\": [{\r\n\t\t\t\"Id\": \"ac0311feb2ab0f24de62003197bfe327ee3a46bee416107ccf6df28561b4a50e\",\r\n\t\t\t\"Warnings\": null\r\n\t\t}]\r\n\t},\r\n\t\"changed\": true,\r\n\t\"containers\": [{\r\n\t\t\"Id\": \"ac0311feb2ab0f24de62003197bfe327ee3a46bee416107ccf6df28561b4a50e\",\r\n\t\t\"Warnings\": null\r\n\t}],\r\n\t\"msg\": \"started 1 container, created 1 container.\",\r\n\t\"reload_reasons\": null, <<<---- HUH? if there are no reasons to reload, then why does it happen?\r\n\t\"summary\": {\r\n\t\t\"created\": 1,\r\n\t\t\"killed\": 0,\r\n\t\t\"pulled\": 0,\r\n\t\t\"removed\": 0,\r\n\t\t\"restarted\": 0,\r\n\t\t\"started\": 1,\r\n\t\t\"stopped\": 0\r\n\t}\r\n}\r\n```\r\n\r\n**Debug output (v2.0.0.2):**\r\n\r\n`\"reload_reasons\": \"net (default => bridge)\"` Weird... looking into it\r\n\r\nThis seems to be very similar to https://github.com/ansible/ansible-modules-core/issues/3219, but it is NOT fixed by removing the relevant commit for that issue"},"comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/comments/195623123","html_url":"https://github.com/ansible/ansible-modules-core/issues/3231#issuecomment-195623123","issue_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3231","id":195623123,"user":{"login":"MrMMorris","id":1494248,"avatar_url":"https://avatars.githubusercontent.com/u/1494248?v=3","gravatar_id":"","url":"https://api.github.com/users/MrMMorris","html_url":"https://github.com/MrMMorris","followers_url":"https://api.github.com/users/MrMMorris/followers","following_url":"https://api.github.com/users/MrMMorris/following{/other_user}","gists_url":"https://api.github.com/users/MrMMorris/gists{/gist_id}","starred_url":"https://api.github.com/users/MrMMorris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrMMorris/subscriptions","organizations_url":"https://api.github.com/users/MrMMorris/orgs","repos_url":"https://api.github.com/users/MrMMorris/repos","events_url":"https://api.github.com/users/MrMMorris/events{/privacy}","received_events_url":"https://api.github.com/users/MrMMorris/received_events","type":"User","site_admin":false},"created_at":"2016-03-12T01:15:46Z","updated_at":"2016-03-12T01:15:46Z","body":"2 bugs tracked down in two days! :fireworks: \r\n\r\nThe `reload_reasons` in the 2.0.0.2 output lead me to try removing the Network Mode check and it now works:\r\n\r\nhttps://github.com/ansible/ansible-modules-core/blob/devel/cloud/docker/docker.py#L1405-L1412\r\n\r\nPinging @smashwilson to see if he has any insight. Seems like `\"reload_reasons\": \"net (default => bridge)\"` means that there is something off about the default values or something."}}