---
- name: Dell OpenManage Ansible OME firmware baseline operations.
  hosts: ome
  gather_facts: false

  tasks:
    - name: Create baseline for device IDs
      dellemc.openmanage.ome_firmware_baseline:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        ca_path: "/path/to/ca_cert.pem"
        baseline_name: "baseline_name"
        baseline_description: "baseline_description"
        catalog_name: "catalog_name"
        device_ids:
          - 1010
          - 2020
      delegate_to: localhost

    - name: Create baseline for device IDs with no reboot required
      dellemc.openmanage.ome_firmware_baseline:
        hostname: "192.168.0.1"
        username: "username"
        password: "password"
        ca_path: "/path/to/ca_cert.pem"
        baseline_name: "baseline_name"
        baseline_description: "baseline_description"
        catalog_name: "catalog_name"
        filter_no_reboot_required: true
        device_ids:
          - 1010
          - 2020
      delegate_to: localhost

    - name: Create baseline for servicetags
      dellemc.openmanage.ome_firmware_baseline:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        ca_path: "/path/to/ca_cert.pem"
        baseline_name: "baseline_name"
        baseline_description: "baseline_description"
        catalog_name: "catalog_name"
        device_service_tags:
          - "SVCTAG1"
          - "SVCTAG2"
      delegate_to: localhost

    - name: Create baseline for servicetags with no reboot required
      dellemc.openmanage.ome_firmware_baseline:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        ca_path: "/path/to/ca_cert.pem"
        baseline_name: "baseline_name"
        baseline_description: "baseline_description"
        catalog_name: "catalog_name"
        filter_no_reboot_required: true
        device_service_tags:
          - "SVCTAG1"
          - "SVCTAG2"
      delegate_to: localhost

    - name: Create baseline for device groups without job_tracking
      dellemc.openmanage.ome_firmware_baseline:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        ca_path: "/path/to/ca_cert.pem"
        baseline_name: "baseline_name"
        baseline_description: "baseline_description"
        catalog_name: "catalog_name"
        device_group_names:
          - "Group1"
          - "Group2"
        job_wait: false
      delegate_to: localhost

    - name: Modify an existing baseline
      dellemc.openmanage.ome_firmware_baseline:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        ca_path: "/path/to/ca_cert.pem"
        baseline_name: "existing_baseline_name"
        new_baseline_name: "new_baseline_name"
        baseline_description: "new baseline_description"
        catalog_name: "catalog_other"
        device_group_names:
          - "Group3"
          - "Group4"
          - "Group5"
        downgrade_enabled: false
        is_64_bit: true
        filter_no_reboot_required: true
      delegate_to: localhost

    - name: Modify no reboot filter in existing baseline
      dellemc.openmanage.ome_firmware_baseline:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        ca_path: "/path/to/ca_cert.pem"
        baseline_name: "existing_baseline_name"
        new_baseline_name: "new_baseline_name"
        filter_no_reboot_required: true
      delegate_to: localhost

    - name: Delete a baseline
      dellemc.openmanage.ome_firmware_baseline:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        ca_path: "/path/to/ca_cert.pem"
        state: absent
        baseline_name: "baseline_name"
      delegate_to: localhost
