0

I try get ansible facts and don't understand how correctly write filter. I need get 2 facts - ansible_lsb and ansible_hostname. Example:

ansible 192.168.250.* -m setup -a 'filter=ansible_(hostname|lsb)'

but it not work. Need help, how to show some facts? Thanks

Nikita
  • 79
  • 2
  • 3
  • 13

1 Answers1

0

filter pattern in setup module is a simple "filename" pattern.
It uses fnmatch under the hood (see code).

So you can only use simple filters like filter=ansible_user* out of the box.

If you want to make some custom filtering, see my other answer about filtering facts here.

Community
  • 1
  • 1
Konstantin Suvorov
  • 65,183
  • 9
  • 162
  • 193