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 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.
--
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/605449af-ecb2-d036-ad1c-ace1c18288e7%40gmail.com.