I’m creating a Workflow template that include several playbooks, what I’m trying to do is to generate a variable from one of the playbooks (let’s say capture the output of a task) and pass it or make it available for the ollowing playbook to be used.
I’ve been looking for some examples on this online and the only one I could find mentioned the use of set_status , but I couldn’t make it work for me. Is this doable? Maybe I’m approaching the issue the wrong way?
I think you’re taking the right approach. set_stats (referred to as artifacts in awx) allow workflow jobs to inherit variables from a parent job. There’s some documentation about the hierarchy here which I hope is helpful.
Not sure set_stats works the way you’re trying to use it. Have a look at set_facts instead. I’ve used set_facts with delegated to and local actions, without any problems. Haven’t really tried caching facts in AWX, but that should work too… meaning the variable will be preserved across job runs.
But that wasn’t the bottom line problem, it was a mix of not setting gather_facts and the hash_behaviour settings of the ansible.cfg (which by default was on replace).