Jérémy Lecour
70c93310f9
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2768|3|2765|12|:+1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/224//ansiblelint">Evolix » ansible-roles » unstable #224</a>
gitea/ansible-roles/pipeline/head This commit looks good
87 lines
2.6 KiB
YAML
87 lines
2.6 KiB
YAML
---
|
|
|
|
- block:
|
|
- name: Generate admin password
|
|
ansible.builtin.command:
|
|
cmd: 'apg -n 1 -m 16 -M lcN'
|
|
register: nextcloud_admin_password_apg
|
|
check_mode: no
|
|
changed_when: False
|
|
|
|
- ansible.builtin.debug:
|
|
var: nextcloud_admin_password_apg
|
|
|
|
- ansible.builtin.set_fact:
|
|
nextcloud_admin_password: "{{ nextcloud_admin_password_apg.stdout }}"
|
|
|
|
tags:
|
|
- nextcloud
|
|
when: nextcloud_admin_password | length == 0
|
|
|
|
- name: Get Nextcloud Status
|
|
ansible.builtin.shell:
|
|
cmd: "php ./occ status --output json | grep -v 'Nextcloud is not installed'"
|
|
args:
|
|
chdir: "{{ nextcloud_webroot }}"
|
|
become_user: "{{ nextcloud_user }}"
|
|
register: nc_status
|
|
check_mode: no
|
|
tags:
|
|
- nextcloud
|
|
|
|
- name: Install Nextcloud
|
|
ansible.builtin.command:
|
|
cmd: "php ./occ maintenance:install --database mysql --database-name {{ nextcloud_db_name | mandatory }} --database-user {{ nextcloud_db_user | mandatory }} --database-pass {{ nextcloud_db_pass | mandatory }} --admin-user {{ nextcloud_admin_login | mandatory }} --admin-pass {{ nextcloud_admin_password | mandatory }} --data-dir {{ nextcloud_data | mandatory }}"
|
|
args:
|
|
chdir: "{{ nextcloud_webroot }}"
|
|
creates: "{{ nextcloud_home }}/config/config.php"
|
|
become_user: "{{ nextcloud_user }}"
|
|
when: not ((nc_status.stdout | from_json).installed | bool)
|
|
tags:
|
|
- nextcloud
|
|
|
|
- name: Configure Nextcloud Mysql password
|
|
ansible.builtin.replace:
|
|
dest: "{{ nextcloud_home }}/nextcloud/config/config.php"
|
|
regexp: "'dbpassword' => '([^']*)',"
|
|
replace: "'dbpassword' => '{{ nextcloud_db_pass }}',"
|
|
tags:
|
|
- nextcloud
|
|
|
|
- name: Configure Nextcloud cron
|
|
ansible.builtin.cron:
|
|
name: 'Nextcloud'
|
|
minute: "*/5"
|
|
job: "php -f {{ nextcloud_webroot }}/cron.php"
|
|
user: "{{ nextcloud_user }}"
|
|
tags:
|
|
- nextcloud
|
|
|
|
- name: Erase previously trusted domains config
|
|
ansible.builtin.command:
|
|
cmd: "php ./occ config:system:set trusted_domains"
|
|
args:
|
|
chdir: "{{ nextcloud_webroot }}"
|
|
become_user: "{{ nextcloud_user }}"
|
|
tags:
|
|
- nextcloud
|
|
|
|
- name: Configure trusted domains
|
|
ansible.builtin.command:
|
|
cmd: "php ./occ config:system:set trusted_domains {{ item.0 }} --value {{ item.1 }}"
|
|
args:
|
|
chdir: "{{ nextcloud_webroot }}"
|
|
with_indexed_items:
|
|
- "{{ nextcloud_domains }}"
|
|
become_user: "{{ nextcloud_user }}"
|
|
tags:
|
|
- nextcloud
|
|
|
|
#- name: Configure memcache local to APCu
|
|
# command: "php ./occ config:system:set memcache.local --value '\\OC\\Memcache\\APCu'"
|
|
# args:
|
|
# chdir: "{{ nextcloud_webroot }}"
|
|
# become_user: "{{ nextcloud_user }}"
|
|
# tags:
|
|
# - nextcloud
|