commit 40c3b0421f42af7a61b5eec3b74677c1d473e3c1 Author: Julian Rother Date: Sat Jan 25 18:28:51 2025 +0100 Initial commit diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..7b41da5 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,9 @@ +postfixadmin_config: + configured: true + database_type: null + database_host: null + database_user: null + database_password: null + database_name: postfixadmin + + diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..7a782c6 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,12 @@ +- name: Install postfixadmin + ansible.builtin.apt: + pkg: + - postfixadmin + +- name: Update config + ansible.builtin.template: + src: config.local.php.j2 + dest: /etc/postfixadmin/config.local.php + owner: root + group: www-data + mode: "0640" diff --git a/templates/config.local.php.j2 b/templates/config.local.php.j2 new file mode 100644 index 0000000..f76f49d --- /dev/null +++ b/templates/config.local.php.j2 @@ -0,0 +1,30 @@ + {{ php_obj(value)|indent }}, +{% endfor %} +] +{%- elif obj is iterable -%} +[ +{% for item in obj %} +{{ php_obj(item)|indent(first=true) }}, +{% endfor %} +] +{% endif %} +{% endmacro %} +{% for key, value in postfixadmin_config.items() %} +$CONF['{{ key|replace('\\', '\\\\')|replace('\'', '\\\'') }}'] = {{ php_obj(value)|indent }}; +{% endfor %}