title: Compare two variables in Ansible
body: <p>I am writing a script to change passwords on multiple servers. The script accepts username and password as input. </p>
  
  <p>It should ask for password twice and compare if they are equal.</p>
  
  <p>I could not find a way to compare two variables. Here's what I have at the moment:</p>
  
  <pre><code> vars_prompt:
    - name: user_name
      prompt: Enter the user name for password reset
      private: no
  
    - name: pass
      prompt: Enter the password
  
    - name: re-pass
      prompt: Re-enter the password
  
    tasks:
  
      - name: Verify Password
        debug:
          msg: "Equal"
        when: pass is match re-pass
  </code></pre>