---
- name: Testing
  hosts: dnac_servers
  gather_facts: false

  vars_files:
    - "credentials.yml"

  vars:
    dnac_login: &dnac_login
      dnac_host: "{{ dnac_host }}"
      dnac_username: "{{ dnac_username }}"
      dnac_password: "{{ dnac_password }}"
      dnac_verify: "{{ dnac_verify }}"
      dnac_port: "{{ dnac_port }}"
      dnac_version: "{{ dnac_version }}"
      dnac_debug: "{{ dnac_debug }}"
      dnac_log: true
      dnac_log_level: INFO
      dnac_log_append: false
      config_verify: true

  tasks:
    - name: Run Compliance check using IP address list (run_compliance by default is true)
      cisco.dnac.network_compliance_workflow_manager:
        <<: *dnac_login
        config:
          - ip_address_list: ['204.1.2.2', '204.1.2.5', '204.1.2.4']

    - name: Run Compliance check using IP address list
      cisco.dnac.network_compliance_workflow_manager:
        <<: *dnac_login
        config:
          - ip_address_list: ['204.1.2.2', '204.1.2.5', '204.1.2.4']
            run_compliance: true


    - name: Run Compliance check using Site
      cisco.dnac.network_compliance_workflow_manager:
        <<: *dnac_login
        config:
          - site: "Global"
            run_compliance: true


    - name: Run Compliance check using both IP address list and Site
      cisco.dnac.network_compliance_workflow_manager:
        <<: *dnac_login
        config:
          - ip_address_list: ['204.1.2.2', '204.1.2.5', '204.1.2.4']
            site_name: "Global/USA/San Francisco/Building_1/floor_1"
            run_compliance: true


    - name: Run Compliance check with specific categories using IP address list
      cisco.dnac.network_compliance_workflow_manager:
        <<: *dnac_login
        config:
          - ip_address_list: ['204.1.2.2', '204.1.2.5', '204.1.2.4']
            run_compliance_categories: ['INTENT', 'RUNNING_CONFIG', 'IMAGE', 'PSIRT']


    - name: Run Compliance check with specific categories using Site
      cisco.dnac.network_compliance_workflow_manager:
        <<: *dnac_login
        config:
          - site_name: "Global"
            run_compliance_categories: ['INTENT', 'RUNNING_CONFIG', 'IMAGE', 'PSIRT']


    - name: Run Compliance check with specific categories using both  IP address list and Site
      cisco.dnac.network_compliance_workflow_manager:
        <<: *dnac_login
        config:
          - ip_address_list: ['204.1.2.2', '204.1.2.5', '204.1.2.4']
            site_name: "Global/USA/San Francisco/Building_1/floor_1"
            run_compliance_categories: ['INTENT', 'RUNNING_CONFIG', 'IMAGE', 'PSIRT']


    - name: Sync Device Configuration using IP address list
      cisco.dnac.network_compliance_workflow_manager:
        <<: *dnac_login
        config:
          - ip_address_list: ['204.1.2.2', '204.1.2.5', '204.1.2.4']
            run_compliance: false
            sync_device_config: true


    - name: Sync Device Configuration using Site
      cisco.dnac.network_compliance_workflow_manager:
        <<: *dnac_login
        config:
          - site_name: "Global/USA/San Francisco/Building_1/floor_1"
            run_compliance: false
            sync_device_config: true


    - name: Sync Device Configuration using both IP address list and Site
      cisco.dnac.network_compliance_workflow_manager:
        <<: *dnac_login
        config:
          - ip_address_list: ['204.1.2.2', '204.1.2.5', '204.1.2.4']
            site_name: "Global/USA/San Francisco/Building_1/floor_1"
            run_compliance: false
            sync_device_config: true


    - name: Run Compliance and Sync Device Configuration with IP address list
      cisco.dnac.network_compliance_workflow_manager:
        <<: *dnac_login
        config:
          - ip_address_list: ['204.1.2.2', '204.1.2.5', '204.1.2.4']
            run_compliance: true
            sync_device_config: true


    - name: Run Compliance and Sync Device Configuration with Site
      cisco.dnac.network_compliance_workflow_manager:
        <<: *dnac_login
        config:
          - site_name: "Global/USA/San Francisco/Building_1/floor_1"
            run_compliance: true
            sync_device_config: true


    - name: Run Compliance with specific categories and Sync Device Configuration with IP address list
      cisco.dnac.network_compliance_workflow_manager:
        <<: *dnac_login
        config:
          - ip_address_list: ['204.1.2.2', '204.1.2.5', '204.1.2.4']
            run_compliance_categories: ['INTENT', 'RUNNING_CONFIG', 'IMAGE', 'PSIRT']
            sync_device_config: true


    - name: Run Compliance with specific categories and Sync Device Configuration with Site
      cisco.dnac.network_compliance_workflow_manager:
        <<: *dnac_login
        config:
          - site_name: "Global/USA/San Francisco/Building_1/floor_1"
            run_compliance_categories: ['INTENT', 'RUNNING_CONFIG', 'IMAGE', 'PSIRT']
            sync_device_config: true


    - name: Run Compliance and Sync Device Configuration using both IP address list and Site
      cisco.dnac.network_compliance_workflow_manager:
        <<: *dnac_login
        config:
          - ip_address_list: ['204.1.2.2', '204.1.2.5', '204.1.2.4']
            site_name: "Global/USA/San Francisco/Building_1/floor_1"
            run_compliance: true
            sync_device_config: true
