75 lines
1.8 KiB
YAML
75 lines
1.8 KiB
YAML
---
|
|
- name: Verificar si Nextcloud ya existe
|
|
stat:
|
|
path: /var/www/html/nextcloud
|
|
register: nextcloud_exists
|
|
|
|
- name: Crear base de datos PostgreSQL para Nextcloud
|
|
postgresql_db:
|
|
name: nextcloud
|
|
state: present
|
|
become_user: postgres
|
|
when: not nextcloud_exists.stat.exists
|
|
|
|
- name: Crear usuario PostgreSQL para Nextcloud
|
|
postgresql_user:
|
|
name: nextcloud
|
|
password: "{{ core_password }}"
|
|
state: present
|
|
become_user: postgres
|
|
when: not nextcloud_exists.stat.exists
|
|
|
|
- name: Otorgar privilegios al usuario Nextcloud
|
|
postgresql_privs:
|
|
database: nextcloud
|
|
roles: nextcloud
|
|
privs: ALL
|
|
type: database
|
|
become_user: postgres
|
|
when: not nextcloud_exists.stat.exists
|
|
|
|
- name: Descargar Nextcloud 31
|
|
get_url:
|
|
url: "{{ download_urls.nextcloud }}"
|
|
dest: /tmp/nextcloud-31.tar.bz2
|
|
when: not nextcloud_exists.stat.exists
|
|
|
|
- name: Extraer Nextcloud
|
|
unarchive:
|
|
src: /tmp/nextcloud-31.tar.bz2
|
|
dest: /var/www/html/
|
|
remote_src: yes
|
|
when: not nextcloud_exists.stat.exists
|
|
|
|
- name: Establecer permisos Nextcloud
|
|
file:
|
|
path: /var/www/html/nextcloud
|
|
owner: www-data
|
|
group: www-data
|
|
recurse: yes
|
|
|
|
- name: Crear directorio de datos Nextcloud
|
|
file:
|
|
path: "{{ data_root }}/nextcloud"
|
|
state: directory
|
|
owner: www-data
|
|
group: www-data
|
|
mode: '0750'
|
|
|
|
- name: Configurar VirtualHost Nextcloud
|
|
template:
|
|
src: nextcloud.conf.j2
|
|
dest: /etc/apache2/sites-available/nextcloud.conf
|
|
notify: restart apache2
|
|
|
|
- name: Habilitar sitio Nextcloud
|
|
command: a2ensite nextcloud
|
|
args:
|
|
creates: /etc/apache2/sites-enabled/nextcloud.conf
|
|
notify: restart apache2
|
|
|
|
- name: Informar si Nextcloud ya existe
|
|
debug:
|
|
msg: "Nextcloud ya está instalado, saltando descarga"
|
|
when: nextcloud_exists.stat.exists
|