This slurp worked for me:
|- name: Slurp the file vars: ansible_become: yes ansible_become_method:
sudo ansible_become_user: root slurp: src: "{{ restricted_file }}"
delegate_to: "{{ controller_host }}" register: slop - name: Set a fact
set_fact: slick: "{{ slop.content | b64decode | from_yaml }}" |
I'm still curious, though, why there would be root-only vars files on
your controller.
On 3/17/22 4:49 PM, jean-christophe manciot wrote:
@[email protected]
I just need to let the user running the playbook access files which
cannot be accessed to any other user (except root of course).
I'm very surprised that this limitation exist with that module.
@Brian Coca
I just don't understand why the ansible team has decided that become
keywords cannot affect include_vars. It's just a module that always
runs on the controller, but what's the difference with all other
modules which are affected by become keywords but are delegated on the
localhost? It just does not make any sense to me. Or maybe I'm missing
a fundamental piece of the inner workings.
--
Todd
--
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/0d4c9eda-67ad-b55c-35cf-79647f11ee95%40gmail.com.