From 1af655b3905a10a26822026b3c5576fae7f57887 Mon Sep 17 00:00:00 2001 From: hbaxter Date: Thu, 3 Jul 2025 16:45:28 +0100 Subject: [PATCH] Refactor icinga2 config into roles --- .../roles/icinga2/tasks/icinga2-templates.yml | 88 +++++++++++++++++++ ANSIBLE/roles/icinga2/tasks/main.yml | 3 +- .../templates/etc/icinga2/conf.d/app.conf.j2} | 0 .../templates/etc/icinga2/conf.d/apt.conf.j2} | 0 .../etc/icinga2/conf.d/commands.conf.j2} | 0 .../etc/icinga2/conf.d/downtimes.conf.j2} | 0 .../etc/icinga2/conf.d/groups.conf.j2} | 0 .../etc/icinga2/conf.d/hosts.conf.j2} | 0 .../etc/icinga2/conf.d/notifications.conf.j2} | 0 .../etc/icinga2/conf.d/services.conf.j2} | 0 .../etc/icinga2/conf.d/templates.conf.j2} | 0 .../etc/icinga2/conf.d/timeperiods.conf.j2} | 0 .../etc/icinga2/conf.d/users.conf.j2} | 0 13 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 ANSIBLE/roles/icinga2/tasks/icinga2-templates.yml rename ANSIBLE/{files/monitor.telos.digital/conf.d/app.conf => roles/icinga2/templates/etc/icinga2/conf.d/app.conf.j2} (100%) rename ANSIBLE/{files/monitor.telos.digital/conf.d/apt.conf => roles/icinga2/templates/etc/icinga2/conf.d/apt.conf.j2} (100%) rename ANSIBLE/{files/monitor.telos.digital/conf.d/commands.conf => roles/icinga2/templates/etc/icinga2/conf.d/commands.conf.j2} (100%) rename ANSIBLE/{files/monitor.telos.digital/conf.d/downtimes.conf => roles/icinga2/templates/etc/icinga2/conf.d/downtimes.conf.j2} (100%) rename ANSIBLE/{files/monitor.telos.digital/conf.d/groups.conf => roles/icinga2/templates/etc/icinga2/conf.d/groups.conf.j2} (100%) rename ANSIBLE/{files/monitor.telos.digital/conf.d/hosts.conf => roles/icinga2/templates/etc/icinga2/conf.d/hosts.conf.j2} (100%) rename ANSIBLE/{files/monitor.telos.digital/conf.d/notifications.conf => roles/icinga2/templates/etc/icinga2/conf.d/notifications.conf.j2} (100%) rename ANSIBLE/{files/monitor.telos.digital/conf.d/services.conf => roles/icinga2/templates/etc/icinga2/conf.d/services.conf.j2} (100%) rename ANSIBLE/{files/monitor.telos.digital/conf.d/templates.conf => roles/icinga2/templates/etc/icinga2/conf.d/templates.conf.j2} (100%) rename ANSIBLE/{files/monitor.telos.digital/conf.d/timeperiods.conf => roles/icinga2/templates/etc/icinga2/conf.d/timeperiods.conf.j2} (100%) rename ANSIBLE/{files/monitor.telos.digital/conf.d/users.conf => roles/icinga2/templates/etc/icinga2/conf.d/users.conf.j2} (100%) diff --git a/ANSIBLE/roles/icinga2/tasks/icinga2-templates.yml b/ANSIBLE/roles/icinga2/tasks/icinga2-templates.yml new file mode 100644 index 0000000..d392f26 --- /dev/null +++ b/ANSIBLE/roles/icinga2/tasks/icinga2-templates.yml @@ -0,0 +1,88 @@ +--- +- name: Template app.conf + template: + src: etc/icinga2/conf.d/app.conf.j2 + dest: /etc/icinga2/conf.d/app.conf + owner: nagios + group: nagios + mode: '0644' + notify: Restart Icinga2 +- name: Template apt.conf + template: + src: etc/icinga2/conf.d/apt.conf.j2 + dest: /etc/icinga2/conf.d/apt.conf + owner: nagios + group: nagios + mode: '0644' + notify: Restart Icinga2 +- name: Template commands.conf + template: + src: etc/icinga2/conf.d/commands.conf.j2 + dest: /etc/icinga2/conf.d/commands.conf + owner: nagios + group: nagios + mode: '0644' + notify: Restart Icinga2 +- name: Template downtimes.conf + template: + src: etc/icinga2/conf.d/downtimes.conf.j2 + dest: /etc/icinga2/conf.d/downtimes.conf + owner: nagios + group: nagios + mode: '0644' + notify: Restart Icinga2 +- name: Template groups.conf + template: + src: etc/icinga2/conf.d/groups.conf.j2 + dest: /etc/icinga2/conf.d/groups.conf + owner: nagios + group: nagios + mode: '0644' + notify: Restart Icinga2 +- name: Template hosts.conf + template: + src: etc/icinga2/conf.d/hosts.conf.j2 + dest: /etc/icinga2/conf.d/hosts.conf + owner: nagios + group: nagios + mode: '0644' + notify: Restart Icinga2 +- name: Template notifications.conf + template: + src: etc/icinga2/conf.d/notifications.conf.j2 + dest: /etc/icinga2/conf.d/notifications.conf + group: nagios + mode: '0644' + notify: Restart Icinga2 +- name: Template services.conf + template: + src: etc/icinga2/conf.d/services.conf.j2 + dest: /etc/icinga2/conf.d/services.conf + owner: nagios + group: nagios + mode: '0644' + notify: Restart Icinga2 +- name: Template templates.conf + template: + src: etc/icinga2/conf.d/templates.conf.j2 + dest: /etc/icinga2/conf.d/templates.conf + owner: nagios + group: nagios + mode: '0644' + notify: Restart Icinga2 +- name: Template timeperiods.conf + template: + src: etc/icinga2/conf.d/timeperiods.conf.j2 + dest: /etc/icinga2/conf.d/timeperiods.conf + owner: nagios + group: nagios + mode: '0644' + notify: Restart Icinga2 +- name: Template templates.conf + template: + src: etc/icinga2/conf.d/users.conf.j2 + dest: /etc/icinga2/conf.d/users.conf + owner: nagios + group: nagios + mode: '0644' + notify: Restart Icinga2 \ No newline at end of file diff --git a/ANSIBLE/roles/icinga2/tasks/main.yml b/ANSIBLE/roles/icinga2/tasks/main.yml index bca6060..91506d4 100644 --- a/ANSIBLE/roles/icinga2/tasks/main.yml +++ b/ANSIBLE/roles/icinga2/tasks/main.yml @@ -83,5 +83,6 @@ group: root mode: '0644' notify: Restart Icinga2 - +- name: Setup Icinga2 Templates + include_tasks: icinga2-templates.yml \ No newline at end of file diff --git a/ANSIBLE/files/monitor.telos.digital/conf.d/app.conf b/ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/app.conf.j2 similarity index 100% rename from ANSIBLE/files/monitor.telos.digital/conf.d/app.conf rename to ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/app.conf.j2 diff --git a/ANSIBLE/files/monitor.telos.digital/conf.d/apt.conf b/ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/apt.conf.j2 similarity index 100% rename from ANSIBLE/files/monitor.telos.digital/conf.d/apt.conf rename to ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/apt.conf.j2 diff --git a/ANSIBLE/files/monitor.telos.digital/conf.d/commands.conf b/ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/commands.conf.j2 similarity index 100% rename from ANSIBLE/files/monitor.telos.digital/conf.d/commands.conf rename to ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/commands.conf.j2 diff --git a/ANSIBLE/files/monitor.telos.digital/conf.d/downtimes.conf b/ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/downtimes.conf.j2 similarity index 100% rename from ANSIBLE/files/monitor.telos.digital/conf.d/downtimes.conf rename to ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/downtimes.conf.j2 diff --git a/ANSIBLE/files/monitor.telos.digital/conf.d/groups.conf b/ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/groups.conf.j2 similarity index 100% rename from ANSIBLE/files/monitor.telos.digital/conf.d/groups.conf rename to ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/groups.conf.j2 diff --git a/ANSIBLE/files/monitor.telos.digital/conf.d/hosts.conf b/ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/hosts.conf.j2 similarity index 100% rename from ANSIBLE/files/monitor.telos.digital/conf.d/hosts.conf rename to ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/hosts.conf.j2 diff --git a/ANSIBLE/files/monitor.telos.digital/conf.d/notifications.conf b/ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/notifications.conf.j2 similarity index 100% rename from ANSIBLE/files/monitor.telos.digital/conf.d/notifications.conf rename to ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/notifications.conf.j2 diff --git a/ANSIBLE/files/monitor.telos.digital/conf.d/services.conf b/ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/services.conf.j2 similarity index 100% rename from ANSIBLE/files/monitor.telos.digital/conf.d/services.conf rename to ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/services.conf.j2 diff --git a/ANSIBLE/files/monitor.telos.digital/conf.d/templates.conf b/ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/templates.conf.j2 similarity index 100% rename from ANSIBLE/files/monitor.telos.digital/conf.d/templates.conf rename to ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/templates.conf.j2 diff --git a/ANSIBLE/files/monitor.telos.digital/conf.d/timeperiods.conf b/ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/timeperiods.conf.j2 similarity index 100% rename from ANSIBLE/files/monitor.telos.digital/conf.d/timeperiods.conf rename to ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/timeperiods.conf.j2 diff --git a/ANSIBLE/files/monitor.telos.digital/conf.d/users.conf b/ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/users.conf.j2 similarity index 100% rename from ANSIBLE/files/monitor.telos.digital/conf.d/users.conf rename to ANSIBLE/roles/icinga2/templates/etc/icinga2/conf.d/users.conf.j2