{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/14302","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/14302/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/14302/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/14302/events","html_url":"https://github.com/ansible/ansible/issues/14302","id":131291322,"number":14302,"title":"Help (maybe bug) using with_items in combination with groups and jinja2 filter","user":{"login":"hExPY","id":8867063,"avatar_url":"https://avatars.githubusercontent.com/u/8867063?v=3","gravatar_id":"","url":"https://api.github.com/users/hExPY","html_url":"https://github.com/hExPY","followers_url":"https://api.github.com/users/hExPY/followers","following_url":"https://api.github.com/users/hExPY/following{/other_user}","gists_url":"https://api.github.com/users/hExPY/gists{/gist_id}","starred_url":"https://api.github.com/users/hExPY/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hExPY/subscriptions","organizations_url":"https://api.github.com/users/hExPY/orgs","repos_url":"https://api.github.com/users/hExPY/repos","events_url":"https://api.github.com/users/hExPY/events{/privacy}","received_events_url":"https://api.github.com/users/hExPY/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-04T09:37:51Z","updated_at":"2016-02-04T12:58:53Z","closed_at":null,"body":"Hey guys,\r\n\r\ni think i found a bug since version 2.0.0.0\r\n> ansible --version\r\n> ansible 2.0.1.0\r\n>   config file = /zuul/home/immonet/ansible/ansible.cfg\r\n>   configured module search path = Default w/o overrides\r\n\r\nWhen i try to run this task (part of a role) and the variable lbhostsgen is \"**head**\":\r\n\r\n>      - name: blacklist current server in pen processes\r\n>        #shell: echo disabling \"{{ inventory_hostname }}\" >> /tmp/tmpoutput.log\r\n>        shell: penctl 127.0.0.1:8124 server `penctl 127.0.0.1:8124 servers | grep \\`host {{ inventory_hostname }} | awk '{print $NF}'\\` | awk '{print $1}'` blacklist 86400\r\n>        register: lb_block\r\n>        delegate_to: \"{{ item }}\"\r\n>        with_items: groups.uaweb | intersect(groups.{{ lbhostsgen }}\r\n\r\n\r\nI get this strange error while executing:\r\n\r\n> **TASK [wildfly-service-deploy : blacklist current server in pen processes] ******\r\n> task path: /zuul/home/immonet/ansible/roles/wildfly-service-deploy/tasks/main.yml:21\r\n> <( groups.uaweb | intersect(groups.head) )> ESTABLISH SSH CONNECTION FOR USER: None\r\n> <( groups.uaweb | intersect(groups.head) )> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/zuul/home/immonet/.ansible/cp/ansible-ssh-%h-%p-%r -tt '( groups.uaweb | intersect(groups.head) )' '/bin/sh -c '\"'\"'( umask 22 && mkdir -p \"$( echo $HOME/.ansible/tmp/ansible-tmp-1454578044.06-45666928488707 )\" && echo \"$( echo $HOME/.ansible/tmp/ansible-tmp-1454578044.06-45666928488707 )\" )'\"'\"''\r\n> fatal: [vsvc-head1]: UNREACHABLE! => {\"changed\": false, \"msg\": \"All items completed\", \"results\": [{\"item\": \"( groups.uaweb | intersect(groups.head) )\", \"msg\": \"SSH encountered an unknown error. The output was:\\nOpenSSH_6.0p1 Debian-4+deb7u2, OpenSSL 1.0.1e 11 Feb 2013\\ndebug1: Reading configuration data /etc/ssh/ssh_config\\r\\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\\r\\ndebug1: auto-mux: Trying existing master\\r\\ndebug1: Control socket \\\"/zuul/home/immonet/.ansible/cp/ansible-ssh-( groups.uaweb | intersect(groups.head) )-22-immonet\\\" does not exist\\r\\ndebug2: ssh_connect: needpriv 0\\r\\nssh: Could not resolve hostname ( groups.uaweb | intersect(groups.head) ): Name or service not known\\r\\n\", \"unreachable\": true}]}\r\n> \tto retry, use: --limit @/zuul/home/immonet/ansible/relocation-employee.retry**\r\n\r\nThis is my inventory file:\r\n\r\n> [head]\r\n> vua-head\r\n> vsvc-head1\r\n> vuaphp1\r\n> \r\n> [uaweb]\r\n> vua-head\r\n> vua-rc1\r\n\r\nWith my understanding ansible isn't able to resolve the with_items parameter **groups.uaweb | intersect(groups.{{ lbhostsgen }}**.\r\n\r\nMaybe you guys can help me out.\r\n\r\nKind regards,\r\nMarvyn\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/179820797","html_url":"https://github.com/ansible/ansible/issues/14302#issuecomment-179820797","issue_url":"https://api.github.com/repos/ansible/ansible/issues/14302","id":179820797,"user":{"login":"hExPY","id":8867063,"avatar_url":"https://avatars.githubusercontent.com/u/8867063?v=3","gravatar_id":"","url":"https://api.github.com/users/hExPY","html_url":"https://github.com/hExPY","followers_url":"https://api.github.com/users/hExPY/followers","following_url":"https://api.github.com/users/hExPY/following{/other_user}","gists_url":"https://api.github.com/users/hExPY/gists{/gist_id}","starred_url":"https://api.github.com/users/hExPY/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hExPY/subscriptions","organizations_url":"https://api.github.com/users/hExPY/orgs","repos_url":"https://api.github.com/users/hExPY/repos","events_url":"https://api.github.com/users/hExPY/events{/privacy}","received_events_url":"https://api.github.com/users/hExPY/received_events","type":"User","site_admin":false},"created_at":"2016-02-04T12:58:53Z","updated_at":"2016-02-04T12:58:53Z","body":"Hi @dagwieers,\r\n\r\nthanks for telling me whats the problem. Do you know any solution to fix it?\r\nI mean i only want to iterate trough a list of hosts which includes all hosts which are in Group A and Group B. (group_a:&group_b)"}}