Initial commit
This commit is contained in:
commit
40c3b0421f
3 changed files with 51 additions and 0 deletions
9
defaults/main.yml
Normal file
9
defaults/main.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
postfixadmin_config:
|
||||
configured: true
|
||||
database_type: null
|
||||
database_host: null
|
||||
database_user: null
|
||||
database_password: null
|
||||
database_name: postfixadmin
|
||||
|
||||
|
||||
12
tasks/main.yml
Normal file
12
tasks/main.yml
Normal file
|
|
@ -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"
|
||||
30
templates/config.local.php.j2
Normal file
30
templates/config.local.php.j2
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/* {{ ansible_managed }} */
|
||||
|
||||
{% macro php_obj(obj) %}
|
||||
{%- if obj is string -%}
|
||||
'{{ obj|replace('\\', '\\\\')|replace('\'', '\\\'') }}'
|
||||
{%- elif obj is number -%}
|
||||
{{ obj }}
|
||||
{%- elif obj is boolean -%}
|
||||
{{ obj }}
|
||||
{%- elif obj is none -%}
|
||||
null
|
||||
{%- elif obj is mapping %}
|
||||
[
|
||||
{% for key, value in obj.items() %}
|
||||
'{{ key|replace('\\', '\\\\')|replace('\'', '\\\'') }}' => {{ 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 %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue