custom-facts: init

This commit is contained in:
Josh Lay 2025-07-27 13:28:23 -05:00
parent a8f0a4c048
commit 23cc76ac06
Signed by: jlay
SSH key fingerprint: SHA256:RwEMoWwXniQX1sqHfSD+3z+LKU/TOkv3i1qsy75vfec
7 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,24 @@
---
# 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