ansible-ghetto-json icon indicating copy to clipboard operation
ansible-ghetto-json copied to clipboard

Add support to extend and append to json lists

Open moises-silva opened this issue 9 years ago • 5 comments

Hope this looks acceptable. Makes simpler appending or extending lists in json files.

moises-silva avatar Jan 13 '16 15:01 moises-silva

This is going to be non-idempotent, right?

Is there a good way to document or warn people about that? I don't know of many other non-idempotent modules.

FauxFaux avatar Jan 16 '16 21:01 FauxFaux

@FauxFaux It is idempotent, it will just add the elements that are not already there (so it works more like a set than a list). See the example I added to the README.md file. I intentionally added 3 elements, one of which was already present, so it ends up appending only the other 2.

moises-silva avatar Jan 17 '16 17:01 moises-silva

@FauxFaux ping? anything else you need from me?

moises-silva avatar Feb 01 '16 20:02 moises-silva

Looks like this behaviour is no longer supported. With Ansible 2.4 at least

ERROR! this task 'ghetto_json' has extra params, which is only allowed in the following modules: command, win_command, shell, win_shell, script, include, include_vars, include_tasks, include_role, import_tasks, import_role, add_host, group_by, set_fact, raw, meta

willis7 avatar Jul 04 '18 20:07 willis7

Please look at https://github.com/FauxFaux/ansible-ghetto-json/issues/6#issuecomment-594509703 for a solution to support multiple use-cases in a single call.

dagwieers avatar Mar 04 '20 13:03 dagwieers