This works for me:
- name: populate service facts
service_facts:
- name: populate running services into a list
set_fact:
services_running: "{{ services_running|default([]) + [ item ] }}"
loop: "{{ services.keys() | flatten(1) }}"
when: services[item].state == 'running'
This is with Ansible 2.8.0 on RHEL 7.6
On Mon, Aug 12, 2019 at 6:26 PM Vladimir Botka <[email protected]> wrote:
>
> It works for me with Ansible 2.7.9 and Ubuntu 18.04. YMMV.
>
> https://github.com/vbotka/ansible-examples/blob/master/examples/example-009/service_facts_03.yml
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAK2viQXsz9kiyuw3Rt0MwBsK2aSyx%2BsdNkcXSikk6Z3gykG5Nw%40mail.gmail.com.