Get a list of --limit servers

I’m using the icinga2-ansible-add-hosts role, which creates config files for each host.
My playbook starts like this:

​try the ‘play_hosts’ variable.​

‘play_hosts’ doesn’t work because the ‘icinga2-ansible-add-hosts’ role is only applied to “{{ hosts | default(‘monitoring_servers’) }}”

What I’m trying to get is the list of hosts that

  • hosts: all
    gather_facts: yes
    runs against, which is not all of the hosts in my inventory.

If you just want to make sure you are going to hit the right hosts before you run the playbook, use the --list-hosts command line parameter option of ansible-playbook.

I use --list-hosts and --list-tasks a lot.

Hope this helps,

Jon