I have a custom action plugin that launches a bunch of ec2 instances that receive custom user data. Within that data there is dynamic value that is unique per task but the same for all hosts inside that task. I can generate that value inside the action plugin for the first host, but can’t figure out how to pass it to other hosts. I can save the value into a static variable, but then it would be the same for other tasks. I tried saving the value into inject and inject[‘hostvars’] but it gets lost between runs.
I came across this issue a few times before and it would be awesome if someone can explain how to properly handle global dynamic variables in plugins or else how? The general use case is generating configuration that is shared across all hosts in the task. Cheers.