- name: Make status logs dir
  file:
    path: /var/log/nginx/status
    state: directory

- name: Make logrotate hourly dir
  file:
    path: /etc/logrotate.hourly.d/
    state: directory

- name: Install proper files
  copy:
    src: "{{ item.path }}"
    dest: "/{{ item.path }}"
    mode: "{{ item.mode }}"
  with_items:
    - path: etc/cron.hourly/10logrotate
      mode: '0755'
    - path: etc/logrotate.hourly.d/nginx
      mode: '0644'
    - path: etc/logrotate.hourly.conf
      mode: '0644'
    - path: usr/local/bin/get_keitaro_stat
      mode: '0755'

- name: Make status logs dir
  file:
    path: /var/log/nginx/status
    state: directory

- name: Make logrotate hourly dir
  file:
    path: /etc/logrotate.hourly.d/
    state: directory

- name: Install proper files
  copy:
    src: "{{ item.path }}"
    dest: "/{{ item.path }}"
    mode: "{{ item.mode }}"
  with_items:
    - path: etc/cron.hourly/10logrotate
      mode: '0755'
    - path: etc/logrotate.hourly.d/nginx
      mode: '0644'
    - path: etc/logrotate.hourly.conf
      mode: '0644'
    - path: usr/local/bin/get_keitaro_stat
      mode: '0755'


- name: Add cron job
  cron:
    user: "{{os_user}}"
    name: "save keitaro stats"
    job: "/usr/local/bin/get_keitaro_stat > {{ keitaro.path }}/application/stats.json"
    minute: 5

Add saving stats cron job
Add saving stats cron job
