title: How to validate variables from command line parameters in Ansible?
body: <p>I have a playbook which I execute with:</p>
  
  <pre><code>ansible-playbook -i inventories/staging/ myPlaybook.yml  -e "srv_mode=restart"
  </code></pre>
  
  <p>The variable <code>srv_mode</code> is used in a play. Now I only want to allow "restart" and "start" as its values.</p>
  
  <p>Is there a possibility to evaluate the content of <code>srv_mode</code> at first and to end gracefully with a nice warning in case the value is not supported? </p>