Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature folders inside files #297

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelogs/fragments/feature_folder_inside_file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
minor_changes:
- provide folder structure inside files folder for custom config files

11 changes: 11 additions & 0 deletions doc/role-icinga2/objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ icinga2_custom_config:
path: zones.d/main/myown_command.conf
order: 10
```
The config files can also be structured in subfolders to provide a better overview within the files folder. In this case, the source folder below files must be specified via the "src_folder" parameter.

If we have a file `myown_command_inside_folder.conf` under **files/main/** we can use this as follows

```
icinga2_custom_config:
- name: myown_command_inside_folder.conf
path: zones.d/main/myown_command.conf
src_folder: main/
order: 10
```

## Parser Rules

Expand Down
2 changes: 1 addition & 1 deletion roles/icinga2/tasks/objects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
owner: root
group: root
mode: 0644
src: "files/{{ item.name }}"
src: "files/{{ item.src_folder|default('') }}{{ item.name }}"
dest: "{{ icinga2_fragments_path }}/{{ item.path }}/{{ item.order|default('20')|string }}_{{ item.name }}"
loop: "{{ icinga2_custom_config }}"