File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed
Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,19 @@ nhc_upgrade: false
4444# nhc_variables:
4545# - NHC_RM=slurm
4646# - HELPERDIR=/opt/nhc/libexec/nhc/
47+
48+ # List of NHC custom scripts
49+ # `src` is mandatory
50+ # `dest` and `state` are optional
51+ nhc_scripts :
52+ # Add a custom script
53+ - src : " {{ inventory_dir }}/files/nhc/custom_script.nhc"
54+ # Add my custom script to custom INCDIR
55+ - src : " {{ inventory_dir }}/files/nhc/custom_script_foo.nhc"
56+ dest : ' /opt/nhc/scripts/custom_script_foo.nhc'
57+ # Remove a custom script
58+ - src : " {{ inventory_dir }}/files/nhc/custom_script_bar.nhc"
59+ state : absent
4760` ` `
4861
4962## Example Playbook
Original file line number Diff line number Diff line change 77
88nhc_packages : nhc
99
10+ # List of custom NHC scripts
11+ # See https://github.com/mej/nhc?tab=readme-ov-file#writing-checks
12+ nhc_scripts : []
13+
1014# Whether to upgrade existing NHC installation
1115# Set to true to upgrade to latest version
1216nhc_upgrade : false
Original file line number Diff line number Diff line change 2828 owner : root
2929 group : root
3030 mode : " 0640"
31+
32+ - name : Install NHC scripts
33+ loop : " {{ nhc_scripts }}"
34+ ansible.builtin.copy :
35+ src : " {{ item.src }}"
36+ dest : " {{ item.dest | default('/etc/nhc/scripts/' + item.src | basename) }}"
37+ owner : root
38+ group : root
39+ mode : " 0644"
40+
41+ - name : Remove NHC scripts
42+ loop : " {{ nhc_scripts }}"
43+ when : item.state == 'absent'
44+ ansible.builtin.file :
45+ path : " {{ item.dest | default('/etc/nhc/scripts/' + item.src | basename) }}"
46+ state : absent
You can’t perform that action at this time.
0 commit comments