[ansible-project] Re: How to reformat a yaml dictionary?

2017-06-30 Thread 'J Hawkesworth' via Ansible Project
I'm still bugged I can't figure this out. I can make a list of all components easily enough too - name: make a list of the components set_fact: components: "{{ components|default([]) |union( item.value) }}" with_dict: "{{ components_by_group }}" I haven't figured a

[ansible-project] Re: How to reformat a yaml dictionary?

2017-07-02 Thread Daniel JD
I couldnt get it to work with you variable. It is just bad formatted. If you could format it like this it would be easy: components_by_group: - name: web components: - frontend_app - admin_app - name: database components: - db

[ansible-project] Re: How to reformat a yaml dictionary?

2017-07-03 Thread 'J Hawkesworth' via Ansible Project
Thank you for this. It might well be easier for me to reformat the source variable. The thing I want to avoid most of all is having to maintain two separate variables so the ability to transform from one to another at playbook runtime is the thing I need the most. Jon On Sunday, July 2, 20

Re: [ansible-project] Re: How to reformat a yaml dictionary?

2017-07-03 Thread Pshem Kowalczyk
Hi, If you feel up to it - write a filter plugin. They're quite easy to create. Have a look here for an example: http://www.dasblinkenlichten.com/creating-ansible-filter-plugins/ I use them when I have limited control over the data structure I have to deal with. Even if data manipulation can be do

Re: [ansible-project] Re: How to reformat a yaml dictionary?

2017-07-03 Thread Daniel JD
Lol, how cool is that!!! I never heard about it :O Am Montag, 3. Juli 2017 11:22:57 UTC+2 schrieb Pshem Kowalczyk: > > Hi, > > If you feel up to it - write a filter plugin. They're quite easy to > create. Have a look here for an example: > http://www.dasblinkenlichten.com/creating-ansible-filter

Re: [ansible-project] Re: How to reformat a yaml dictionary?

2017-07-03 Thread 'J Hawkesworth' via Ansible Project
Thanks that's a good idea. I'm struggling to come up with a good name for the filter though. I'll think about it a bit more but best place to start almost seems to be extending with_subelements so the second parameter can be a list (which would at least mean I don't have to come up with a new