1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/nextcloud/tasks/nextcloud_enabled.yml

53 lines
1.9 KiB
YAML

# This should go in computed_network.yml, but here for now
- name: Compute nextcloud listen ip addr for nextcloud.conf
set_fact:
nextcloud_required_ip: "{{ ansible_default_ipv4.network }}/{{ ansible_default_ipv4.netmask }}"
when: ansible_default_ipv4.network is defined
- name: Enable nextcloud by copying template to httpd config
template: src=nextcloud.conf.j2
dest=/etc/{{ apache_config_dir }}/nextcloud.conf
owner=root
group=root
mode=0644
when: nextcloud_enabled
- name: Enable nextcloud
file: path=/etc/apache2/sites-enabled/nextcloud.conf
src=/etc/apache2/sites-available/nextcloud.conf
state=link
when: nextcloud_enabled and is_debuntu
- name: For redhat, remove the config file
file: path=/etc/{{ apache_config_dir }}/nextcloud.conf
state=absent
when: not nextcloud_enabled and is_redhat
- name: Restart apache, so it picks up the new aliases
service: name={{ apache_service }} state=restarted
# the install wizard does not succeed if already installed
- name: Determine if nextcloud is installed
command: >
php {{ nextcloud_prefix }}/nextcloud/occ status |
grep installed | wc | cut -f' ' -d1
register: returned_count
- name: Run nextcloud initial install wizard
shell: >
cd {{ nextcloud_prefix }}/nextcloud;
sudo -u {{ apache_user }} php occ maintenance:install
--database "mysql"
--database-name "{{ nextcloud_dbname }}"
--database-user "{{ nextcloud_dbuser }}"
--database-pass "{{ nextcloud_dbpassword }}"
--admin-user "root"
--admin-pass "{{ mysql_root_password }}"
when: nextcloud_enabled and returned_count == "0"
- name: Remove Rewrite URL
lineinfile: regexp='overwrite.cli.url'
state=absent
dest="{{ nextcloud_prefix }}/nextcloud/config/config.php"