Skip to content

Commit

Permalink
Fix/template integer handling (#183)
Browse files Browse the repository at this point in the history
* add clause to catch integer values in config
  • Loading branch information
mkayontour authored Sep 29, 2023
1 parent 68c2973 commit 3c4e246
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 21 deletions.
1 change: 0 additions & 1 deletion molecule/default/collections.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
collections:
- name: community.mysql
- name: community.docker
version: ">=1.9.0,<2.0.0"
- name: community.general
version: ">=2,<3"
33 changes: 27 additions & 6 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
- name: Converge
hosts: all
vars:
icingaweb2_db:
type: mysql
name: icingaweb
host: 127.0.0.1
user: icingaweb
password: icingaweb
icingaweb2_database_import_schema: true
icingadb_database_import_schema: true
mysql_innodb_file_format: barracuda
mysql_innodb_large_prefix: 1
Expand All @@ -12,12 +19,17 @@
- mariadb-server
- python3-mysqldb
mysql_users:
- name: icingaweb
host: "%"
password: icingaweb
priv: "icingaweb.*:ALL"
- name: icingadb
host: "%"
password: icingadb
priv: "icingadb.*:ALL"
mysql_databases:
- name: icingadb
- name: icingaweb
icinga2_confd: false
icinga2_features:
- name: perfdata
Expand Down Expand Up @@ -61,9 +73,18 @@
- zones.d/main/services
collections:
- icinga.icinga
roles:
- repos
- icinga2
- geerlingguy.mysql
- icingadb
- icingadb_redis
pre_tasks:
- include_role:
name: repos
- include_role:
name: geerlingguy.mysql
- include_role:
name: icinga2
- include_role:
name: icingadb
- include_role:
name: icingadb_redis

post_tasks:
- include_role:
name: icingaweb2
2 changes: 2 additions & 0 deletions molecule/default/dependency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ dependency:
name: galaxy
options:
role-file: requirements.yml
env:
ANSIBLE_ROLES_PATH: .ansible/roles
3 changes: 2 additions & 1 deletion molecule/default/requirements.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- src: geerlingguy.mysql
roles:
- geerlingguy.mysql
10 changes: 5 additions & 5 deletions molecule/local-default-pgsql/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
collections:
- icinga.icinga
roles:
#- repos
#- geerlingguy.postgresql
#- icinga2
- repos
- geerlingguy.postgresql
- icinga2
- icingadb
#- icingadb_redis
#- icingaweb2
- icingadb_redis
- icingaweb2
26 changes: 20 additions & 6 deletions molecule/local-default/converge.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
- name: Converge
hosts: all
become: true
module_defaults:
ansible.builtin.apt:
cache_valid_time: 3600
vars:
icingaweb2_resources:
director_db:
Expand Down Expand Up @@ -28,7 +31,7 @@
run_kickstart: true
kickstart:
config:
endpoint: "{{ ansible_fqdn }}"
endpoint: icinga-default
host: 127.0.0.1
username: root
password: root
Expand Down Expand Up @@ -79,6 +82,7 @@
icingaweb2_admin_username: admin
icingaweb2_admin_password: admin
icingaweb2_db_import_schema: true
icingadb_database_type: mysql
icingadb_database_import_schema: true
mysql_innodb_file_format: barracuda
mysql_innodb_large_prefix: 1
Expand Down Expand Up @@ -160,8 +164,18 @@
- zones.d/main/services
collections:
- icinga.icinga
roles:
- repos
- geerlingguy.mysql
- icinga2
- icingaweb2
pre_tasks:
- include_role:
name: repos
- include_role:
name: geerlingguy.mysql
- include_role:
name: icinga2
- include_role:
name: icingadb
- include_role:
name: icingadb_redis

post_tasks:
- include_role:
name: icingaweb2
2 changes: 1 addition & 1 deletion molecule/local-default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ driver:
platforms:
- name: icinga-default
box: ubuntu/jammy64
memory: 512
memory: 1024
cpus: 1
interfaces:
- network_name: private_network
Expand Down
4 changes: 3 additions & 1 deletion roles/icingaweb2/templates/ini_template.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

[{{ section }}]
{% for option, value in options.items() %}
{% if value is iterable and (value is not string and value is not mapping) %}
{% if value is number %}
{{ option }} = "{{ value }}"
{% elif value is iterable and (value is not string and value is not mapping) %}
{{ option }} = "{{ value | join(', ') }}"
{% elif value is string and "=" in value %}
{% else %}
Expand Down

0 comments on commit 3c4e246

Please sign in to comment.