---

- name: cron save-reports
  cron:
    name: "faf save-reports"
    user: faf
    job: "faf save-reports --speedup >> /var/log/faf/save-reports.log 2>&1"
    minute: "*/5"
    state: present

- name: cron create-problems-speedup
  cron:
    name: "faf create-problems-speedup with type {{ item }}"
    user: faf
    job: "faf create-problems -p {{ item }} --speedup --report-min-count 2 >> /var/log/faf/create-problems-{{ item }}.log 2>&1"
    minute: "{{ 60 | random(seed=item) }}"
    hour: "2"
    state: present
  loop:
    - "core"
    - "kerneloops"
    - "python"
    - "ruby"
    - "java"

- name: cron create-problems
  cron:
    name: "faf create-problems with type {{ item }}"
    user: faf
    job: "faf create-problems -p {{ item }} >> /var/log/faf/create-problems-{{ item }}.log 2>&1"
    day: "15"
    minute: "30"
    hour: "14"
    state: present
  loop:
    - "core"
    - "kerneloops"
    - "python"
    - "ruby"
    - "java"

- name: cron reposync
  cron:
    name: "faf reposync"
    user: faf
    job: "faf reposync >> /var/log/faf/reposync.log 2>&1"
    minute: "5"
    hour: "3"
    state: present

- name: retrace symbols
  cron:
    name: "retrace symbols with type {{ item.type }}"
    user: faf
    job: "faf retrace --workers 4 -dp {{ item.type }} --max-fail-count 1 >> /var/log/faf/retrace-{{ item.type }}.log 2>&1"
    minute: "32"
    hour: "2"
    weekday: "{{ item.day }}"
    state: present
  loop:
    - { type: "core", day: "2,4,6" }
    - { type: "kerneloops", day: "1,3,5" }

- name: cron - faf find-crashfn
  cron:
    name: "cron for faf find-crashfn for {{ item }}"
    user: faf
    job: "faf find-crashfn -p {{ item }}"
    minute: "{{ 60 | random(seed=item) }}"
    hour: "5"
    state: present
  loop:
    - "core"
    - "kerneloops"
    - "python"
    - "ruby"
    - "java"

- name: cron pull-releases
  cron:
    name: "faf pull-releases {{ item }}"
    user: faf
    job: "faf pull-releases -o {{ item }} >> /var/log/faf/pull-releases.log 2>&1"
    minute: "5"
    hour: "0"
    state: present
  loop: "{{ faf_opsys_list }}"

- name: cron pull-components
  cron:
    name: "faf pull-components {{ item }}"
    user: faf
    job: "faf pull-components -o {{ item }} >> /var/log/faf/pull-components.log 2>&1"
    minute: "5"
    hour: "1"
    state: present
  loop: "{{ faf_opsys_list }}"

- name: cron - faf find-components
  cron:
    name: "cron for faf find-components -o {{ item }}"
    user: faf
    job: "faf find-components -o {{ item }} >> /var/log/faf/find-components.log 2>&1"
    minute: "5"
    hour: "2"
    state: present
  loop: "{{ faf_opsys_list }}"

- name: cron - faf match-unknown-packages
  cron:
    name: "cron for faf match-unknown-packages"
    user: faf
    job: "faf match-unknown-packages >> /var/log/faf/match-unknown-packages.log 2>&1"
    minute: "23"
    hour: "22"
    state: present
