--- # tasks file for 'custom-facts' role - name: 'Ensure custom facts directory exists' # hosts without Ansible installed benefit from this ansible.builtin.file: state: directory path: /etc/ansible/facts.d owner: root group: root mode: '0755' become: true - name: Copy custom facts ansible.builtin.copy: src: "{{ item.name }}" dest: /etc/ansible/facts.d/ mode: "{{ item.mode }}" # facts may be plainly-readable JSON/INI files, or executables that return JSON owner: root group: root notify: regather_facts loop: "{{ custom_facts }}" become: true - name: Flush pending handlers ansible.builtin.meta: flush_handlers