I need to run a command on the target server that accepts data through stdin only. The data I'm feeding it comes from a template file and contains sensitive data, so I'd rather not have it sitting in the filesystem even for a second.
I'm trying to find a way to grab the output of a template task so I can pass it to the command. Something like:
- name: generate data
template:
src: data.j2
dest: [I'd rather not have any files written]
register: myvar
- name: run command
shell: "command < {{ myvar }}"
Is a better way to go about this that doesn't involve writing a temporary file, feeding it to the command and then erasing it?