--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/19fcdb4b-f04b-4f36-af5e-27a1977bea06n%40googlegroups.com.
---
- hosts: localhost
gather_facts: no
connection: local
vars:
filename: /tmp/centers.yml
tasks:
- set_fact:
centers_data: |
{{ centers_data|default([]) | union([
item if item.center_password != '' else
{
'center_id': item.center_id,
'center_password': lookup('pipe', 'pwgen -sy 48 1')
}
]) }}
loop: "{{ lookup('file', filename)|from_yaml|json_query('centers[]') }}"
- copy:
content: "{{ {'centers': centers_data} | to_nice_yaml }}"
dest: /tmp/out.yml
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/900f6d95-3961-4508-8fc1-21f2db05759an%40googlegroups.com.