On 1/14/21 6:02 PM, Spadajspadaj wrote:
> 
> On 14/01/2021 17:43, Stefan Hornburg (Racke) wrote:
>> For example (don't get attached to what it does; it's just what I need in 
>> terms of interaction between those two
>> actions):
>>>
>>>       - name: getusers
>>>          shell: "getent passwd | grep /home/remote | cut -d : -f 1"
>>>          register: remoteusers
>>>
>>>        - name: touchy
>>>           file:
>>>              path: '/tmp/{{item}}'
>>>              state: touch
>>>              owner: '{{item}}'
>>>            loop: {{remoteusers.stdout_lines}}
>>>
>> Use getent module instead of the shell (remember that's the last resort):
>>
>>      - name: Retrieve user information
>>        getent:
>>          database: passwd
>>          split: ':'
> 
> Good to know about the getent module. Thx.
> 
> Still it's not about this module as such. 

>
> As I wrote, it's not about what the example does, but how one action relies on

Yes, I understood that but I think it is a nice example for using getent and 
transforming information
regardless :-).

> the output from another. But it seems that stdout_lines should be what I 
> need. For some reason I somehow expected
> ansible to be able only to ingest an output from a command as a whole, not 
> line by line.
> 

It does, check out stdout instead of stdout_lines.

Regards
         Racke

-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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/6591de81-bc04-7800-e057-4856aa1342ae%40linuxia.de.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to