Files
configpolicy/roles/nextcloud/tasks/main.yml
Dustin C. Hatch b09bf84a3b nextcloud: Deploy Nextcloud w/ Apache+PHP-FPM
The *nextcloud* role installs Nextcloud from the specified release
archive, downloading it to the control machine first if necessary, and
configures Apache and PHP-FPM to serve it.

The `nextcloud.yml` playbook uses the *cert* role to install the X.509
certificate for the Nextcloud server, sets up Apache HTTPD with the
*apache* role, and installs Nextcloud using the *nextcloud* role.

The host *cloud0.pyrocufflink.blue* is the Nextcloud server for
Pyrocufflink.
2020-03-09 20:18:07 -05:00

92 lines
2.0 KiB
YAML

- name: ensure rpmfusion repo is installed
package:
name: >-
https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-{{ ansible_distribution_version }}.noarch.rpm
tags:
- install
- name: ensure required packages are installed
package:
name: '{{ nextcloud_packages }}'
state: present
tags:
- install
- name: ensure nextcloud database user exists
become: true
become_user: postgres
postgresql_user:
name: nextcloud
password: '{{ nextcloud_db_password }}'
state: present
- name: ensure nextcloud database exists
become: true
become_user: postgres
postgresql_db:
name: nextcloud
owner: nextcloud
state: present
- name: ensure nextcloud installation archive is available
become: false
delegate_to: localhost
get_url:
url: '{{ nextcloud_archive_url }}'
dest: roles/nextcloud/files/{{ nextcloud_archive_name }}
checksum: 'sha256:{{ nextcloud_archive_sha256 }}'
tags:
- unarchive
- name: ensure html directory permissions are set
file:
path: /var/www/html
owner: apache
group: apache
mode: '0755'
- name: ensure nextcloud is installed
become: true
become_user: apache
unarchive:
src: '{{ nextcloud_archive_name }}'
dest: /var/www/html
extra_opts:
- --strip-components=1
notify:
- upgrade nextcloud
- update nextcloud .htaccess
tags:
- install
- unarchive
- name: ensure nextcloud data directories exist
file:
path: /var/www/html/{{ item.name }}
owner: apache
group: apache
mode: '{{ item.mode|d("0755") }}'
setype: httpd_sys_rw_content_t
state: directory
with_items:
- name: config
- name: custom_apps
- name: data
mode: '0770'
- name: ensure apache is configured to serve nextcloud
template:
src: nextcloud.httpd.conf.j2
dest: /etc/httpd/conf.d/nextcloud.conf
mode: '0644'
notify: reload httpd
- name: ensure php-fpm starts at boot
service:
name: php-fpm
enabled: true
- name: ensure php-fpm service is running
service:
name: php-fpm
state: started