Bootstrap FreeKB - Ansible - run_once parameter
Ansible - run_once parameter

Updated:   |  Ansible articles

The run_once parameter can be used to run a task one time. This is typically used when you are doing something on the control node (that's your Ansible server). In this example, the set_fact module and the lookup plugin are used to store the contents of the foo.txt file into a variable named foo, and run_once is used to ensure this task is only ran one time.

- set_fact:
    foo: "{{ lookup('file', 'foo.txt') }}"
    run_once: true

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 0f22a7 in the box below so that we can be sure you are a human.