title: How to perform bitwise operations in Ansible?
body: <p>Suppose I have this MAC address:</p>
  
  <pre><code>04:f0:21:38:f5:a3
  </code></pre>
  
  <p>I am looking for a way in Ansible to modify this. In this case I need to do the following:</p>
  
  <p>Set the least 4 significant bits to 0.
  Flip the 7th bit.</p>
  
  <p>So that the result is:</p>
  
  <pre><code>06:f0:21:38:f5:a0
  </code></pre>
  
  <p>Is there an easy way to do this in Ansible?</p>