mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
Merge pull request #1265 from holta/ansible-warnings
Eliminate Ansible warnings (PostgreSQL, Nextcloud, Sugarizer)
This commit is contained in:
commit
9f552655f4
4 changed files with 89 additions and 59 deletions
|
@ -1,28 +1,29 @@
|
|||
- name: See if Nextcloud version page exists
|
||||
- name: Check for existence of /opt/nextcloud/version.php
|
||||
stat:
|
||||
path: "{{ nextcloud_prefix }}/nextcloud/version.php"
|
||||
# path: "{{ nextcloud_prefix }}/nextcloud/index.php"
|
||||
register: nextcloud_page
|
||||
|
||||
- name: FORCE INSTALL OR REINSTALL OR UPGRADE IF /opt/nextcloud/version.php DOESN'T EXIST
|
||||
- name: FORCE INSTALL OR REINSTALL OR UPGRADE IF {{ nextcloud_prefix }}/nextcloud/version.php DOESN'T EXIST
|
||||
set_fact:
|
||||
nextcloud_force_install: True
|
||||
when: not nextcloud_page.stat.exists
|
||||
|
||||
# - debug:
|
||||
# var: nextcloud_force_install
|
||||
|
||||
# - debug:
|
||||
# msg: "nextcloud_force_install: {{ nextcloud_force_install }}"
|
||||
|
||||
|
||||
- name: Download latest Nextcloud software to /opt/iiab/download/{{ nextcloud_src_file }}
|
||||
- name: Download {{ nextcloud_dl_url }}/{{ nextcloud_orig_src_file }} to {{ downloads_dir }}/{{ nextcloud_src_file }}
|
||||
get_url:
|
||||
url: "{{ nextcloud_dl_url }}/{{ nextcloud_orig_src_file }}"
|
||||
dest: "{{ downloads_dir }}/{{ nextcloud_src_file }}"
|
||||
force: yes
|
||||
#validate_certs: False # TEMPORARY ON/AFTER 2018-07-22 AS download.nextcloud.com CERT EXPIRED: https://github.com/iiab/iiab/issues/954
|
||||
timeout: "{{ download_timeout }}"
|
||||
#force: yes
|
||||
#validate_certs: False # TEMPORARY ON/AFTER 2018-07-22 AS download.nextcloud.com CERT EXPIRED: https://github.com/iiab/iiab/issues/954
|
||||
when: internet_available and nextcloud_force_install
|
||||
async: 1800
|
||||
poll: 10
|
||||
#async: 1800
|
||||
#poll: 10
|
||||
tags:
|
||||
- download
|
||||
|
||||
|
@ -89,13 +90,13 @@
|
|||
#creates: "{{ nextcloud_prefix }}/nextcloud/version.php"
|
||||
when: nextcloud_force_install
|
||||
|
||||
- name: In CentOS, the following config dir is symlink to /etc/nextcloud
|
||||
- name: Create dir /etc/nextcloud (centos) for a subsequent config dir that's symlinked to /etc/nextcloud ?
|
||||
file:
|
||||
path: /etc/nextcloud
|
||||
state: directory
|
||||
when: is_centos
|
||||
|
||||
- name: Add autoconfig file (CentOS)
|
||||
- name: Install {{ nextcloud_prefix }}/nextcloud/config/autoconfig.php from template (centos)
|
||||
template:
|
||||
src: autoconfig.php.j2
|
||||
dest: "{{ nextcloud_prefix }}/nextcloud/config/autoconfig.php"
|
||||
|
@ -104,7 +105,7 @@
|
|||
mode: 0640
|
||||
when: is_centos
|
||||
|
||||
- name: Make Apache owner
|
||||
- name: chown -R {{ apache_user }}:{{ apache_user }} {{ nextcloud_prefix }}/nextcloud
|
||||
file:
|
||||
path: "{{ nextcloud_prefix }}/nextcloud"
|
||||
owner: "{{ apache_user }}"
|
||||
|
@ -112,22 +113,20 @@
|
|||
recurse: yes
|
||||
state: directory
|
||||
|
||||
- name: Create data directory library
|
||||
- name: Create data directory {{ nextcloud_data_dir }} # /opt/nextcloud/data
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
path: "{{ nextcloud_data_dir }}"
|
||||
owner: "{{ apache_user }}"
|
||||
group: "{{ apache_user }}"
|
||||
mode: 0750
|
||||
state: directory
|
||||
with_items:
|
||||
- "{{ nextcloud_data_dir }}"
|
||||
|
||||
- name: Create MySQL database {{ nextcloud_dbname }} for Nextcloud
|
||||
- name: 'Create MySQL database with name: {{ nextcloud_dbname }}'
|
||||
mysql_db:
|
||||
name: "{{ nextcloud_dbname }}"
|
||||
when: mysql_enabled and nextcloud_enabled
|
||||
|
||||
- name: Create username/password for Nextcloud database
|
||||
- name: Add username/password to the MySQL database (associated with trusted IP's like localhost)
|
||||
mysql_user:
|
||||
name: "{{ nextcloud_dbuser }}"
|
||||
host: "{{ item }}"
|
||||
|
@ -140,17 +139,15 @@
|
|||
- localhost
|
||||
when: mysql_enabled and nextcloud_enabled
|
||||
|
||||
# Appears unnec as nextcloud_enabled.yml (just below) does the same
|
||||
#- name: Restart Apache
|
||||
# service:
|
||||
# name: "{{ apache_service }}"
|
||||
# state: restarted
|
||||
## when: nextcloud_enabled # taken care of by nextcloud_enabled.yml below
|
||||
# when: not nextcloud_enabled
|
||||
|
||||
- name: Restart Apache, to enable/disable http://box/nextcloud
|
||||
service:
|
||||
name: "{{ apache_service }}"
|
||||
state: restarted
|
||||
# when: nextcloud_enabled # taken care of by nextcloud_enabled.yml below
|
||||
when: not nextcloud_enabled
|
||||
|
||||
# Enable nextcloud by copying template to httpd config
|
||||
|
||||
# following enables and disables
|
||||
# Enables or disable Nextcloud!
|
||||
- include_tasks: nextcloud_enabled.yml
|
||||
|
||||
- name: Add 'nextcloud' to list of services at {{ iiab_ini_file }}
|
||||
|
@ -166,7 +163,11 @@
|
|||
value: '"NextCloud is a local server-based facility for sharing files, photos, contacts, calendars, etc."'
|
||||
- option: path
|
||||
value: "{{ nextcloud_prefix }}/nextcloud"
|
||||
- option: source
|
||||
- option: nextcloud_force_install
|
||||
value: "{{ nextcloud_force_install }}"
|
||||
- option: nextcloud_orig_src_file
|
||||
value: "{{ nextcloud_orig_src_file }}"
|
||||
- option: nextcloud_src_file
|
||||
value: "{{ nextcloud_src_file }}"
|
||||
- option: enabled
|
||||
- option: nextcloud_enabled
|
||||
value: "{{ nextcloud_enabled }}"
|
||||
|
|
|
@ -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
|
||||
|
@ -34,8 +40,7 @@
|
|||
# the install wizard does not succeed if already installed
|
||||
- name: Determine if Nextcloud is installed
|
||||
shell: >
|
||||
#sudo -u {{ apache_user }}
|
||||
php '{{ nextcloud_prefix }}/nextcloud/occ' status |
|
||||
php {{ nextcloud_prefix }}/nextcloud/occ status |
|
||||
gawk '/installed:/ { print $3 }'
|
||||
become: yes
|
||||
become_user: "{{ apache_user }}"
|
||||
|
@ -44,39 +49,55 @@
|
|||
- name: Run Nextcloud initial install wizard
|
||||
shell: >
|
||||
cd {{ nextcloud_prefix }}/nextcloud;
|
||||
sudo -u {{ apache_user }} php occ maintenance:install
|
||||
php occ maintenance:install
|
||||
--database "mysql"
|
||||
--database-name "{{ nextcloud_dbname }}"
|
||||
--database-user "{{ nextcloud_dbuser }}"
|
||||
--database-pass "{{ nextcloud_dbpassword }}"
|
||||
--admin-user "{{ nextcloud_admin_user }}"
|
||||
--admin-pass "{{ nextcloud_admin_password }}"
|
||||
become: yes
|
||||
become_user: "{{ apache_user }}"
|
||||
when: nextcloud_enabled and returned.stdout == "false"
|
||||
|
||||
- name: Allow access from all hosts and ips
|
||||
command: php '{{ nextcloud_prefix }}/nextcloud/occ' config:system:set trusted_domains 1 --value=*
|
||||
become: true
|
||||
command: php {{ nextcloud_prefix }}/nextcloud/occ config:system:set trusted_domains 1 --value=*
|
||||
become: yes
|
||||
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 }}'
|
||||
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 line could
|
||||
# be replaced by ALTERNATIVE 1 or ALTERNATIVE 2 below 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...
|
||||
#
|
||||
# NOTE: COMMENTS (FOLLOWING '#' SIGN) WITHIN A SHELL COMMAND CAUSE IT TO *FAIL*
|
||||
#
|
||||
#- name: Determine if Nextcloud user exists already
|
||||
# shell: >
|
||||
# php {{ nextcloud_prefix }}/nextcloud/occ user:list |
|
||||
# grep {{ nextcloud_user }} | wc | cut -d' ' -f1 # USELESS
|
||||
# #grep {{ nextcloud_user }} | wc -l # ALTERNATIVE 1
|
||||
# #grep {{ nextcloud_user }} | wc | awk '{print $1}' # ALTERNATIVE 2
|
||||
# become: yes
|
||||
# become_user: "{{ apache_user }}"
|
||||
# register: returned_count
|
||||
#
|
||||
# debug:
|
||||
# var: returned_count
|
||||
#
|
||||
## nextcloud wants to make users rather than just mysql users and not done
|
||||
#- name: Create the default user
|
||||
# shell: >
|
||||
# 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:
|
||||
|
|
|
@ -48,15 +48,21 @@
|
|||
when: is_debuntu
|
||||
|
||||
- name: Initialize the postgres db (debuntu)
|
||||
command: su - postgres -c "/usr/lib/postgresql/{{ postgresql_version }}/bin/initdb -E 'UTF-8' --locale={{ postgresql_locale }} -D /library/pgsql-iiab"
|
||||
#command: su - postgres -c "/usr/lib/postgresql/{{ postgresql_version }}/bin/initdb -E 'UTF-8' --locale={{ postgresql_locale }} -D /library/pgsql-iiab"
|
||||
command: /usr/lib/postgresql/{{ postgresql_version }}/bin/initdb -E 'UTF-8' --locale={{ postgresql_locale }} -D /library/pgsql-iiab
|
||||
args:
|
||||
creates: /library/pgsql-iiab/pg_hba.conf
|
||||
become: yes
|
||||
become_user: postgres
|
||||
when: is_debuntu
|
||||
|
||||
- name: Initialize the postgres db (OS's other than debuntu)
|
||||
command: su - postgres -c "/usr/bin/initdb -E 'UTF-8' --lc-collate={{ postgresql_locale }} --lc-ctype={{ postgresql_locale }} -D /library/pgsql-iiab"
|
||||
#command: su - postgres -c "/usr/bin/initdb -E 'UTF-8' --lc-collate={{ postgresql_locale }} --lc-ctype={{ postgresql_locale }} -D /library/pgsql-iiab"
|
||||
command: /usr/bin/initdb -E 'UTF-8' --lc-collate={{ postgresql_locale }} --lc-ctype={{ postgresql_locale }} -D /library/pgsql-iiab
|
||||
args:
|
||||
creates: /library/pgsql-iiab/pg_hba.conf
|
||||
become: yes
|
||||
become_user: postgres
|
||||
when: not is_debuntu
|
||||
|
||||
- name: Configure PostgreSQL
|
||||
|
|
|
@ -59,6 +59,8 @@
|
|||
|
||||
- name: Set up Node.js 8.x apt sources (debuntu, but avoid ubuntu-18)
|
||||
shell: curl -sL https://deb.nodesource.com/setup_8.x | bash -
|
||||
args:
|
||||
warn: no
|
||||
when: internet_available and is_debuntu and not is_ubuntu_18
|
||||
|
||||
- name: Install latest Node.js which includes /usr/bin/npm (debuntu, but avoid ubuntu-18)
|
||||
|
|
Loading…
Reference in a new issue