---
# Install local facts (directory)
- name: Install local facts directory
  become: "{{ lib_action_become_enable|default(omit) }}"
  become_user: "{{ lib_action_become_user|default(omit) }}"
  become_method: "{{ lib_action_become_method|default(omit) }}"
  file:
    state: directory
    dest: "{{ util_local_facts_directory|default('/etc/ansible/facts.d') }}"
    mode: "{{ dir_mode|default(0755) }}"
    owner: "{{ util_persistent_data_path_remote_owner|default(omit) }}"
    group: "{{ util_persistent_data_path_remote_group|default(omit) }}"

- name: Install local facts
  become: "{{ lib_action_become_enable|default(omit) }}"
  become_user: "{{ lib_action_become_user|default(omit) }}"
  become_method: "{{ lib_action_become_method|default(omit) }}"
  register: lib_registered_install_role_local_facts
  template:
    src: "{{ role_path }}/templates/{{ template|default('facts.j2') }}"
    dest: "{{ util_local_facts_directory|default('/etc/ansible/facts.d') }}/{{ role_name }}.yml"
    mode: "{{ file_mode|default(0644) }}"
    owner: "{{ util_persistent_data_path_remote_owner|default(omit) }}"
    group: "{{ util_persistent_data_path_remote_group|default(omit) }}"

- name: Re-read local facts
  when: lib_registered_install_role_local_facts.changed
  setup:
    filter: ansible_local
    fact_path: "{{ util_local_facts_directory|default('/etc/ansible/facts.d') }}"

Add tasks for creating local facts
Add tasks for creating local facts

Signed-off-by: Mark Kusch <100d753b1bf12c46cb1704d669587da1096d0b23@silpion.de>
