-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Role: ansible - Local fact management optimisation completed
- Loading branch information
Showing
4 changed files
with
13 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,3 @@ | ||
--- | ||
- name: Load role related variables | ||
ansible.builtin.include_vars: main.yml | ||
|
||
- name: Include update local facts tasks for initiation | ||
ansible.builtin.include_tasks: update_local_facts.yml | ||
when: | ||
- ansible__role_enabled | bool | ||
- ansible__manage_local_facts | bool | ||
- ansible_local[ansible__local_fact_name] is undefined | ||
ansible.builtin.include_vars: main.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1 @@ | ||
{% if ansible_local[ansible__local_fact_name] is defined and ansible__update_local_facts is defined %} | ||
{% set facts_ansible_settled = ansible_local[ansible__local_fact_name] | default({}) %} | ||
{% set facts_role_update_settled = ansible__update_local_facts.ansible_local[ansible__local_fact_name] | default({}) %} | ||
{% set list_merge_strategy = ansible__local_fact_list_merge_strategy | default('prepend') %} | ||
{% set final_local_facts = facts_ansible_settled | combine(facts_role_update_settled, recursive=true, list_merge=list_merge_strategy) %} | ||
{{ final_local_facts | to_nice_json }} | ||
{% else %} | ||
{ | ||
"init": "{{ now().utcnow().strftime('%Y-%m-%dT%H:%M:%S.%fZ') }}" | ||
} | ||
{% endif %} | ||
{{ host_local_facts | to_nice_json }} |