소스 검색

icingaweb2: Add state

Philipp Fromme 2 년 전
부모
커밋
2834134305

+ 7 - 0
icingaweb2/authentication.ini.tmpl

@@ -0,0 +1,7 @@
+[icingaweb2]
+user_class = "{{ icingaweb2_config['authentication']['user_class'] }}"
+filter = "{{ icingaweb2_config['authentication']['filter'] }}"
+user_name_attribute = "{{ icingaweb2_config['authentication']['user_name_attribute'] }}"
+backend = "ldap"
+base_dn = "{{ icingaweb2_config['authentication']['base_dn'] }}"
+resource = "ffho_ldap"

+ 9 - 0
icingaweb2/groups.ini.tmpl

@@ -0,0 +1,9 @@
+[icingaweb2]
+resource = "ffho_ldap"
+user_backend = "icingaweb2"
+group_class = "{{ icingaweb2_config['groups']['group_class'] }}"
+group_filter = "{{ icingaweb2_config['groups']['group_filter'] }}"
+group_name_attribute = "{{ icingaweb2_config['groups']['group_name_attribute'] }}"
+group_member_attribute = "{{ icingaweb2_config['groups']['group_member_attribute'] }}"
+base_dn = "{{ icingaweb2_config['groups']['base_dn'] }}"
+backend = "ldap"

+ 92 - 0
icingaweb2/init.sls

@@ -0,0 +1,92 @@
+#
+# Icingaweb2
+#
+{% set roles = salt['pillar.get']('nodes:' ~ grains.id ~ ':roles', []) %}
+{% set icingaweb2_config = salt['pillar.get']('monitoring:icingaweb2') %}
+
+include:
+  - apt
+  - sudo
+  - needrestart
+  - icinga2
+
+# Install icingaweb2 package
+icingaweb2-pkgs:
+  pkg.installed:
+    - pkgs:
+      - icingaweb2
+      - icingaweb2-module-monitoring
+      - icinga2-ido-mysql
+    - require:
+      - file: /etc/apt/sources.list.d/icinga.list
+
+# Install monitoring module configs
+monitoring-module:
+  file.recurse:
+    - name: /etc/icingaweb2/modules/monitoring/
+    - source: salt://icingaweb2/modules/monitoring/
+    - file_mode: 660
+    - dir_mode: 2770
+    - user: www-data
+    - group: icingaweb2
+
+/etc/icingaweb2/authentication.ini:
+  file.managed:
+    - source: salt://icingaweb2/authentication.ini.tmpl
+    - mode: 660
+    - user: www-data
+    - group: icingaweb2
+    - template: jinja
+    - context: 
+      icingaweb2_config: {{ icingaweb2_config }}
+    - require:
+      - pkg: icingaweb2-pkgs
+
+/etc/icingaweb2/roles.ini:
+  file.managed:
+    - source: salt://icingaweb2/roles.ini.tmpl
+    - mode: 660
+    - user: www-data
+    - group: icingaweb2
+    - template: jinja
+    - context: 
+      icingaweb2_config: {{ icingaweb2_config }}
+    - require:
+      - pkg: icingaweb2-pkgs
+
+/etc/icingaweb2/groups.ini:
+  file.managed:
+    - source: salt://icingaweb2/groups.ini.tmpl
+    - mode: 660
+    - user: www-data
+    - group: icingaweb2
+    - template: jinja
+    - context: 
+      icingaweb2_config: {{ icingaweb2_config }}
+    - require:
+      - pkg: icingaweb2-pkgs
+
+/etc/icingaweb2/resources.ini:
+  file.managed:
+    - source: salt://icingaweb2/resources.ini.tmpl
+    - mode: 660
+    - user: www-data
+    - group: icingaweb2
+    - template: jinja
+    - context: 
+      icingaweb2_config: {{ icingaweb2_config }}
+    - require:
+      - pkg: icingaweb2-pkgs
+
+/etc/icingaweb2/navigation/menu.ini:
+  file.managed:
+    - source: salt://icingaweb2/menu.ini.tmpl
+    - mode: 660
+    - user: www-data
+    - group: icingaweb2
+    - template: jinja
+    - context: 
+      icingaweb2_config: {{ icingaweb2_config }}
+    - require:
+      - pkg: icingaweb2-pkgs
+

+ 9 - 0
icingaweb2/menu.ini.tmpl

@@ -0,0 +1,9 @@
+{% for menu in icingaweb2_config['menu'] -%}
+[{{ menu['title'] }}]
+type = "menu-item"
+target = "_main"
+url = "{{ menu['url'] }}"
+owner = "{{ menu['owner'] }}"
+groups = "{{ menu['groups'] }}"
+
+{% endfor %}

+ 3 - 0
icingaweb2/modules/monitoring/backends.ini

@@ -0,0 +1,3 @@
+[icinga]
+type = "ido"
+resource = "icinga_ido"

+ 3 - 0
icingaweb2/modules/monitoring/commandtransports.ini

@@ -0,0 +1,3 @@
+[icinga2]
+transport = "local"
+path = "/var/run/icinga2/cmd/icinga2.cmd"

+ 2 - 0
icingaweb2/modules/monitoring/config.ini

@@ -0,0 +1,2 @@
+[security]
+protected_customvars = "*pw*,*pass*,community"

+ 7 - 0
icingaweb2/resources.ini.tmpl

@@ -0,0 +1,7 @@
+{%- for title, nested_dict in icingaweb2_config['resources'].items() -%}
+[{{ title }}]
+{%- for key, value in nested_dict.items() %}
+{{ key }} = "{{ value }}"
+{%- endfor %}
+
+{% endfor %}

+ 4 - 0
icingaweb2/roles.ini.tmpl

@@ -0,0 +1,4 @@
+[Administratoren]
+users = "{{ icingaweb2_config['roles']['users'] }}"
+permissions = "{{ icingaweb2_config['roles']['permissions'] }}"
+groups = "{{ icingaweb2_config['roles']['groups'] }}"

+ 5 - 0
top.sls

@@ -93,6 +93,11 @@ base:
     - match: pillar
     - graylog
 
+  # icingaweb2
+  nodes:{{ grains['id'] }}:roles:icinga2server:
+    - match: pillar
+    - icingaweb2
+
   # KVM hosts
   nodes:{{ grains['id'] }}:roles:kvm:
     - match: pillar