return code as the input value for another play

Hi,

My goal is to implement 2 separate playbooks from the root main.yml, however, I would like to execute the 2nd playbook only when the 1st gives a return code of 0.

Thanks

Registered variables can’t persists across different plays when the second playbook runs on another host than first playbook. Look at this below solution.

Solution: Store the required variable in a dummy host and refer that variable in another play through dummy host.

Example is given below.

https://serverfault.com/questions/962040/sharing-ansible-variable-between-plays

Thanks,
Ram

Look at AWX/Tower workflows.

https://docs.ansible.com/ansible-tower/latest/html/userguide/workflows.html

Thanks both.

Using Tower, unfortunately, is not something that I can jump over to. Though, i might just give it a read. For now, I have just gone back to calling 2 separate playbooks individually.

Thanks