Answer the question
In order to leave comments, you need to log in
Ansible. How to use another module in a module?
Hello everyone, I'm trying to figure out Ansible
There is a simple task of iterating playbooks from tasks/
Let's say I pass its own path to each *.yml and return the result {{ register }} to the main playbook.
tasks:
- include: "{{ item }}"
vars:
name_task: "{{ item} }"
with_fileglob:
- tasks/*.yml
- local_action:
module: copy
content: "register.stdout_lines|join('\n') }}"
dest: "file.log"
tasks:
- include: "{{ item }}"
vars:
name_task: "{{ item} }"
local_action:
module: copy
content: "{{ register.stdout_lines|join('\n') }}"
dest: "file.log"
with_fileglob:
- tasks/*.yml
Answer the question
In order to leave comments, you need to log in
you can try to use block
or nested include_tasks
And if there is no requirement that the output file be replenished immediately after execution, then register for a loop creates an array of data, which can be written at the end
According to the task, it is clear that you have an initially incorrect task and the solution of the
Cars is all known, they are not generated, so you don’t need to look for them there somehow, just rewrite them once
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question