From 5c7a7fe768e6139ae42cce142bd89cb64460412d Mon Sep 17 00:00:00 2001 From: Ludovic Poujol Date: Thu, 1 Sep 2022 12:43:56 +0200 Subject: [PATCH] webapp/nextlcloud: Reorganize tasks files - Apache : Split system/vhost stuff - MySQL : Rename task file to follow same convention as apache --- webapps/nextcloud/tasks/apache-system.yml | 30 ++++++++++++ webapps/nextcloud/tasks/apache-vhost.yml | 23 +++++++++ webapps/nextcloud/tasks/main.yml | 10 ++-- .../tasks/{mysql.yml => mysql-user.yml} | 0 webapps/nextcloud/tasks/vhost-apache.yml | 48 ------------------- .../{apache.conf.j2 => apache-vhost.conf.j2} | 0 6 files changed, 59 insertions(+), 52 deletions(-) create mode 100644 webapps/nextcloud/tasks/apache-system.yml create mode 100644 webapps/nextcloud/tasks/apache-vhost.yml rename webapps/nextcloud/tasks/{mysql.yml => mysql-user.yml} (100%) delete mode 100644 webapps/nextcloud/tasks/vhost-apache.yml rename webapps/nextcloud/templates/{apache.conf.j2 => apache-vhost.conf.j2} (100%) diff --git a/webapps/nextcloud/tasks/apache-system.yml b/webapps/nextcloud/tasks/apache-system.yml new file mode 100644 index 00000000..38b85906 --- /dev/null +++ b/webapps/nextcloud/tasks/apache-system.yml @@ -0,0 +1,30 @@ +--- + +- name: Enable apache2 php configuration + copy: + src: "zzz-apache2-evolinux-custom.ini" + dest: "/etc/php/7.4/apache2/conf.d/zzz-evolinux-custom.ini" + mode: "0644" + owner: root + group: root + force: yes + notify: reload apache + tags: + - nextcloud + +- name: Enable cli php configuration + copy: + src: "zzz-cli-evolinux-custom.ini" + dest: "/etc/php/7.4/cli/conf.d/zzz-evolinux-custom.ini" + mode: "0644" + owner: root + group: root + force: yes + notify: reload apache + tags: + - nextcloud + +# - name: Generate ssl config +# shell: +# cmd: "/usr/local/sbin/vhost-domains {{ nextcloud_instance_name }} | /usr/local/sbin/make-csr {{ nextcloud_instance_name }}" +# creates: "/etc/nginx/ssl/{{ nextcloud_instance_name }}.conf" \ No newline at end of file diff --git a/webapps/nextcloud/tasks/apache-vhost.yml b/webapps/nextcloud/tasks/apache-vhost.yml new file mode 100644 index 00000000..e3f213ca --- /dev/null +++ b/webapps/nextcloud/tasks/apache-vhost.yml @@ -0,0 +1,23 @@ +--- +- name: Copy Apache vhost + template: + src: apache-vhost.conf.j2 + dest: "/etc/apache2/sites-available/{{ nextcloud_instance_name }}.conf" + mode: "0640" + notify: reload apache + tags: + - nextcloud + +- name: Enable Apache vhost + file: + src: "/etc/apache2/sites-available/{{ nextcloud_instance_name }}.conf" + dest: "/etc/apache2/sites-enabled/{{ nextcloud_instance_name }}.conf" + state: link + notify: reload apache + tags: + - nextcloud + +# - name: Generate ssl config +# shell: +# cmd: "/usr/local/sbin/vhost-domains {{ nextcloud_instance_name }} | /usr/local/sbin/make-csr {{ nextcloud_instance_name }}" +# creates: "/etc/nginx/ssl/{{ nextcloud_instance_name }}.conf" \ No newline at end of file diff --git a/webapps/nextcloud/tasks/main.yml b/webapps/nextcloud/tasks/main.yml index f11d62fa..2823f8f5 100644 --- a/webapps/nextcloud/tasks/main.yml +++ b/webapps/nextcloud/tasks/main.yml @@ -21,7 +21,7 @@ tags: - nextcloud -# dependency for mysql_user and mysql_db +# dependency for mysql_user and mysql_db - python2 - name: python modules is installed (Ansible dependency) apt: name: @@ -32,7 +32,7 @@ - nextcloud when: ansible_python_version is version('3', '<') -# dependency for mysql_user and mysql_db +# dependency for mysql_user and mysql_db - python3 - name: python3 modules is installed (Ansible dependency) apt: name: @@ -43,12 +43,14 @@ - nextcloud when: ansible_python_version is version('3', '>=') +- include: apache-system.yml + - include: user.yml - include: archive.yml -- include: vhost-apache.yml +- include: apache-vhost.yml -- include: mysql.yml +- include: mysql-user.yml - include: config.yml diff --git a/webapps/nextcloud/tasks/mysql.yml b/webapps/nextcloud/tasks/mysql-user.yml similarity index 100% rename from webapps/nextcloud/tasks/mysql.yml rename to webapps/nextcloud/tasks/mysql-user.yml diff --git a/webapps/nextcloud/tasks/vhost-apache.yml b/webapps/nextcloud/tasks/vhost-apache.yml deleted file mode 100644 index b710b07a..00000000 --- a/webapps/nextcloud/tasks/vhost-apache.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -- block: - - name: Copy Apache vhost - template: - src: apache.conf.j2 - dest: "/etc/apache2/sites-available/{{ nextcloud_instance_name }}.conf" - mode: "0640" - notify: reload apache - tags: - - nextcloud - - - name: Enable Apache vhost - file: - src: "/etc/apache2/sites-available/{{ nextcloud_instance_name }}.conf" - dest: "/etc/apache2/sites-enabled/{{ nextcloud_instance_name }}.conf" - state: link - notify: reload apache - tags: - - nextcloud - - - name: Enable apache2 php configuration - copy: - src: "zzz-apache2-evolinux-custom.ini" - dest: "/etc/php/7.4/apache2/conf.d/zzz-evolinux-custom.ini" - mode: "0644" - owner: root - group: root - force: yes - notify: reload apache - tags: - - nextcloud - - - name: Enable cli php configuration - copy: - src: "zzz-cli-evolinux-custom.ini" - dest: "/etc/php/7.4/cli/conf.d/zzz-evolinux-custom.ini" - mode: "0644" - owner: root - group: root - force: yes - notify: reload apache - tags: - - nextcloud - - # - name: Generate ssl config - # shell: - # cmd: "/usr/local/sbin/vhost-domains {{ nextcloud_instance_name }} | /usr/local/sbin/make-csr {{ nextcloud_instance_name }}" - # creates: "/etc/nginx/ssl/{{ nextcloud_instance_name }}.conf" \ No newline at end of file diff --git a/webapps/nextcloud/templates/apache.conf.j2 b/webapps/nextcloud/templates/apache-vhost.conf.j2 similarity index 100% rename from webapps/nextcloud/templates/apache.conf.j2 rename to webapps/nextcloud/templates/apache-vhost.conf.j2