I do something similar in a role by generating a YML file, which gets 
included later on by include_vars.

This are the includes in the main.yml of the role:

- include: generate_vars.yml
- include_vars: generated_vars.yml

And this is the task in generate_vars.yml:

shell: |-
  exec >generated_vars.yml
  echo ---
  output_some_data
run_once: true
check_mode: false

I do the generation just once and disable check_mode to avoid errors by 
undefined variables during checks, because in check mode shell scripts are 
not executed.

-- 
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/c760f632-08b8-4b96-ad5f-adccd251e143%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to