This is an indispensable script that I expected to print the same random number three times. Instead, he prints three random numbers. How to assign a random number to a variable inaccessible so that it is fixed throughout the play?
--- - 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
ansible ansible-playbook
Ernsibl
source share