{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/12527","labels_url":"https://api.github.com/repos/ansible/ansible/issues/12527/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/12527/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/12527/events","html_url":"https://github.com/ansible/ansible/issues/12527","id":108435326,"number":12527,"title":"delegate_to not working correctly in 2.0.0 devel - HAProxy tasks fail","user":{"login":"geerlingguy","id":481677,"avatar_url":"https://avatars.githubusercontent.com/u/481677?v=3","gravatar_id":"","url":"https://api.github.com/users/geerlingguy","html_url":"https://github.com/geerlingguy","followers_url":"https://api.github.com/users/geerlingguy/followers","following_url":"https://api.github.com/users/geerlingguy/following{/other_user}","gists_url":"https://api.github.com/users/geerlingguy/gists{/gist_id}","starred_url":"https://api.github.com/users/geerlingguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geerlingguy/subscriptions","organizations_url":"https://api.github.com/users/geerlingguy/orgs","repos_url":"https://api.github.com/users/geerlingguy/repos","events_url":"https://api.github.com/users/geerlingguy/events{/privacy}","received_events_url":"https://api.github.com/users/geerlingguy/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04"},{"url":"https://api.github.com/repos/ansible/ansible/labels/P2","name":"P2","color":"fad8c7"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/ansible/ansible/milestones/5","html_url":"https://github.com/ansible/ansible/milestones/v2","labels_url":"https://api.github.com/repos/ansible/ansible/milestones/5/labels","id":975800,"number":5,"title":"v2","description":null,"creator":{"login":"bcoca","id":836171,"avatar_url":"https://avatars.githubusercontent.com/u/836171?v=3","gravatar_id":"","url":"https://api.github.com/users/bcoca","html_url":"https://github.com/bcoca","followers_url":"https://api.github.com/users/bcoca/followers","following_url":"https://api.github.com/users/bcoca/following{/other_user}","gists_url":"https://api.github.com/users/bcoca/gists{/gist_id}","starred_url":"https://api.github.com/users/bcoca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcoca/subscriptions","organizations_url":"https://api.github.com/users/bcoca/orgs","repos_url":"https://api.github.com/users/bcoca/repos","events_url":"https://api.github.com/users/bcoca/events{/privacy}","received_events_url":"https://api.github.com/users/bcoca/received_events","type":"User","site_admin":false},"open_issues":16,"closed_issues":344,"state":"open","created_at":"2015-02-11T19:43:06Z","updated_at":"2015-09-30T13:29:26Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-09-26T02:45:41Z","updated_at":"2015-09-30T15:21:09Z","closed_at":"2015-09-30T13:29:26Z","body":"##### Issue Type:\r\n\r\n  - Bug Report\r\n\r\n##### Ansible Version:\r\n\r\nansible 2.0.0 (devel b757798f3e) last updated 2015/09/25 21:12:40 (GMT -500)\r\n\r\n##### Ansible Configuration:\r\n\r\nDefaults.\r\n\r\n##### Environment:\r\n\r\nMac OS X 10.10.4\r\n\r\n##### Summary:\r\n\r\nThis might be related to https://github.com/ansible/ansible/issues/12499, but basically, if I run a particular task with delegate_to and Ansible 2.0.0 devel, the task fails.\r\n\r\nIf I run the same task standalone in its own playbook, directly on the host (just removing `delegate_to`), it succeeds. If I run the same playbook with the failing task in Ansible <= 1.9.3, it succeeds. Only Ansible 2.0.0 devel is failing.\r\n\r\nYou can quickly emulate the entire environment and see the problem using the [deployments-balancer](https://github.com/geerlingguy/ansible-for-devops/tree/master/deployments-balancer) example (it's the exact playbook I'm running, using a set of three VirtualBox VMs configured via the Vagrantfile).\r\n\r\n##### Steps To Reproduce:\r\n\r\nSet up an HAProxy server and at least one server managed by HAProxy as a load balancer (note: this seems like it may be an issue that would affect other delegated tasks, but I've only done testing with HAProxy sockets so far).\r\n\r\nSet up a playbook to run on an app server (that's _not_ the HAProxy host), with a task using the `haproxy` module to manage HAProxy on a delegated host:\r\n\r\n```yaml\r\n---\r\n- hosts: app\r\n  sudo: yes\r\n\r\n  tasks:\r\n    - name: Disable the backend server in HAProxy.\r\n      haproxy:\r\n        state: disabled\r\n        host: 192.168.4.3\r\n        socket: /var/lib/haproxy/stats\r\n        backend: habackend\r\n      delegate_to: 192.168.4.2\r\n```\r\n\r\nRun this playbook.\r\n\r\n##### Expected Results:\r\n\r\nThe playbook should indicate a change occurred, delegated to the HAProxy balancer:\r\n\r\n```\r\nTASK: [Disable the backend server in HAProxy.] ******************************** \r\nchanged: [192.168.4.3 -> 192.168.4.2]\r\n```\r\n\r\n(This is the output from Ansible 1.9.3).\r\n\r\n##### Actual Results:\r\n\r\nThe playbook errors out, with:\r\n\r\n```\r\nTASK [Disable the backend server in HAProxy.] **********************************\r\nfatal: [192.168.4.3 -> 192.168.4.2]: FAILED! => {\"changed\": false, \"failed\": true, \"msg\": \"Traceback (most recent call last):\\r\\n  File \\\"/home/vagrant/.ansible/tmp/ansible-tmp-1443233601.59-214579071947909/haproxy\\\", line 2074, in <module>\\r\\n    main()\\r\\n  File \\\"/home/vagrant/.ansible/tmp/ansible-tmp-1443233601.59-214579071947909/haproxy\\\", line 316, in main\\r\\n    ansible_haproxy.act()\\r\\n  File \\\"/home/vagrant/.ansible/tmp/ansible-tmp-1443233601.59-214579071947909/haproxy\\\", line 287, in act\\r\\n    self.disabled(self.host, self.backend, self.shutdown_sessions)\\r\\n  File \\\"/home/vagrant/.ansible/tmp/ansible-tmp-1443233601.59-214579071947909/haproxy\\\", line 273, in disabled\\r\\n    self.execute(cmd)\\r\\n  File \\\"/home/vagrant/.ansible/tmp/ansible-tmp-1443233601.59-214579071947909/haproxy\\\", line 172, in execute\\r\\n    self.client.connect(self.socket)\\r\\n  File \\\"/usr/lib/python2.7/socket.py\\\", line 224, in meth\\r\\n    return getattr(self._sock,name)(*args)\\r\\nsocket.error: [Errno 2] No such file or directory\\r\\n\", \"parsed\": false}\r\n```\r\n\r\nIf I take the exact same task, and put it in a playbook on its own, and run that playbook directly on the balancer HAProxy server in Ansible 2.0.0 devel (without using delgate_to, basically), everything works fine:\r\n\r\n```yaml\r\n---\r\n- hosts: balancer\r\n  sudo: yes\r\n\r\n  tasks:\r\n    - name: Disable the backend server in HAProxy.\r\n      haproxy:\r\n        state: enabled\r\n        host: '192.168.4.3'\r\n        socket: /var/lib/haproxy/stats\r\n        backend: habackend\r\n```"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/144444559","html_url":"https://github.com/ansible/ansible/issues/12527#issuecomment-144444559","issue_url":"https://api.github.com/repos/ansible/ansible/issues/12527","id":144444559,"user":{"login":"jimi-c","id":26403,"avatar_url":"https://avatars.githubusercontent.com/u/26403?v=3","gravatar_id":"","url":"https://api.github.com/users/jimi-c","html_url":"https://github.com/jimi-c","followers_url":"https://api.github.com/users/jimi-c/followers","following_url":"https://api.github.com/users/jimi-c/following{/other_user}","gists_url":"https://api.github.com/users/jimi-c/gists{/gist_id}","starred_url":"https://api.github.com/users/jimi-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimi-c/subscriptions","organizations_url":"https://api.github.com/users/jimi-c/orgs","repos_url":"https://api.github.com/users/jimi-c/repos","events_url":"https://api.github.com/users/jimi-c/events{/privacy}","received_events_url":"https://api.github.com/users/jimi-c/received_events","type":"User","site_admin":false},"created_at":"2015-09-30T15:21:09Z","updated_at":"2015-09-30T15:21:09Z","body":"Yeah, I threw that in there as a \"just in case\". Normally it will be caused by what you have in your inventory (people using IP's as inventory names), though the JIK was for those times when it might need to fallback to DNS."}}