From 139e06d9afa08e17500a963302dda246916150f6 Mon Sep 17 00:00:00 2001 From: Michel Blanc Date: Wed, 20 Feb 2013 18:13:05 +0100 Subject: [PATCH] Added more examples for the filter option in setup Added examples covering all available globs Added a use case of filtering only facts returned by facter --- library/setup | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/library/setup b/library/setup index 6e70b983fcb..3b82de4d239 100644 --- a/library/setup +++ b/library/setup @@ -52,11 +52,20 @@ notes: bubbled up to the caller. Using the ansible facts and choosing to not install I(facter) and I(ohai) means you can avoid Ruby-dependencies on your remote systems. (See also M(facter) and M(ohai).) + - The filter option filters only the first level subkey below ansible_facts. examples: - code: ansible all -m setup --tree /tmp/facts description: Obtain facts from all hosts and store them indexed by I(hostname) at C(/tmp/facts). - code: ansible all -m setup -a 'filter=ansible_*_mb' - description: Obtain I(only) facts regarding memory from all hosts and output them. + description: Obtain I(only) facts regarding memory found by ansible on all hosts and output them. + - code: ansible all -m setup -a 'filter=facter_*' + description: Display I(only) facts returned by facter. + - code: ansible all -m setup -a 'filter=ansible_eth[0-2]' + description: Displays ansible facts abouts ethernet interfaces eth0, eth1, and eth2. + - code: ansible all -m setup -a 'filter=ansible_eth?' + description: Displays ansible facts abouts ethernet interfaces eth0 through eth9 (but not eth10). + - code: ansible all -m setup -a 'filter=ansible_eth[!0]' + description: Displays ansible facts abouts all ethernet interfaces but eth0. author: Michael DeHaan '''