diff --git a/roles/php_website/tasks/main.yml b/roles/php_website/tasks/main.yml index 13751868d871a4bd4d35d18b13d8a950754d76c4..79badd10eecaab00605bc0aec986ccaff6d9977e 100644 --- a/roles/php_website/tasks/main.yml +++ b/roles/php_website/tasks/main.yml @@ -1,23 +1,23 @@ --- - name: Create PHP website group - group: + ansible.builtin.group: name: "{{ user }}" gid: "{{ uid | default(omit) }}" state: present - name: Create PHP website admin user - user: + ansible.builtin.user: name: "{{ admin }}" uid: "{{ admin_uid | default(omit) }}" group: "{{ user }}" - shell: /bin/bash + ansible.builtin.shell: /bin/bash createhome: true home: "{{ home }}" state: present - name: Set-up directory for storing user profile configuration files - file: + ansible.builtin.file: path: "{{ home }}/.profile.d" state: directory owner: "{{ admin }}" @@ -25,7 +25,7 @@ mode: "0750" - name: Create PHP website user - user: + ansible.builtin.user: name: "{{ user }}" uid: "{{ uid | default(omit) }}" group: "{{ user }}" @@ -37,10 +37,10 @@ # This is a workaround for a rather stupid bug that Debian seems # uninterested to backport - # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=865762 - shell: /bin/sh + ansible.builtin.shell: /bin/sh - name: Add nginx user to website group - user: + ansible.builtin.user: name: "www-data" groups: "{{ user }}" append: "yes" @@ -50,7 +50,7 @@ # Ownership set to root so Postfix would not check if correct user owns the # file. - name: Set-up forwarding for mails delivered to local application user/admin - template: + ansible.builtin.template: src: "forward.j2" dest: "{{ home }}/.forward" owner: root @@ -58,12 +58,12 @@ mode: "0640" - name: Install extra packages for website - apt: + ansible.builtin.apt: name: "{{ packages }}" state: present - name: Deploy PHP FPM configuration file for website - template: + ansible.builtin.template: src: "fpm_site.conf.j2" dest: "{{ php_fpm_pool_directory }}/{{ fqdn }}.conf" validate: "{{ php_fpm_binary }} -t -y %s" @@ -74,7 +74,7 @@ - Restart PHP-FPM - name: Deploy nginx TLS private key for website - copy: + ansible.builtin.copy: dest: "/etc/ssl/private/{{ fqdn }}_https.key" content: "{{ https_tls_key }}" owner: root @@ -84,7 +84,7 @@ - Restart nginx - name: Deploy nginx TLS certificate for website - copy: + ansible.builtin.copy: dest: "/etc/ssl/certs/{{ fqdn }}_https.pem" content: "{{ https_tls_certificate }}" owner: root @@ -94,7 +94,7 @@ - Restart nginx - name: Deploy configuration file for checking certificate validity via cron - copy: + ansible.builtin.copy: content: "/etc/ssl/certs/{{ fqdn }}_https.pem" dest: "/etc/check_certificate/{{ fqdn }}_https.conf" owner: root @@ -102,7 +102,7 @@ mode: "0644" - name: Deploy nginx configuration file for website - template: + ansible.builtin.template: src: "nginx_site.j2" dest: "/etc/nginx/sites-available/{{ fqdn }}" owner: root @@ -113,7 +113,7 @@ - Restart nginx - name: Enable website - file: + ansible.builtin.file: src: "/etc/nginx/sites-available/{{ fqdn }}" dest: "/etc/nginx/sites-enabled/{{ fqdn }}" state: link @@ -121,7 +121,7 @@ - Restart nginx - name: Explicitly run all handlers - include_tasks: ../handlers/main.yml + ansible.builtin.include_tasks: ../handlers/main.yml when: "run_handlers | default(False) | bool()" tags: - handlers