I have been struggling to use the lookup for vars feature, specifically
tried something like:
vars:
BUCKET_LIST: "{{ lookup('file', 'test') }}"
vars:
BUCKET_LIST: "{{ lookup('file', 'test') |to_json }}"
Where test is basically just a flat text file, new line separated
What I want to do is to call the variable in a loop so I can use it in
another module, e.g. s3
- name: List s3 bucket
local_action:
module: s3
bucket: "{{ item }}"
mode: list
with_items: "{{ BUCKET_LIST }}"
However from debug I can see that the items are not separated:
ok: [localhost] => (item="test1\ntest2-inputtxt2") => {
"invocation": {
▽ "module_args": {
"msg": "\"test1\\ntest2-inputtxt2\""
},
"module_name": "debug"
},
"item": "\"test1\\ntest2-inputtxt2\"",
"msg": "\"test1\\ntest2-inputtxt2\""
}
Any idea how to properly format with lookup so the item are separated?
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/db1c6acb-3688-467f-b879-cb84f77c2377%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.