1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Update nextcloud_enabled.yml

This commit is contained in:
A Holt 2018-10-29 01:56:27 -04:00 committed by GitHub
parent f03eb1300f
commit 5ad953dbd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,20 +13,26 @@
mode: 0644
when: nextcloud_enabled
- name: Create symlink from sites-available to sites-enabled for http://box/nextcloud (debuntu)
- name: Create symlink nextcloud.conf from sites-enabled to sites-available for http://box/nextcloud (debuntu)
file:
src: /etc/apache2/sites-available/nextcloud.conf
src: "/etc/{{ apache_config_dir }}/nextcloud.conf"
path: /etc/apache2/sites-enabled/nextcloud.conf
state: link
when: nextcloud_enabled and is_debuntu
- name: Remove nextcloud.conf if not nextcloud_enabled (redhat)
- name: Remove symlink nextcloud.conf from /etc/apache2/sites-enabled if not nextcloud_enabled (debuntu)
file:
path: /etc/apache2/sites-enabled/nextcloud.conf
state: absent
when: not nextcloud_enabled and is_debuntu
- name: Remove sites-available/nextcloud.conf if not nextcloud_enabled (redhat)
file:
path: "/etc/{{ apache_config_dir }}/nextcloud.conf"
state: absent
when: not nextcloud_enabled and is_redhat
- name: Restart Apache, enabling http://box/nextcloud
- name: Restart Apache, enabling/disabling http://box/nextcloud
service:
name: "{{ apache_service }}"
state: restarted
@ -59,26 +65,34 @@
become_user: "{{ apache_user }}"
when: nextcloud_enabled and returned.stdout == "false"
- name: Determine if Nextcloud user exists already
shell: >
#sudo -u {{ apache_user }}
php '{{ nextcloud_prefix }}/nextcloud/occ' user:list |
grep {{ nextcloud_user }} | wc | cut -d' ' -f1
become: yes
become_user: "{{ apache_user }}"
register: returned_count
# nextcloud wants to make users rather than just mysql users and not done
- name: Create the default user
shell: >
#su -s /bin/sh {{ apache_user }} -c
OC_PASS={{ nextcloud_user_password }};
php {{ nextcloud_prefix }}/nextcloud/occ user:add
--password-from-env --display-name={{ nextcloud_user }}
--group="users" {{ nextcloud_user }}
become: yes
become_user: "{{ apache_user }}"
when: nextcloud_enabled and returned_count == "0"
# Code below was NEVER RUNNING as of 2018-10-29, as "wc | cut -d' ' -f1" ALWAYS
# returns null (rather than the intended returned_count !) This fragment could
# be replace with "wc -l" or "wc | awk '{print $1}'" if it truly needs fixing?
#
# Or perhaps default user/password nextcloud/nextcloudmysql (from variables
# nextcloud_user/nextcloud_user_password) is just not needed in the end...
#
#- name: Determine if Nextcloud user exists already
# shell: >
# #sudo -u {{ apache_user }}
# php '{{ nextcloud_prefix }}/nextcloud/occ' user:list |
# grep {{ nextcloud_user }} | wc | cut -d' ' -f1
# #grep {{ nextcloud_user }} | wc -l
# become: yes
# become_user: "{{ apache_user }}"
# register: returned_count
#
## nextcloud wants to make users rather than just mysql users and not done
#- name: Create the default user
# shell: >
# #su -s /bin/sh {{ apache_user }} -c
# OC_PASS={{ nextcloud_user_password }};
# php {{ nextcloud_prefix }}/nextcloud/occ user:add
# --password-from-env --display-name={{ nextcloud_user }}
# --group="users" {{ nextcloud_user }}
# become: yes
# become_user: "{{ apache_user }}"
# when: nextcloud_enabled and returned_count == "0"
- name: Remove overwrite.cli.url line (Rewrite URL) from /opt/nextcloud/config/config.php
lineinfile: