Copy only current logs from apache2

* `cp -r /var/log/apache2` copies all the archive(*.gz) logs also.
   So just copy only the current logs
    access.log, error.log, *vhost.log

Change-Id: I2ec55b3da61eb258337f0c0023eb7ebcd9ce1913
This commit is contained in:
siraj.yasin 2021-03-02 02:32:20 +00:00 committed by Roman Gorshunov
parent 5a6213e80d
commit bf588f993a

View File

@ -17,7 +17,7 @@
- name: ensure directory for apache logs exists - name: ensure directory for apache logs exists
file: file:
state: directory state: directory
path: "{{ apache_log_dir }}" path: "{{ apache_log_dir }}/logs"
- name: dump apache logs to directory - name: dump apache logs to directory
shell: |- shell: |-
@ -32,7 +32,7 @@
become: yes become: yes
- name: copy logs - name: copy logs
command: "cp -r /var/log/apache2 {{ apache_log_dir }}/logs" shell: "cp /var/log/apache2/*.log {{ apache_log_dir }}/logs/"
become: yes become: yes
- name: Change ownership of the logs dir - name: Change ownership of the logs dir