Merge pull request #13345 from amenonsen/extract

Add an 'extract' filter
This commit is contained in:
Brian Coca 2015-12-03 11:19:06 -08:00
commit 7d073bdd17
3 changed files with 58 additions and 0 deletions

View file

@ -68,3 +68,13 @@
- '"0.10 GB" == 102400000|human_readable(unit="G")'
- '"0.10 Gb" == 102400000|human_readable(isbits=True, unit="G")'
- name: Container lookups with extract
assert:
that:
- "'x' == [0]|map('extract',['x','y'])|list|first"
- "'y' == [1]|map('extract',['x','y'])|list|first"
- "42 == ['x']|map('extract',{'x':42,'y':31})|list|first"
- "31 == ['x','y']|map('extract',{'x':42,'y':31})|list|last"
- "'local' == ['localhost']|map('extract',hostvars,'ansible_connection')|list|first"
- "'local' == ['localhost']|map('extract',hostvars,['ansible_connection'])|list|first"
- "'ungrouped' == ['localhost']|map('extract',hostvars,['vars','group_names',0])|list|first"