From eaa789ad224a98cf2edf295ea83a28f9bdf6b7af Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sat, 6 Jan 2024 12:06:57 +0200 Subject: [PATCH] Add nextcloud_config_parameter_mail_* variables --- defaults/main.yml | 120 +++++++++++++++++++++++++++++++++++----- tasks/adjust_config.yml | 9 --- 2 files changed, 107 insertions(+), 22 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index b6c40c1..ed79e59 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -321,19 +321,113 @@ nextcloud_config_parameters: "{{ nextcloud_config_default_parameters + nextcloud # Default configuration parameters to apply to Nextcloud. # To add your own additional parameters, use `nextcloud_config_additional_parameters`. # To get rid of these defaults, redefine `nextcloud_config_default_parameters` or `nextcloud_config_parameters`. -nextcloud_config_default_parameters: - - key: overwriteprotocol - value: "https" - type: string - - key: overwrite.cli.url - value: "{{ nextcloud_url }}" - type: string - - key: overwritewebroot - value: "{{ '' if nextcloud_path_prefix == '/' else nextcloud_path_prefix }}" - type: string - - key: htaccess.RewriteBase - value: "{{ nextcloud_path_prefix }}" - type: string +nextcloud_config_default_parameters: | + {{ + ([ + { + 'key': 'overwriteprotocol', + 'value': 'https', + 'type': 'string', + }, + { + 'key': 'overwrite.cli.url', + 'value': nextcloud_url, + 'type': 'string', + }, + { + 'key': 'overwritewebroot', + 'value': ('' if nextcloud_path_prefix == '/' else nextcloud_path_prefix), + 'type': 'string', + }, + { + 'key': 'htaccess.RewriteBase', + 'value': nextcloud_path_prefix, + 'type': 'string', + }, + { + 'key': 'auth.bruteforce.protection.enabled', + 'value': false, + 'type': 'boolean', + }, + ]) + + + ([ + { + 'key': 'mail_smtphost', + 'value': nextcloud_config_parameter_mail_smtphost, + 'type': 'string', + }, + ] if nextcloud_config_parameter_mail_smtphost != '' else []) + + + ([ + { + 'key': 'mail_smtpport', + 'value': nextcloud_config_parameter_mail_smtpport | int, + 'type': 'int', + }, + ] if nextcloud_config_parameter_mail_smtpport != '' else []) + + + ([ + { + 'key': 'mail_smtpsecure', + 'value': nextcloud_config_parameter_mail_smtpsecure, + 'type': 'string', + }, + ] if nextcloud_config_parameter_mail_smtpsecure != '' else []) + + + ([ + { + 'key': 'mail_smtpauth', + 'value': nextcloud_config_parameter_mail_smtpauth, + 'type': 'boolean', + }, + ] if nextcloud_config_parameter_mail_smtpauth else []) + + + ([ + { + 'key': 'mail_smtpname', + 'value': nextcloud_config_parameter_mail_smtpname, + 'type': 'string', + }, + ] if nextcloud_config_parameter_mail_smtpname else []) + + + ([ + { + 'key': 'mail_smtppassword', + 'value': nextcloud_config_parameter_mail_smtppassword, + 'type': 'string', + }, + ] if nextcloud_config_parameter_mail_smtppassword else []) + + + ([ + { + 'key': 'mail_from_address', + 'value': nextcloud_config_parameter_mail_from_address, + 'type': 'string', + }, + ] if nextcloud_config_parameter_mail_from_address != '' else []) + + + ([ + { + 'key': 'mail_domain', + 'value': nextcloud_config_parameter_mail_domain, + 'type': 'string', + }, + ] if nextcloud_config_parameter_mail_domain != '' else []) + }} + +nextcloud_config_parameter_mail_smtphost: '' +nextcloud_config_parameter_mail_smtpport: '' +nextcloud_config_parameter_mail_smtpsecure: '' + +nextcloud_config_parameter_mail_smtpauth: false +nextcloud_config_parameter_mail_smtpname: '' +nextcloud_config_parameter_mail_smtppassword: '' + +# nextcloud_config_parameter_mail_from_address and nextcloud_config_parameter_mail_domain +# contain the @-separated email address of the sender (localpart@domain). +nextcloud_config_parameter_mail_from_address: '' # localpart +nextcloud_config_parameter_mail_domain: '' # domain # Add your custom Nextcloud configuration parameters here. # diff --git a/tasks/adjust_config.yml b/tasks/adjust_config.yml index f8913d0..1b53733 100644 --- a/tasks/adjust_config.yml +++ b/tasks/adjust_config.yml @@ -14,15 +14,6 @@ cmd: |- docker exec --user={{ nextcloud_uid }}:{{ nextcloud_gid }} {{ nextcloud_identifier }}-server php /var/www/html/occ --no-warnings config:system:set trusted_proxies 0 --type=string --value={{ nextcloud_reverse_proxy_container_network_subnet_result.stdout }} -- name: Adjust Nextcloud configuration (disable bruteforce protection) - ansible.builtin.command: - cmd: |- - docker exec --user={{ nextcloud_uid }}:{{ nextcloud_gid }} {{ nextcloud_identifier }}-server php /var/www/html/occ --no-warnings config:system:set {{ item.key }} --type="{{ item.type }}" --value={{ item.value }} - with_items: - - key: auth.bruteforce.protection.enabled - value: "false" - type: boolean - - name: Adjust Nextcloud configuration (custom parameters) ansible.builtin.command: cmd: |-