On Fri, 8 Feb 2019 at 11:04, Georges Martin <jrjsm...@gmail.com> wrote:

> Hello, Alex.
>
> You'll find enclosed my pyjq filter.
>
> Good to know:
>
>    - it lacks even a basic test suite...
>    - TBH, until now, I only used the "jq_all" filter and never the "vars"
>    argument.
>    - a couple of releases ago, pyjq started to return OrderedDict instead
>    of simple dict. My workaround, where necessary: pipe to a "to_json" filter.
>    - for obvious security reasons, I did not implement the "url"
>    argument. I also did not implement the "opener" argument nor the "compile"
>    function.
>
>  Thanks George, I started with https://pypi.org/project/jq/, due to the
OrderedDict usage. It's at https://galaxy.ansible.com/moreati/jq_filter.
I'll add some testing and other niceties soon. Agreed that url and opener
arguments are more trouble than they're worth.

I also included a sample "gather-ilo-facts" playbook. It illustrates one
> simple thing I couldn't do at the time with jmespath: selecting keys with a
> certain prefix...
>
> $ ansible-playbook gather-ilo-facts.yml -k
> SSH password:
>
> PLAY [Gather iLO facts from all iLO hosts] ********************************
>
> TASK [Gather iLO facts] ***************************************************
> ok: [ilo02 -> localhost]
> ok: [ilo01 -> localhost]
> ok: [ilo09 -> localhost]
>
> TASK [Display all iLO facts] **********************************************
> skipping: [ilo01]
> skipping: [ilo02]
> skipping: [ilo09]
>
> TASK [Display hw_eth* MAC address] ****************************************
> ok: [ilo01] =>
>   hw_eth:
>   - hw_eth0: 58:20:B1:E3:xx:xx
>   - hw_eth1: 58:20:B1:E3:xx:xx
>   - hw_eth2: 58:20:B1:E3:xx:xx
>   - hw_eth3: 58:20:B1:E3:xx:xx
>   - hw_eth_ilo: 58:20:B1:0B:xx:xx
> ok: [ilo02] =>
>   hw_eth:
>   - hw_eth0: 58:20:B1:E3:yy:yy
>   - hw_eth1: 58:20:B1:E3:yy:yy
>   - hw_eth2: 58:20:B1:E3:yy:yy
>   - hw_eth3: 58:20:B1:E3:yy:yy
>   - hw_eth_ilo: 58:20:B1:0B:yy:yy
> ok: [ilo09] =>
>   hw_eth:
>   - hw_eth0: 58:20:B1:E3:zz:zz
>   - hw_eth1: 58:20:B1:E3:zz:zz
>   - hw_eth2: 58:20:B1:E3:zz:zz
>   - hw_eth3: 58:20:B1:E3:zz:zz
>   - hw_eth_ilo: 58:20:B1:0B:zz:zz
>
> PLAY RECAP ****************************************************************
> ilo01                  : ok=2    changed=0    unreachable=0    failed=0
> ilo02                  : ok=2    changed=0    unreachable=0    failed=0
> ilo09                  : ok=2    changed=0    unreachable=0    failed=0
>

-- 
Alex Willmer <a...@moreati.org.uk>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to