ansible-role-nextcloud/tasks/configuration.yml
2023-08-05 20:28:46 +02:00

99 lines
3.8 KiB
YAML

---
- name: "Configuration | Setze Variable"
ansible.builtin.set_fact:
nextcloud_install_path: "{{ nextcloud_root }}/{{ instances.name }}"
- name: "Configuration | Richte trusted domains ein | {{ instances.name }}"
ansible.builtin.command:
cmd: 'php occ config:system:set trusted_domains {{ item.0 }} --value "{{ item.1 }}"'
chdir: "{{ nextcloud_install_path }}"
become: true
become_user: "{{ instances.user }}"
changed_when: true
with_indexed_items:
- '{{ instances.config.trusted_domains }}'
- name: "Configuration | Richte cron-Job ein | {{ instances.name }}"
ansible.builtin.cron:
name: "nextcloud {{ instances.name }}"
minute: "*/5"
user: "{{ instances.user }}"
job: "php -f {{ nextcloud_install_path }}/cron.php"
cron_file: "nextcloud"
- name: "Configuration | Richte allgemeie Konfiguration ein | {{ instances.name }}"
ansible.builtin.command:
cmd: "{{ commands }}"
chdir: "{{ nextcloud_install_path }}"
become: true
become_user: "{{ instances.user }}"
changed_when: true
loop:
- 'php occ config:system:set memcache.local --value "\\OC\\Memcache\\APCu"'
- 'php occ config:system:set memcache.distributed --value "\OC\Memcache\Redis"'
- "php occ background:cron"
- 'php occ config:system:set overwrite.cli.url --value https://{{ instances.name }}'
- 'php occ config:system:set htaccess.RewriteBase --value /'
- 'php occ maintenance:update:htaccess'
- 'php occ config:system:set default_language --value "de"'
- 'php occ config:system:set default_phone_region --value "DE"'
loop_control:
loop_var: commands
- name: "Configuration | Richte Mailversand ein | {{ instances.name }}"
ansible.builtin.blockinfile:
path: "{{ nextcloud_config_file }}"
insertbefore: '^\);'
marker: "// {mark} ANSIBLE MANAGED BLOCK Mailversand"
block: |2
'mail_from_address' => '{{ instances.config.mail_from }}',
'mail_smtpmode' => 'smtp',
'mail_sendmailmode' => 'smtp',
'mail_domain' => '{{ instances.config.mail_domain }}',
'mail_smtpauthtype' => '{{ instances.config.smtp_auth_type }}',
'mail_smtphost' => '{{ instances.config.smtp_host }}',
'mail_smtpport' => '{{ instances.config.smtp_port }}',
- name: "Configuration | Richte Filelocking ein | {{ instances.name }}"
ansible.builtin.blockinfile:
path: "{{ nextcloud_config_file }}"
insertbefore: '^\);'
marker: "// {mark} ANSIBLE MANAGED BLOCK Filelocking"
block: |2
'filelocking.enabled' => true,
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => '/var/run/redis/redis-server.sock',
'port' => 0,
'dbindex' => {{ instance_id }},
'timeout' => 1.5,
),
- name: "Configuration | Richte trusted proxies ein | {{ instances.name }}"
ansible.builtin.command:
cmd: 'php occ config:system:set trusted_proxies {{ item.0 }} --value "{{ item.1 }}"'
chdir: "{{ nextcloud_install_path }}"
become: true
become_user: "{{ instances.user }}"
changed_when: true
with_indexed_items:
- "{{ instances.config.trusted_proxies }}"
- name: "Configuration | Richte Logging ein | {{ instances.name }}"
ansible.builtin.blockinfile:
path: "{{ nextcloud_config_file }}"
insertbefore: '^\);'
marker: "// {mark} ANSIBLE MANAGED BLOCK Logging"
block: |2
'log_type' => 'file',
'loglevel' => 1,
'logdateformat' => 'F d, Y H:i:s',
'log_type_audit' => 'file',
- name: "Configuration | Erstelle OIDC-Konfiguration | {{ instances.name }}"
ansible.builtin.blockinfile:
path: "{{ nextcloud_config_file }}"
insertbefore: '^\);'
marker: "// {mark} ANSIBLE MANGED BLOCK OIDC"
block: "{{ instances.config.oidc }}"
when: instances.config.oidc is defined