44 updates : " {{ local_fact_updates }}"
55 vars :
66 update_paths : " {{ ansible__local_fact_updates | map(attribute='path') |
7- map('regex_replace', '^ansible_local\\ .' + __ansible__local_fact_name + '\\ .|^ansible_local\\ .', '') |
7+ map('regex_replace', '^ansible_local\\ .' + ansible__local_fact_name + '\\ .|^ansible_local\\ .', '') |
88 map('regex_replace', '^(?!__ansible__local_facts\\ .)(.*)$', '__ansible__local_facts.\\ 1') }}"
99 local_fact_updates : " {{ {'path': update_paths, 'value': (ansible__local_fact_updates | map(attribute='value'))} |
1010 aybarsm.helper.to_list_of_dicts }}"
1111 register : ansible__update_local_facts
12-
13- - name : Import assign host local facts tasks for re-assignment
14- ansible.builtin.import_tasks :
15- file : assign_local_facts.yml
16- vars :
17- ansible__updated_local_facts : " {{ ansible__update_local_facts.__ansible__local_facts }}"
18-
19- - name : Settle local facts on host if changed
20- become : true
21- ansible.builtin.template :
22- src : " {{ ansible__local_fact_template }}"
23- dest : " {{ ansible__local_fact_file }}"
24- backup : " {{ ansible__local_fact_backup | default(omit) | bool }}"
25- vars :
26- on_host : " {{ ansible_local[__ansible__local_fact_name] | default({}) | b64encode }}"
27- on_runtime : " {{ __ansible__local_facts | default({}) | b64encode }}"
28- ansible_callback_diy_runner_on_skipped_msg : |
29- skipping: [{{ inventory_hostname }}]
30- msg: {{ (not ansible_check_mode and on_host != on_runtime) | ternary("Host local facts not changed.", "DRY-RUN") }}
31- ansible_callback_diy_runner_on_skipped_msg_color : green
32- when : on_host != on_runtime
3312 notify : " ansible__local_facts_reread"
34- register : ansible__local_facts_settle
35-
36- # - name: Re-read local facts from the host
37- # become: true
38- # ansible.builtin.setup:
39- # filter: ansible_local
40- # register: ansible__host_facts_reread
41- # when: ansible__host_facts_settle.changed
4213
4314- name : Re-read local facts on the host if they have been modified
4415 ansible.builtin.meta : ' flush_handlers'
0 commit comments