ansible 2.0: limit not working as intended ?

298 views
Skip to first unread message

Mike Christofilopoulos

unread,
Jan 13, 2016, 6:56:03 AM1/13/16
to Ansible Project
im creating my hosts file with

    for f in $(seq 1 10); do echo "host$f" >> hosts; done

and then try to list hosts with


    ansible all -i hosts --limit ~host1 --list-hosts

with this result

  hosts (10):
    host1
    host2
    host3
    host4
    host5
    host6
    host7
    host8
    host9
    host10


Also non regex limit reutnrs

ansible all -i hosts --limit host4 --list-hosts
  hosts (10):
    host1
    host2
    host3
    host4
    host5
    host6
    host7
    host8
    host9
    host10


I've tried googling but nothing came up. Has there been any changes ?

ansible 2.0.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = /usr/share/ansible

and i've installed itwith `pip install --user ansible --upgrade`.


Cheers,
Mike

James Cammarata

unread,
Jan 13, 2016, 8:03:42 AM1/13/16
to ansible...@googlegroups.com
Are you seeing this just with --list-hosts or are you seeing it when running a playbook too?

James Cammarata
Director, Ansible Core Engineering
github: jimi-c

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/81a1731f-957c-48ed-8aa8-19aec8820926%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Christofilopoulos

unread,
Jan 13, 2016, 8:24:24 AM1/13/16
to Ansible Project
playbooks are all right (playbook fails cause hosts are not real btw).


ansible-playbook test.yml -i hosts --limit ~host1

PLAY ***************************************************************************

TASK [setup] *******************************************************************
fatal: [host1]: UNREACHABLE! => {"changed": false, "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue", "unreachable": true}
fatal: [host10]: UNREACHABLE! => {"changed": false, "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue", "unreachable": true}

PLAY RECAP *********************************************************************
host1                      : ok=0    changed=0    unreachable=1    failed=0   
host10                     : ok=0    changed=0    unreachable=1    failed=0   



-----


ansible-playbook test.yml -i hosts 

PLAY ***************************************************************************

TASK [setup] *******************************************************************
fatal: [host3]: UNREACHABLE! => {"changed": false, "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to 
help diagnose the issue", "unreachable": true}
fatal: [host2]: UNREACHABLE! => {"changed": false, "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to 
help diagnose the issue", "unreachable": true}
fatal: [host1]: UNREACHABLE! => {"changed": false, "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to 
help diagnose the issue", "unreachable": true}
fatal: [host4]: UNREACHABLE! => {"changed": false, "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to 
help diagnose the issue", "unreachable": true}
fatal: [host5]: UNREACHABLE! => {"changed": false, "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to 
help diagnose the issue", "unreachable": true}
fatal: [host6]: UNREACHABLE! => {"changed": false, "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to 
help diagnose the issue", "unreachable": true}
fatal: [host7]: UNREACHABLE! => {"changed": false, "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue", "unreachable": true}
fatal: [host10]: UNREACHABLE! => {"changed": false, "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to
 help diagnose the issue", "unreachable": true}
fatal: [host8]: UNREACHABLE! => {"changed": false, "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to 
help diagnose the issue", "unreachable": true}
fatal: [host9]: UNREACHABLE! => {"changed": false, "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to 
help diagnose the issue", "unreachable": true}

PLAY RECAP *********************************************************************
host1                      : ok=0    changed=0    unreachable=1    failed=0   
host10                     : ok=0    changed=0    unreachable=1    failed=0   
host2                      : ok=0    changed=0    unreachable=1    failed=0   
host3                      : ok=0    changed=0    unreachable=1    failed=0   
host4                      : ok=0    changed=0    unreachable=1    failed=0   
host5                      : ok=0    changed=0    unreachable=1    failed=0   
host6                      : ok=0    changed=0    unreachable=1    failed=0   
host7                      : ok=0    changed=0    unreachable=1    failed=0   
host8                      : ok=0    changed=0    unreachable=1    failed=0   
host9                      : ok=0    changed=0    unreachable=1    failed=0   


---------



ansible-playbook test.yml -i hosts --limit host4

PLAY ***************************************************************************

TASK [setup] *******************************************************************
fatal: [host4]: UNREACHABLE! => {"changed": false, "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue", "unreachable": true}

PLAY RECAP *********************************************************************
host4                      : ok=0    changed=0    unreachable=1    failed=0   

Brian Coca

unread,
Jan 13, 2016, 9:46:07 AM1/13/16
to Ansible Project
This is probably a bug that just affects --list-hosts.


--
Brian Coca

James Cammarata

unread,
Jan 13, 2016, 10:17:12 AM1/13/16
to ansible...@googlegroups.com
I agree. Mike, can you open an issue on github for us so we can keep track of this?

Thanks!

James Cammarata
Director, Ansible Core Engineering
github: jimi-c

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Mike Christofilopoulos

unread,
Jan 13, 2016, 10:40:16 AM1/13/16
to Ansible Project
Reply all
Reply to author
Forward
0 new messages