---
- name: "configure | configure scanall schedule | CREATE scanschedule"
  uri:
    url: "{{ harbor_external_url }}/api/v2.0/system/scanAll/schedule"
    user: '{{ harbor_admin_username }}'
    password: '{{ harbor_admin_password }}'
    method: POST
    body_format: json
    force_basic_auth: yes
    headers:
      Content-Type: application/json
    body: '{{ scanschedule |to_json }}'
    status_code: [201,412]
  register: create_scanschedule

- name: "configure | configure scanall schedule | UPDATE scanschedule"
  uri:
    url: "{{ harbor_external_url }}/api/v2.0/system/scanAll/schedule"
    user: '{{ harbor_admin_username }}'
    password: '{{ harbor_admin_password }}'
    method: PUT
    body_format: json
    force_basic_auth: yes
    headers:
      Content-Type: application/json
    body: '{{ scanschedule |to_json }}'
    status_code: [200]
  when:
    - create_scanschedule.status in [412]
