custom-facts: init
This commit is contained in:
parent
a8f0a4c048
commit
23cc76ac06
7 changed files with 45 additions and 0 deletions
9
roles/custom-facts/defaults/main.yml
Normal file
9
roles/custom-facts/defaults/main.yml
Normal 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'
|
3
roles/custom-facts/files/README.md
Normal file
3
roles/custom-facts/files/README.md
Normal 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)
|
1
roles/custom-facts/files/amdgpu.fact
Symbolic link
1
roles/custom-facts/files/amdgpu.fact
Symbolic link
|
@ -0,0 +1 @@
|
|||
/home/jlay/git/ansible-facts/facts.d/amdgpu.fact
|
1
roles/custom-facts/files/os.fact
Symbolic link
1
roles/custom-facts/files/os.fact
Symbolic link
|
@ -0,0 +1 @@
|
|||
/home/jlay/git/ansible-facts/facts.d/os.fact
|
1
roles/custom-facts/files/tuned.fact
Symbolic link
1
roles/custom-facts/files/tuned.fact
Symbolic link
|
@ -0,0 +1 @@
|
|||
/home/jlay/git/ansible-facts/facts.d/tuned.fact
|
6
roles/custom-facts/handlers/main.yml
Normal file
6
roles/custom-facts/handlers/main.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
# handlers file for 'custom-facts' role
|
||||
---
|
||||
- name: Re-gather facts
|
||||
ansible.builtin.setup:
|
||||
listen: regather_facts
|
||||
|
24
roles/custom-facts/tasks/main.yml
Normal file
24
roles/custom-facts/tasks/main.yml
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue