Skip to content

Commit

Permalink
lint: make ansible-lint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
gianklug committed Sep 11, 2024
1 parent 701fde5 commit fa47586
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 74 deletions.
4 changes: 2 additions & 2 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---

skip_list:
- '405'
- '106' # Role name {} does not match ``^[a-z][a-z0-9_]+$`` pattern'
- "405"
- "106" # Role name {} does not match ``^[a-z][a-z0-9_]+$`` pattern'
8 changes: 8 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,13 @@ rules:
line-length: disable
brackets: disable
truthy: disable
comments:
min-spaces-from-content: 1
comments-indentation: false
braces:
max-spaces-inside: 1
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true

# vim: set ts=2 sw=2 tw=2 :
25 changes: 9 additions & 16 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

# The icingaweb2 web ui password
icinga2_web_admin_pass: 'passw0rd'
icinga2_web_admin_pass: passw0rd

# icinga2 API host
icinga2_web_api_host: 127.0.0.1
Expand All @@ -13,7 +13,7 @@ icinga2_web_api_port: 5665
icinga2_web_api_user: icingaweb2

# icinga2 API password
icinga2_web_api_pass: 'passw0rd'
icinga2_web_api_pass: passw0rd

# icinga2 director API host
icinga2_web_director_api_host: 127.0.0.1
Expand All @@ -25,9 +25,9 @@ icinga2_web_director_api_port: 5665
icinga2_web_director_api_user: director

# icinga2 director API password
icinga2_web_director_api_pass: 'passw0rd'
icinga2_web_director_api_pass: passw0rd

#icingadb instead of ido
# icingadb instead of ido
icinga2_web_use_icingadb: false

## icingaweb2 database settings
Expand All @@ -38,7 +38,7 @@ icinga2_web_icingaweb2_database_name: icingaweb2
icinga2_web_icingaweb2_database_user: icingaweb2

# The icingaweb2 database password
icinga2_web_icingaweb2_database_pass: 'passw0rd'
icinga2_web_icingaweb2_database_pass: passw0rd

# The icingaweb2 database host
icinga2_web_icingaweb2_database_host: 127.0.0.1
Expand All @@ -47,7 +47,7 @@ icinga2_web_icingaweb2_database_host: 127.0.0.1
icinga2_web_icingaweb2_database_port: 3306

# the hostpattern which can access and login with the icingaweb2 user
icinga2_web_icingaweb2_database_hostpattern: 'localhost'
icinga2_web_icingaweb2_database_hostpattern: localhost

# icingaweb2 database ssl connection (1 or 0)
icinga2_web_icingaweb2_database_ssl: 0
Expand All @@ -60,8 +60,7 @@ icinga2_web_icingaweb2_database_ssl_ca: /etc/pki/tls/certs/ca-bundle.crt
icinga2_web_database_user: icingaweb2

# corresponding password to the root user
icinga2_web_database_root_pass: 'passw0rd'

icinga2_web_database_root_pass: passw0rd

## Icinga2 database settings
# icinga2 database name
Expand All @@ -77,7 +76,7 @@ icinga2_web_icinga2_database_port: 3306
icinga2_web_icinga2_database_user: icinga2

# icinga2 database password
icinga2_web_icinga2_database_pass: 'passw0rd'
icinga2_web_icinga2_database_pass: passw0rd

# icinga2 database ssl connection (1 or 0)
icinga2_web_icinga2_database_ssl: 0
Expand Down Expand Up @@ -128,7 +127,6 @@ icinga2_web_modules: []
# timeout: 5

icinga2_web_ldap: []

# Icingaweb2 LDAP User configuration
# For further information, consult the official icingaweb2 documentation at
# https://icinga.com/docs/icingaweb2/latest/doc/05-Authentication/#ldap
Expand All @@ -142,7 +140,6 @@ icinga2_web_ldap: []
# filter: "(somefilter)" # optional

icinga2_web_ldap_userconf: []

# Icingaweb2 LDAP Group configuration
# For further information, consult the official icingaweb2 documentation at
# https://icinga.com/docs/icingaweb2/latest/doc/05-Authentication/#ldap-groups
Expand All @@ -159,7 +156,6 @@ icinga2_web_ldap_userconf: []
# group_filter: '(somefilter)' # optional

icinga2_web_ldap_groupconf: []

# Icingaweb2 database group configuration
# For further information, consult the official icingaweb2 documentation at
# https://icinga.com/docs/icinga-web-2/latest/doc/05-Authentication/#database-groups
Expand All @@ -170,7 +166,6 @@ icinga2_web_ldap_groupconf: []
# resource: icingaweb_db

icinga2_web_database_groupconf: []

# Icinga2 Permissions configuration
# For further information, consult the official icingaweb2 documentation at
# https://icinga.com/docs/icingaweb2/latest/doc/06-Security/#configuration
Expand Down Expand Up @@ -198,7 +193,7 @@ icinga2_web_permissions:
groups:
- Administrators
permissions:
- '*'
- "*"

# Director Resources configuration
# For further information, consult the official icingaweb2 documentation at
Expand All @@ -217,7 +212,6 @@ icinga2_web_permissions:
# ssl_ca: '/etc/pki/tls/certs/ca-bundle.crt'

icinga2_web_director: []

# Reporting resources configuration

# icinga2_web_reporting:
Expand All @@ -233,7 +227,6 @@ icinga2_web_director: []
# ssl_ca: '/etc/pki/tls/certs/ca-bundle.crt'

icinga2_web_reporting: []

# IcingaDB resources configuration

# icinga2_web_icingadb:
Expand Down
1 change: 0 additions & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

- name: Icinga2_web reload icinga2
ansible.builtin.service:
name: icinga2
Expand Down
20 changes: 10 additions & 10 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
---

dependencies:
- name: 'adfinis.icinga2_agent'
- name: adfinis.icinga2_agent

galaxy_info:
role_name: 'icinga2_web'
role_name: icinga2_web
namespace: adfinis
author: 'Adfinis AG'
description: 'This role installs and configures icingaweb2'
company: 'Adfinis AG'
license: 'GNU General Public License v3'
min_ansible_version: '2.6.0'
author: Adfinis AG
description: This role installs and configures icingaweb2
company: Adfinis AG
license: GNU General Public License v3
min_ansible_version: 2.6.0
platforms:
- name: EL
versions:
- "7"
galaxy_tags:
- 'icinga2'
- 'monitoring'
- 'icingaweb2'
- icinga2
- monitoring
- icingaweb2
github_branch: master

collections:
Expand Down
31 changes: 15 additions & 16 deletions tasks/configuration.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
---

- name: Configure icingaweb2
ansible.builtin.template:
src: 'templates/etc/icingaweb2/{{ item }}.j2'
dest: '/etc/icingaweb2/{{ item }}'
src: templates/etc/icingaweb2/{{ item }}.j2
dest: /etc/icingaweb2/{{ item }}
owner: root
group: icingaweb2
mode: "0660"
seuser: system_u
serole: object_r
setype: icingaweb2_config_t
selevel: s0
loop: '{{ icinga2_web_managed_config_files }}'
loop: "{{ icinga2_web_managed_config_files }}"

- name: Create a symbolic link for module director
ansible.builtin.file:
Expand Down Expand Up @@ -51,7 +50,7 @@
failed_when: false
changed_when: false

- name: Enable icingadb module # noqa changed-when
- name: Enable icingadb module # noqa no-changed-when
ansible.builtin.command: icingacli module enable icingadb
when:
- icinga2_web_use_icingadb
Expand All @@ -76,7 +75,7 @@
serole: object_r
setype: icingaweb2_config_t
selevel: s0
when: icinga2_web_use_icingadb == true
when: icinga2_web_use_icingadb

- name: Configure icingaweb2 icingadb module - redis.ini
ansible.builtin.template:
Expand All @@ -89,7 +88,7 @@
serole: object_r
setype: icingaweb2_config_t
selevel: s0
when: icinga2_web_use_icingadb == true
when: icinga2_web_use_icingadb

- name: Configure icingaweb2 icingadb module - commandtransports.ini
ansible.builtin.template:
Expand All @@ -102,13 +101,13 @@
serole: object_r
setype: icingaweb2_config_t
selevel: s0
when: icinga2_web_use_icingadb == true
when: icinga2_web_use_icingadb

- name: Create config directory for icingaweb2 module monitoring
ansible.builtin.file:
path: /etc/icingaweb2/modules/monitoring/
state: directory
mode: '0755'
mode: "0755"

- name: Configure icingaweb2 monitoring module
ansible.builtin.template:
Expand All @@ -121,7 +120,7 @@
serole: object_r
setype: icingaweb2_config_t
selevel: s0
when: icinga2_web_use_icingadb == false
when: not icinga2_web_use_icingadb

- name: Configure icingaweb2 monitoring module commandtransport
ansible.builtin.template:
Expand All @@ -134,7 +133,7 @@
serole: object_r
setype: icingaweb2_config_t
selevel: s0
when: icinga2_web_use_icingadb == false
when: not icinga2_web_use_icingadb

- name: Configure icingaweb2 monitoring module backends
ansible.builtin.template:
Expand All @@ -147,7 +146,7 @@
serole: object_r
setype: icingaweb2_config_t
selevel: s0
when: icinga2_web_use_icingadb == false
when: not icinga2_web_use_icingadb

- name: Configure icingaweb2 director module
ansible.builtin.template:
Expand Down Expand Up @@ -181,13 +180,13 @@
failed_when: false
register: director_pending_migrations

- name: Configure icingaweb2 director database # noqa no-changed-when
- name: Configure icingaweb2 director database # noqa no-changed-when
ansible.builtin.command: icingacli director migration run
when:
- icinga2_web_director | length != 0
- director_pending_migrations.rc == 0

- name: Check if director kickstart is done yet # noqa no-changed-when
- name: Check if director kickstart is done yet # noqa no-changed-when
ansible.builtin.command: icingacli director kickstart required
when: icinga2_web_director | length != 0
run_once: true
Expand All @@ -200,7 +199,7 @@
var: icinga2_web_register_kickstart
verbosity: 2

- name: Run icingaweb2 director kickstart # noqa no-changed-when
- name: Run icingaweb2 director kickstart # noqa no-changed-when
ansible.builtin.command: icingacli director kickstart run
when:
- icinga2_web_director | length != 0
Expand All @@ -221,7 +220,7 @@
selevel: s0
when: icinga2_web_reporting | length != 0

- name: Create icingaweb2 admin password hash # noqa no-changed-when
- name: Create icingaweb2 admin password hash # noqa no-changed-when
ansible.builtin.command: openssl passwd -1 '{{ icinga2_web_admin_pass }}'
register: icinga2_web_register_admin_hash
when:
Expand Down
31 changes: 15 additions & 16 deletions tasks/installation.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
---

- name: Install icinga2 web packages
ansible.builtin.package:
name: '{{ icinga2_web_packages }}'
name: "{{ icinga2_web_packages }}"
state: present

- name: Install icingaDB web packages
ansible.builtin.package:
name: '{{ icinga2_web_icingadb_packages }}'
name: "{{ icinga2_web_icingadb_packages }}"
state: present
when: icinga2_web_use_icingadb == true
when: icinga2_web_use_icingadb

- name: Install fail2ban using role
ansible.builtin.include_role:
Expand Down Expand Up @@ -54,30 +53,30 @@

- name: Import icingaweb2 database schema
community.mysql.mysql_db:
name: '{{ icinga2_web_icingaweb2_database_name }}'
login_host: '{{ icinga2_web_icingaweb2_database_host }}'
login_port: '{{ icinga2_web_icingaweb2_database_port }}'
login_user: '{{ icinga2_web_database_user }}'
login_password: '{{ vault_icinga2_web_icingaweb2_database_pass }}'
ssl_ca: '{{ icinga2_web_ca_path }}'
name: "{{ icinga2_web_icingaweb2_database_name }}"
login_host: "{{ icinga2_web_icingaweb2_database_host }}"
login_port: "{{ icinga2_web_icingaweb2_database_port }}"
login_user: "{{ icinga2_web_database_user }}"
login_password: "{{ vault_icinga2_web_icingaweb2_database_pass }}"
ssl_ca: "{{ icinga2_web_ca_path }}"
state: import
target: '{{ icinga2_web_mysql_schema_sql_path }}'
target: "{{ icinga2_web_mysql_schema_sql_path }}"
run_once: true
when:
- not ansible_check_mode
- icinga2_web_register_icingaweb2_imported.rc == 1

- name: install icingaweb2 modules
- name: Install icingaweb2 modules
ansible.builtin.package:
name: '{{ icinga2_web_modules }}'
name: "{{ icinga2_web_modules }}"
state: present

- name: Create icingaweb2 director user for background daemon
ansible.builtin.user:
name: icingadirector
group: icingaweb2
shell: '/bin/false'
home: '/var/lib/icingadirector'
shell: /bin/false
home: /var/lib/icingadirector
system: true
when: icinga2_web_director | length != 0

Expand Down Expand Up @@ -126,7 +125,7 @@
- ansible_distribution == 'RedHat'

- name: Install grafana
ansible.builtin.yum:
ansible.builtin.dnf:
name: grafana
state: present
when:
Expand Down
Loading

0 comments on commit fa47586

Please sign in to comment.