title: How to assign a random number to a variable in ansible?
body: <p>This is an ansible script that I was expecting to print out the same random number three times. Instead, it prints out three random numbers. How do I assign a random number to a variable in ansible so that it is fixed throughout the playbook?</p>
  
  <pre><code>---
  - name: Test random filter
    hosts: localhost
    gather_facts: False
    vars:
      random_number: "{{ 100 | random }}"
    tasks:
      - name: Print the random number
        debug: var=random_number
      - name: Print the random number
        debug: var=random_number
      - name: Print the random number
        debug: var=random_number
  </code></pre>