as i mentioned above, modules execute on the 'target' host and cannot
access data on the 'master' themselves (the exception is when both
machines are the same, but it has no role/play context at this point).

you can either pass the data by using a lookup module that will read
the files and make the contents available to the module options ore
you need an action_plugin of the same name that can then act on the
'master'. This is how copy works, the action plugin copies the src
file to a temporary dir on the target and then runs the copy module
feeding it the src= as the temporary file it had copied.



On Fri, Jun 5, 2015 at 3:28 AM,  <[email protected]> wrote:
> The role is updating /etc/group and /etc/gshadow system files from various
> sources, such as ldap and a central file which is now in Ansible. That's why
> I created a role and put all related data into it: "defaults", "files",
> "library" and "tasks" directories. Data in "defaults" is read by the
> main.yml task, no problem. But there are various files in "files" directory
> that should be chosen then read by the module located in "library".
>
> On Thursday, June 4, 2015 at 3:16:23 PM UTC+2, Brian Coca wrote:
>>
>> Hi, it might be easier to use lookup plugins to pass the data to the
>> module, I really would need to know what the modules does and how it works
>> before I can tell you the best approach.
>>
>> On Thursday, June 4, 2015, <[email protected]> wrote:
>>>
>>> Hi Brian,
>>>
>>> I've written a Python module in a role using data that I'm going to
>>> change from time to time. That's why I wanted to separate the Python code
>>> from its data, I manually wrote it in a YAML file. I naively thought the
>>> "files" directory of the role would be the best place to keep it, but don't
>>> know how to access it from the running Python module.
>>>
>>> If it's not obvious, maybe I should keep data into the Python code of the
>>> module even if I don't feel it very clean (list of 80+ dictionaries)...
>>>
>>>
>>
>>
>> --
>> Brian Coca
>>
> --
> 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/3d00e8fb-acce-49a4-85f9-abaaccc49963%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 
Brian Coca

-- 
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/CAJ5XC8kLX9_5LF4M7uK_uB-e3cR4gthP8L0vkc7rfKZX-TarVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to