Hi,
You have set_fact and the ability to set vars, but when should one use set_fact? In the ansible-doc I see the following example, but when setting ‘one_fact’, what is the benefit instead of defining a var? Wouldn’t it be possible to define vars per host as well? I hope someone can explain me when it would be really useful to use the set_fact module. Is it purely to be able to dynamically perform actions per host based on system vars?
- set_fact:
one_fact: something
other_fact: “{{ local_var * 2 }}”
another_fact: “{{ some_registered_var.results | map(attribute=‘ansible_facts.some_fact’) | list }}”