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

[WIP] Feature/install module from git #198

Open
wants to merge 6 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
19 changes: 19 additions & 0 deletions doc/role-icingaweb2/role-icingaweb2.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ The role icingaweb2 installs and configures Icinga Web 2 and its modules.
* [IcingaDB](./module-icingadb.md)
* [Monitoring](./module-monitoring.md)

Custom modules can either be installed via package or git repository.
Therefore set the variable `source` with either `package` or a string consisting `git,repository_url,tag/version/branch`
If no `tag/version/branch` is set the default `HEAD` will be used.

Furthermore it's possible to differentiate between your own custom modules (for example custom themes) and Icinga specific modules.

If you want to manage the config by yourself or the module doesn't need further configuration set the variable `manage_config` to `true` otherwise it needs to be set to `false`

Example:
```
icingaweb2_modules:
my_theme:
enabled: true
manage_config: true
source: git,https://github.com/slalomsk8er/icingaweb2-theme-solarized.git,v1.0.0
```

## Variables

### Icinga Web 2 DB Configuration
Expand Down Expand Up @@ -47,3 +64,5 @@ icingaweb2_resources:
type: ldap
[...]
```


16 changes: 15 additions & 1 deletion roles/icingaweb2/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,23 @@
loop: "{{ icingaweb2_modules | dict2items }}"
when: icingaweb2_modules is defined and icingaweb2_module_packages[item.key] is defined and item.value.enabled is true and item.value.source == "package"

- name: Gather source packages from git
ansible.builtin.set_fact:
icingaweb2_git_packages: "{{ icingaweb2_git_packages + [item] }}"
loop: "{{ icingaweb2_modules | dict2items }}"
when: icingaweb2_modules is defined and item.value.enabled is true and (item.value.source | split(','))[0] == "git"

- name: Include OS specific installation
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family | lower }}.yml"

- name: Install Icingaweb2 Module from Git
ansible.builtin.git:
repo: "{{ (item.value.source | split(','))[1] }}"
dest: "{{ icingaweb2_config['global']['module_path'] }}/{{ item.key }}"
version: "{{ (item.value.source | split(',')[2] | default(omit) }}"
loop: "{{ icingaweb2_git_packages }}"
when: icingaweb2_modules is defined and item.value.enabled is true and (item.value.source | split(','))[0] == "git"

- name: Manage Icinga Web 2 config
ansible.builtin.include_tasks: "manage_icingaweb_config.yml"

Expand All @@ -30,7 +44,7 @@

- name: Configure modules
ansible.builtin.include_tasks: "modules/{{ item.key }}.yml"
when: icingaweb2_modules is defined
when: icingaweb2_modules is defined and (item.value.custom is false or item.value.custom is not defined)
loop: "{{ icingaweb2_modules | dict2items }}"

- name: Manage enabled/disabled modules
Expand Down
1 change: 1 addition & 0 deletions roles/icingaweb2/vars/debian-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
icingaweb2_httpd_user: www-data
icingaweb2_fragments_path: /var/tmp/icingaweb
icingaweb2_packages: ["icingaweb2","icingacli","libapache2-mod-php"]

4 changes: 3 additions & 1 deletion roles/icingaweb2/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
icingaweb2_module_packages:
icingadb: icingadb-web
director: icinga-director
businessprocess: icinga-businessprocess

businessprocess: icinga-businessprocess
icingaweb2_git_packages: []