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,9 @@
---
# defaults file for 'custom-facts' role
custom_facts:
- name: amdgpu.fact
mode: '0755' # executable script
- name: os.fact
mode: '0755'
- name: tuned.fact
mode: '0755'

View file

@ -0,0 +1,3 @@
# custom-facts/files
Place any scripts or flat files here. The source for these symbolic links: [joshlay/ansible-facts](https://github.com/joshlay/ansible-facts/tree/master/facts.d)

View file

@ -0,0 +1 @@
/home/jlay/git/ansible-facts/facts.d/amdgpu.fact

View file

@ -0,0 +1 @@
/home/jlay/git/ansible-facts/facts.d/os.fact

View file

@ -0,0 +1 @@
/home/jlay/git/ansible-facts/facts.d/tuned.fact

View file

@ -0,0 +1,6 @@
# handlers file for 'custom-facts' role
---
- name: Re-gather facts
ansible.builtin.setup:
listen: regather_facts

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