I was not able to find anything on this after a lot of googling.
All i could find were various kinds and ways of importing and including other tasks, but is it not possible to have two tasks in one file, and have one include the other – sort of like functions in most common programming languages? In my specific case i seem to need this to iterate over two lists at once – i tried including the name of the other task in the same file but that didnt work
Ansible – do you have to include/import from other files
ansible
Best Answer
No, this is not possible. You need to move your task to an external file.