From b201a21105698af1fff0e8abae51aeacb495e52b Mon Sep 17 00:00:00 2001 From: Christoph Date: Fri, 27 Mar 2026 14:56:14 +0100 Subject: [PATCH] Refactor apache2.yml for consistency and clarity in task definitions --- roles/common/tasks/apache2.yml | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/roles/common/tasks/apache2.yml b/roles/common/tasks/apache2.yml index 43bfa0e..b7cfd61 100644 --- a/roles/common/tasks/apache2.yml +++ b/roles/common/tasks/apache2.yml @@ -1,5 +1,4 @@ --- - # --- # Apache2 Server # --- @@ -7,31 +6,29 @@ - name: Populate service facts ansible.builtin.service_facts: -#- name: Print service facts -# ansible.builtin.debug: -# var: ansible_facts.services -# when: -# - ansible_facts['services']['apache2.service']['name'] | default('not-found') != 'not-found' - +# - name: Print service facts +# ansible.builtin.debug: +# var: ansible_facts.services +# when: +# - ansible_facts['services']['apache2.service']['name'] | default('not-found') != 'not-found' - name: (apache2.yml) Ensure directory '/etc/systemd/system/apache2.service.d' is present - file: + ansible.builtin.file: path: /etc/systemd/system/apache2.service.d state: directory owner: root group: root - mode: '0755' + mode: "0755" when: - ansible_facts['services']['apache2.service']['name'] | default('not-found') != 'not-found' - - name: (apache2.yml) Ensure file '/etc/systemd/system/apache2.service.d/limits.conf' exists - copy: - src: 'etc/systemd/system/apache2.service.d/limits.conf' - dest: '/etc/systemd/system/apache2.service.d/limits.conf' + ansible.builtin.copy: + src: "etc/systemd/system/apache2.service.d/limits.conf" + dest: "/etc/systemd/system/apache2.service.d/limits.conf" owner: root group: root - mode: '0644' + mode: "0644" notify: "Restart apache2" when: - ansible_facts['services']['apache2.service']['name'] | default('not-found') != 'not-found'