Skip to content

Commit

Permalink
Finishes vSphereDB module integration
Browse files Browse the repository at this point in the history
  • Loading branch information
mocdaniel committed Nov 21, 2023
1 parent 765bf30 commit 068bbb5
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 7 deletions.
1 change: 1 addition & 0 deletions roles/icingaweb2/files/icinga-vspheredb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d /run/icinga-vspheredb 0755 icingavspheredb icingaweb2 -
67 changes: 61 additions & 6 deletions roles/icingaweb2/tasks/modules/vspheredb.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,72 @@
- name: Module Vspheredb | Install
debug:
msg: Installed VsphereDB Modul
---
# Needed because the role sets different permissions for modules and git fails when checking it in task #2
- name: Module vSphereDB | Clean up module directory
ansible.builtin.file:
state: absent
path: "{{ icingaweb2_config.global.module_path }}/{{ module }}"
loop:
- vspheredb
- incubator
loop_control:
loop_var: module

- name: Module vSphereDB | Install modules from source
ansible.builtin.git:
name: https://github.com/icinga/icingaweb2-module-{{ repo_info.name }}
dest: "{{ icingaweb2_config.global.module_path }}/{{ repo_info.name }}"
version: "{{ repo_info.version }}"
loop:
- name: vspheredb
version: v1.7.1
- name: incubator
version: v0.20.0
loop_control:
loop_var: repo_info

- name: Module vSphereDB | Ensure incubator is enabled
ansible.builtin.command: icingacli module enable incubator

- name: Module vSphereDB | Ensure service user exists
ansible.builtin.user:
name: icingavspheredb
group: icingaweb2
system: true
home: /var/lib/icingavspheredb
shell: /bin/false

- name: Module vSphereDB | Ensure service user home exists
ansible.builtin.file:
state: directory
dest: /var/lib/icingavspheredb
owner: icingavspheredb
group: icingaweb2
mode: "0750"

- name: Module vSphereDB | Ensure service file is installed
ansible.builtin.copy:
src: "{{ icingaweb2_config.global.module_path }}/vspheredb/contrib/systemd/icinga-vspheredb.service"
dest: "/etc/systemd/system/{{ icingaweb2_vspheredb_service }}"
remote_src: true
mode: "0644"

- name: Module vSphereDB | Ensure socket file is copied
ansible.builtin.copy:
src: icinga-vspheredb.conf
dest: /etc/tmpfiles.d/{{ icingaweb2_vspheredb_service.replace('.service', '') }}.con
mode: 0644

- name: Module vSphereDB | Ensure socket file is installed
ansible.builtin.command: systemd-tmpfiles --create /etc/tmpfiles.d/{{ icingaweb2_vspheredb_service.replace('.service', '') }}.conf

- name: Module Vspheredb | Ensure config directory
- name: Module vSphereDB | Ensure config directory
ansible.builtin.file:
state: directory
dest: "{{ icingaweb2_modules_config_dir }}/vspheredb"
owner: "{{ icingaweb2_httpd_user }}"
group: "{{ icingaweb2_group }}"
mode: "2770"

- name: Module Vspheredb | Manage config files
- name: Module vSphereDB | Manage config files
ansible.builtin.include_tasks: manage_module_config.yml
loop: "{{ _files }}"
loop_control:
Expand All @@ -23,8 +77,9 @@
_files:
- config

- name: Module Vspheredb | Ensure daemon is running
- name: Module vSphereDB | Ensure daemon is running
ansible.builtin.service:
name: "{{ icingaweb2_vspheredb_service }}"
state: started
enabled: yes
failed_when: false # this is a bit buggy because we only activate the module later in the role
1 change: 0 additions & 1 deletion roles/icingaweb2/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ icingaweb2_module_packages:
icingadb: icingadb-web
director: icinga-director
businessprocess: icinga-businessprocess
vspheredb: icingaweb2-module-vspheredb

0 comments on commit 068bbb5

Please sign in to comment.