list.yml 797 B

1234567891011121314151617181920212223242526272829
  1. ---
  2. - name: Generate oo_list_hosts group
  3. hosts: localhost
  4. gather_facts: no
  5. vars_files:
  6. - vars.yml
  7. tasks:
  8. - set_fact: scratch_group=tag_env-{{ cluster_id }}
  9. when: cluster_id != ''
  10. - set_fact: scratch_group=all
  11. when: cluster_id == ''
  12. - add_host:
  13. name: "{{ item }}"
  14. groups: oo_list_hosts
  15. ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
  16. ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
  17. with_items: groups[scratch_group] | default([]) | difference(['localhost'])
  18. - name: List Hosts
  19. hosts: oo_list_hosts
  20. - name: List Hosts
  21. hosts: localhost
  22. gather_facts: no
  23. vars_files:
  24. - vars.yml
  25. tasks:
  26. - debug:
  27. msg: "{{ hostvars | oo_select_keys(groups[scratch_group] | default([])) | oo_pretty_print_cluster }}"