title: In Ansible, how do I check if a particular version of MySQL is installed?
body: <p>I have an Ansible task that wraps a rather complex shell script that someone else maintains. This shell script installs a heavily customized web stack, where many of the components are compiled from source. </p>
  
  <p>Every so often, the shell script updates various components to newer versions. When this happens, I want my Ansible template tasks that manage the conf files for those services to fail, so that I can manually review what changed.</p>
  
  <p><strong>Using Ansible, how do I check the installed version of something and register that as a variable that I can use in a later task?</strong></p>
  
  <p>Example: MariaDB is compiled from source, so I want to create an Ansible variable equal to the output of <code>mysql --version</code>.</p>