From 5221a6c678f91f3a66bdcf6af7449df7eb140270 Mon Sep 17 00:00:00 2001 From: Mike Shoup Date: Fri, 10 Nov 2017 17:21:30 -0700 Subject: [PATCH] Add tasks to install nextcloud This commit contains the initial tasks and variables needed to install nextcloud. --- defaults/main.yml | 6 +++- tasks/main.yml | 92 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 96 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 94d629c..939a2e1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,2 +1,6 @@ --- -# defaults file for nextcloud \ No newline at end of file +# defaults file for nextcloud +nextcloud_package_url: https://download.nextcloud.com/server/releases/nextcloud-12.0.3.tar.bz2 +nextcloud_package_destination: "{{ ansible_env.HOME }}" +nextcloud_install_destination: /opt/nextcloud +nextcloud_use_firewalld: true diff --git a/tasks/main.yml b/tasks/main.yml index 1a2a620..3541925 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,2 +1,92 @@ --- -# tasks file for nextcloud \ No newline at end of file +# tasks file for nextcloud +- name: install epel-release + yum: + name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + state: present + +- name: install ius (centos) + yum: + name: https://centos7.iuscommunity.org/ius-release.rpm + state: present + when: ansible_distribution == "CentOS" + +- name: install ius (redhat) + yum: + name: https://rhel7.iuscommunity.org/ius-release.rpm + state: present + when: ansible_distribution == "RedHat" + +- name: install needed packages + package: + name: "{{ item }}" + state: present + with_items: + - httpd + - bzip2 + - mod_php71u + - php71u-cli + - php71u-gd + - php71u-json + - php71u-mbstring + - php71u-mysqlnd + - php71u-pgsql + - php71u-intl + - php71u-mcrypt + - php71u-gmp + - php71u-pecl-memcached + - php71u-pecl-redis + - php71u-pecl-apcu + - php71u-pecl-imagick + +- name: check nextcloud installed + stat: + path: /var/www/html/occ + register: nextcloud_occ + +- name: unarchive nextcloud package + unarchive: + src: "{{ nextcloud_package_url }}" + dest: "{{ nextcloud_package_destination }}" + remote_src: yes + when: nextcloud_occ.stat.exists == False + +- name: copy nextcloud files + shell: "cp -r {{ nextcloud_package_destination }}/nextcloud/* /var/www/html/" + when: nextcloud_occ.stat.exists == False + +#- name: set nextcloud file permissions +# shell: "chown -R apache:apache /var/www/html/" +# when: nextcloud_occ.stat.exists == False + +- name: set nextcloud file permissions + file: + dest: /var/www/html + owner: apache + group: apache + recurse: yes + +- name: remove package files + file: + state: absent + path: "{{ nextcloud_package_destination }}/nextcloud/" + +- name: seboolean httpd_unified + seboolean: + name: httpd_unified + state: yes + persistent: yes + +- name: enable and start httpd + service: + name: httpd + state: started + enabled: yes + +- name: firewall http allow + firewalld: + service: http + permanent: yes + state: enabled + immediate: yes + when: nextcloud_use_firewalld