- name: Creating an empty files for logs
  become: yes
  become_user: "{{ DEV_SYSTEM_USERNAME }}"
  file:
    path: "{{ item }}"
    state: touch
    mode: '777'
  with_items:
    - '{{ VHOST_ACCESS_LOG_VAPI }}'
    - '{{ VHOST_ERROR_LOG_VAPI }}'

- name: Add log files path in apache2.conf for api
  become: yes
  become_user: "{{ DEV_SYSTEM_USERNAME }}"
  blockinfile:
    path: "{{ VAPI_DIR }}/deploy/apache2.conf"
    marker: "# {mark} added custom log files"
    insertbefore: 'LogFormat '
    block: |2
          ErrorLog /var/www/html/error.logs
          CustomLog /var/www/html/access.logs combined 
