- name: Install executable files
  copy:
    src: "{{ item }}"
    dest: "/usr/local/bin/{{ item }}"
    mode: "0755"
  with_items:
    - get_keitaro_stat
    - rotate_nginx_status_logs

- name: Add rotating nginx status log files cron job
  cron:
    name: "Rotate nginx http status logs"
    job: /usr/local/bin/rotate_nginx_status_logs
    minute: 2,17,32,47

- name: Add saving keitaro stats cron job
  cron:
    name: "save keitaro stats"
    job: "/usr/local/bin/get_keitaro_stat > {{ keitaro.path }}/var/stats.json"
    minute: 3,18,33,48

- name: Install executable files
  copy:
    src: "{{ item }}"
    dest: "/usr/local/bin/{{ item }}"
    mode: "0755"
  with_items:
    - get_keitaro_stat
    - rotate_nginx_status_logs

- name: Add rotating nginx status log files cron job
  cron:
    name: "Rotate nginx http status logs"
    job: |
      /usr/local/bin/rotate_nginx_status_logs && /usr/local/bin/get_keitaro_stat > {{ keitaro.path }}/var/stats.json
    minute: 2,17,32,47

Save stats.json immediately after rotating nginx status logs
Save stats.json immediately after rotating nginx status logs
