Hi guys,

I want to get all existent subgroups from a parent group.

Example Playbook:

---
- hosts: "test"

  tasks:
  - group_by:
     key: "{{ansible_distribution}}-{{ansible_distribution_major_version}}"
     parents: "dist"

  - debug: var="{{ groups['dist'] }}"
    run_once: true

#unfortunately I only get all the hosts of the parent group instead the 
groups created by 'group_by'

#Something like {% for group in groups['dist'] %} .... {% endfor %} ??
#or this:
  - name: test
    command: echo {{ item }}
    with_items: "{{ groups['dist'] }}"
    delegate_to: localhost
    run_once: true

#-> only hosts... :-(


Any ideas?

Thanks,
starflighter

Ansible-Version: 

ansible 2.4.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', 
u'/usr/share/ansible/plugins/modules']
  ansible python module location = 
/usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 
20160609]


-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c1357a91-64c7-4ffb-a1b1-92d04d464a36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to