Best Practice for a reusable task and its output

What is the best practice to place a task that will be used multiple times across a playbook and the output of this task will be used in the conditionals of the main tasks? I am writing a playbook that

  • does app server patching
  • checks the server status and based on the status performs a few tasks
  • the checks are performed multiple times within the playbook and the output var is used in the condition for the next task