Thank you again. I was able to add it with the |from_yaml like you
suggested
- set_fact:
my_data: "{{lookup('file','patchlist.txt')|from_yaml}}"
and then in the whitelist option of win_updates:
whitelist: "{{my_data}}"
The only caveat is that I need to make my patchlist.txt file to be in the
form of
- patch1
- patch2
instead of it normally being
patch1
patch2
Is there an easy way as part of the Ansible playbook or in the lookup
function itself to read the normal file and then convert it to having the -
automatically? Or should I add a new play in the playbook to add the "- "
in front of the file?
On Monday, August 26, 2019 at 10:15:51 AM UTC-4, Vladimir Botka wrote:
>
> On Mon, 26 Aug 2019 05:53:03 -0700 (PDT)
> Tuyen Nguyen <[email protected] <javascript:>> wrote:
>
> > Actually, it didn't quite work :( The task was able to run through but
> I
> > just realized it was not importing the file in correct as a list for the
> > whitelist.
>
> Use "from_yaml" filter and take a look what you get
>
> - set_fact:
> my_data: "{{ lookup('file','patchlist.txt')|from_yaml }}"
> - debug:
> var: my_data
>
> Then use "my_data" in the update. This should be something similar to the
> line below
>
> whitelist: "{{ my_data.<name_of_the_list_inside_patchlist_txt> }}"
>
> Cheers,
>
> -vlado
>
--
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/c51abd09-f9cd-44ee-9a97-697f1634ee40%40googlegroups.com.