title: generating a numeric hash for a string in Ansible
body: <p>I need to generate a unique TCP port number for a given string (I need this to mock a response from a server, unique for each string).</p>
  
  <p>I want to use a string parameter as a source for this port number. In other words, I need to generate a numeric hash in a given range (1000-32767) from an arbitrary string.</p>
  
  <p>I can do this in Python with no issues, but I don't know how to do it in Ansible.</p>
  
  <p>Is there any way to generate a stable numeric in range hash from a string in Ansible?</p>
  
  <p>An example of a play:</p>
  
  <pre><code> - hosts: localhost
     gather_facts: no
     tasks:
       - debug: msg="Hash for {{ item }} is {{ item |HELP_ME_HERE }}"
         with_items:
          - string1
          - string_two
  </code></pre>