- name: Copy package to target
  copy:
    src: "../../../{{ qualys_deb_package }}"
    dest: "{{ qualys_package_download_path }}/{{ qualys_deb_package }}"
  when: ansible_pkg_mgr == "apt" and not ansible_check_mode

- name: Copy package to target
  copy:
    src: "../../../{{ qualys_rpm_package }}"
    dest: "{{ qualys_package_download_path }}/{{ qualys_rpm_package }}"
  when: ansible_pkg_mgr == "yum" and not ansible_check_mode

- name: Install the Qualys
  apt:
    deb: "{{ qualys_package_download_path }}/{{ qualys_deb_package }}"
    state: present
    update_cache: true
  when: ansible_pkg_mgr == "apt" and not ansible_check_mode

- name: Install the Qualys
  yum:
    name: "{{ qualys_package_download_path }}/{{ qualys_rpm_package }}"
    state: present
    update_cache: true
  when: ansible_pkg_mgr == "yum" and not ansible_check_mode

- name: Activate Qualys agent
  command: "/usr/local/qualys/cloud-agent/bin/qualys-cloud-agent.sh ActivationId={{ qualys_activation_id }} CustomerId={{ qualys_customer_id }}"
