dellemc.openmanage.ome_discovery (9.1.0) — module

Create, modify, or delete a discovery job on OpenManage Enterprise

| "added in version" 3.3.0 of dellemc.openmanage"

Authors: Jagadeesh N V (@jagadeeshnv), Sajna Shetty (@Sajna-Shetty), Abhishek Sinha (@Abhishek-Dell)

Install collection

Install with ansible-galaxy collection install dellemc.openmanage:==9.1.0


Add to requirements.yml

  collections:
    - name: dellemc.openmanage
      version: 9.1.0

Description

This module allows to create, modify, or delete a discovery job.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
---
- name: Discover servers in a range
  dellemc.openmanage.ome_discovery:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    discovery_job_name: "Discovery_server_1"
    discovery_config_targets:
      - network_address_detail:
          - 192.96.24.1-192.96.24.255
        device_types:
          - SERVER
        wsman:
          username: user
          password: password
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Discover chassis in a range
  dellemc.openmanage.ome_discovery:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    discovery_job_name: "Discovery_chassis_1"
    discovery_config_targets:
      - network_address_detail:
          - 192.96.24.1-192.96.24.255
        device_types:
          - CHASSIS
        wsman:
          username: user
          password: password
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Discover switches in a range
  dellemc.openmanage.ome_discovery:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    discovery_job_name: "Discover_switch_1"
    discovery_config_targets:
      - network_address_detail:
          - 192.96.24.1-192.96.24.255
        device_types:
          - NETWORK SWITCH
        snmp:
          community: snmp_creds
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Discover storage in a range
  dellemc.openmanage.ome_discovery:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    discovery_job_name: "Discover_storage_1"
    discovery_config_targets:
      - network_address_detail:
          - 192.96.24.1-192.96.24.255
        device_types:
          - STORAGE
        storage:
          username: user
          password: password
        snmp:
          community: snmp_creds
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete a discovery job
  dellemc.openmanage.ome_discovery:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    state: "absent"
    discovery_job_name: "Discovery-123"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Schedule the discovery of multiple devices ignoring partial failure and enable trap to receive alerts
  dellemc.openmanage.ome_discovery:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    state: "present"
    discovery_job_name: "Discovery-123"
    discovery_config_targets:
      - network_address_detail:
          - 192.96.24.1-192.96.24.255
          - 192.96.0.0/24
          - 192.96.26.108
        device_types:
          - SERVER
          - CHASSIS
          - STORAGE
          - NETWORK SWITCH
        wsman:
          username: wsman_user
          password: wsman_pwd
        redfish:
          username: redfish_user
          password: redfish_pwd
        snmp:
          community: snmp_community
      - network_address_detail:
          - 192.96.25.1-192.96.25.255
          - ipmihost
          - esxiserver
          - sshserver
        device_types:
          - SERVER
        ssh:
          username: ssh_user
          password: ssh_pwd
        vmware:
          username: vm_user
          password: vmware_pwd
        ipmi:
          username: ipmi_user
          password: ipmi_pwd
    schedule: RunLater
    cron: "0 0 9 ? * MON,WED,FRI *"
    ignore_partial_failure: true
    trap_destination: true
    community_string: true
    email_recipient: test_email@company.com
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Discover servers with ca check enabled
  dellemc.openmanage.ome_discovery:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    discovery_job_name: "Discovery_server_ca1"
    discovery_config_targets:
      - network_address_detail:
          - 192.96.24.108
        device_types:
          - SERVER
        wsman:
          username: user
          password: password
          ca_check: true
          certificate_data: "{{ lookup('ansible.builtin.file', '/path/to/certificate_data_file') }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Discover chassis with ca check enabled data
  dellemc.openmanage.ome_discovery:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    discovery_job_name: "Discovery_chassis_ca1"
    discovery_config_targets:
      - network_address_detail:
          - 192.96.24.108
        device_types:
          - CHASSIS
        redfish:
          username: user
          password: password
          ca_check: true
          certificate_data: "-----BEGIN CERTIFICATE-----\r\n
          ABCDEFGHIJKLMNOPQRSTUVWXYZaqwertyuiopasdfghjklzxcvbnmasdasagasvv\r\n
          ABCDEFGHIJKLMNOPQRSTUVWXYZaqwertyuiopasdfghjklzxcvbnmasdasagasvv\r\n
          ABCDEFGHIJKLMNOPQRSTUVWXYZaqwertyuiopasdfghjklzxcvbnmasdasagasvv\r\n
          aqwertyuiopasdfghjklzxcvbnmasdasagasvv=\r\n
          -----END CERTIFICATE-----"

Inputs

    
cron:
    description:
    - Provide a cron expression based on Quartz cron format.
    type: str

port:
    default: 443
    description: OpenManage Enterprise HTTPS port.
    type: int

state:
    choices:
    - present
    - absent
    default: present
    description:
    - C(present) creates a discovery job or modifies an existing discovery job.
    - I(discovery_job_name) is mandatory for the creation of a new discovery job.
    - If multiple discoveries of the same I(discovery_job_name) exist, then the new discovery
      job will not be created.
    - C(absent) deletes an existing discovery job(s) with the specified I(discovery_job_name).
    type: str

ca_path:
    description:
    - The Privacy Enhanced Mail (PEM) file that contains a CA certificate to be used for
      the validation.
    type: path
    version_added: 5.0.0
    version_added_collection: dellemc.openmanage

timeout:
    default: 30
    description: The socket level timeout in seconds.
    type: int
    version_added: 5.0.0
    version_added_collection: dellemc.openmanage

hostname:
    description: OpenManage Enterprise IP address or hostname.
    required: true
    type: str

job_wait:
    default: true
    description:
    - Provides the option to wait for job completion.
    - This option is applicable when I(state) is C(present).
    type: bool

new_name:
    description: New name of the discovery configuration job.
    type: str

password:
    description:
    - OpenManage Enterprise password.
    - If the password is not provided, then the environment variable C(OME_PASSWORD) is
      used.
    - 'Example: export OME_PASSWORD=password'
    required: true
    type: str

schedule:
    choices:
    - RunNow
    - RunLater
    default: RunNow
    description:
    - Provides the option to schedule the discovery job.
    - If C(RunLater) is selected, then I(cron) must be specified.
    type: str

username:
    description:
    - OpenManage Enterprise username.
    - If the username is not provided, then the environment variable C(OME_USERNAME) is
      used.
    - 'Example: export OME_USERNAME=username'
    required: true
    type: str

discovery_id:
    description:
    - ID of the discovery configuration group.
    - This value is DiscoveryConfigGroupId in the return values under discovery_status.
    - It is mutually exclusive with I(discovery_job_name).
    type: int

validate_certs:
    default: true
    description:
    - If C(false), the SSL certificates will not be validated.
    - Configure C(false) only on personally controlled sites where self-signed certificates
      are used.
    - Prior to collection version C(5.0.0), the I(validate_certs) is C(false) by default.
    type: bool
    version_added: 5.0.0
    version_added_collection: dellemc.openmanage

email_recipient:
    description: Enter the email address to which notifications are to be sent about the
      discovery job status. Configure the SMTP settings to allow sending notifications
      to an email address.
    type: str

community_string:
    default: false
    description: Enable the use of SNMP community strings to receive SNMP traps using
      Application Settings in OpenManage Enterprise. This option is available only for
      the discovered iDRAC servers and MX7000 chassis.
    type: bool

job_wait_timeout:
    default: 10800
    description:
    - The maximum wait time of I(job_wait) in seconds. The job is tracked only for this
      duration.
    - This option is applicable when I(job_wait) is C(true).
    type: int

trap_destination:
    default: false
    description:
    - Enable OpenManage Enterprise to receive the incoming SNMP traps from the discovered
      devices.
    - This is effective only for servers discovered by using their iDRAC interface.
    type: bool

discovery_job_name:
    description:
    - Name of the discovery configuration job.
    - It is mutually exclusive with I(discovery_id).
    type: str

ignore_partial_failure:
    default: false
    description:
    - Provides the option to ignore partial failures. Partial failures occur when there
      is a combination of both discovered and undiscovered IPs.
    - If C(false), then the partial failure is not ignored, and the module will error
      out.
    - If C(true), then the partial failure is ignored.
    - This option is only applicable if I(job_wait) is C(true).
    type: bool

discovery_config_targets:
    description:
    - Provide the list of discovery targets.
    - Each discovery target is a set of I(network_address_detail), I(device_types), and
      one or more protocol credentials.
    - This is mandatory when I(state) is C(present).
    - C(WARNING) Modification of this field is not supported, this field is overwritten
      every time. Ensure to provide all the required details for this field.
    elements: dict
    suboptions:
      device_types:
        description:
        - Provide the type of devices to be discovered.
        - The accepted types are SERVER, CHASSIS, NETWORK SWITCH, and STORAGE.
        - A combination or all of the above can be provided.
        - 'Supported protocols for each device type are:'
        - SERVER - I(wsman), I(redfish), I(snmp), I(ipmi), I(ssh), and I(vmware).
        - CHASSIS - I(wsman), and I(redfish).
        - NETWORK SWITCH - I(snmp).
        - STORAGE - I(storage), and I(snmp).
        elements: str
        required: true
        type: list
      ipmi:
        description: Intelligent Platform Management Interface (IPMI)
        suboptions:
          kgkey:
            description: KgKey for the IPMI protocol.
            type: str
          password:
            description: Provide a password for the protocol.
            required: true
            type: str
          retries:
            default: 3
            description: Enter the number of repeated attempts required to discover a
              device.
            type: int
          timeout:
            default: 60
            description: Enter the time in seconds after which a job must stop running.
            type: int
          username:
            description: Provide a username for the protocol.
            required: true
            type: str
        type: dict
      network_address_detail:
        description:
        - Provide the list of IP addresses, host names, or the range of IP addresses of
          the devices to be discovered or included.
        - Sample Valid IP Range Formats
        - '   192.35.0.0'
        - '   192.36.0.0-10.36.0.255'
        - '   192.37.0.0/24'
        - '   2345:f2b1:f083:135::5500/118'
        - '   2345:f2b1:f083:135::a500-2607:f2b1:f083:135::a600'
        - '   hostname.domain.tld'
        - '   hostname'
        - '   2345:f2b1:f083:139::22a'
        - Sample Invalid IP Range Formats
        - '   192.35.0.*'
        - '   192.36.0.0-255'
        - '   192.35.0.0/255.255.255.0'
        - C(NOTE) The range size for the number of IP addresses is limited to 16,385 (0x4001).
        - C(NOTE) Both IPv6 and IPv6 CIDR formats are supported.
        elements: str
        required: true
        type: list
      redfish:
        description: REDFISH protocol.
        suboptions:
          ca_check:
            default: false
            description: Enable the Certificate Authority (CA) check.
            type: bool
          certificate_data:
            description: Provide certificate data for the CA check.
            type: str
          cn_check:
            default: false
            description: Enable the Common Name (CN) check.
            type: bool
          domain:
            description: Provide a domain for the protocol.
            type: str
          password:
            description: Provide a password for the protocol.
            required: true
            type: str
          port:
            default: 443
            description: Enter the port number that the job must use to discover the devices.
            type: int
          retries:
            default: 3
            description: Enter the number of repeated attempts required to discover a
              device.
            type: int
          timeout:
            default: 60
            description: Enter the time in seconds after which a job must stop running.
            type: int
          username:
            description: Provide a username for the protocol.
            required: true
            type: str
        type: dict
      snmp:
        description: Simple Network Management Protocol (SNMP).
        suboptions:
          community:
            description: Community string for the SNMP protocol.
            required: true
            type: str
          port:
            default: 161
            description: Enter the port number that the job must use to discover the devices.
            type: int
          retries:
            default: 3
            description: Enter the number of repeated attempts required to discover a
              device.
            type: int
          timeout:
            default: 3
            description: Enter the time in seconds after which a job must stop running.
            type: int
        type: dict
      ssh:
        description: Secure Shell (SSH).
        suboptions:
          check_known_hosts:
            default: false
            description: Verify the known host key.
            type: bool
          is_sudo_user:
            default: false
            description: Use the SUDO option.
            type: bool
          password:
            description: Provide a password for the protocol.
            required: true
            type: str
          port:
            default: 22
            description: Enter the port number that the job must use to discover the devices.
            type: int
          retries:
            default: 3
            description: Enter the number of repeated attempts required to discover a
              device.
            type: int
          timeout:
            default: 60
            description: Enter the time in seconds after which a job must stop running.
            type: int
          username:
            description: Provide a username for the protocol.
            required: true
            type: str
        type: dict
      storage:
        description: HTTPS Storage protocol.
        suboptions:
          ca_check:
            default: false
            description: Enable the Certificate Authority (CA) check.
            type: bool
          certificate_data:
            description: Provide certificate data for the CA check.
            type: str
          cn_check:
            default: false
            description: Enable the Common Name (CN) check.
            type: bool
          domain:
            description: Provide a domain for the protocol.
            type: str
          password:
            description: Provide a password for the protocol.
            required: true
            type: str
          port:
            default: 443
            description: Enter the port number that the job must use to discover the devices.
            type: int
          retries:
            default: 3
            description: Enter the number of repeated attempts required to discover a
              device.
            type: int
          timeout:
            default: 60
            description: Enter the time in seconds after which a job must stop running.
            type: int
          username:
            description: Provide a username for the protocol.
            required: true
            type: str
        type: dict
      vmware:
        description: VMWARE protocol.
        suboptions:
          ca_check:
            default: false
            description: Enable the Certificate Authority (CA) check.
            type: bool
          certificate_data:
            description: Provide certificate data for the CA check.
            type: str
          cn_check:
            default: false
            description: Enable the Common Name (CN) check.
            type: bool
          domain:
            description: Provide a domain for the protocol.
            type: str
          password:
            description: Provide a password for the protocol.
            required: true
            type: str
          port:
            default: 443
            description: Enter the port number that the job must use to discover the devices.
            type: int
          retries:
            default: 3
            description: Enter the number of repeated attempts required to discover a
              device.
            type: int
          timeout:
            default: 60
            description: Enter the time in seconds after which a job must stop running.
            type: int
          username:
            description: Provide a username for the protocol.
            required: true
            type: str
        type: dict
      wsman:
        description: Web Services-Management (WS-Man).
        suboptions:
          ca_check:
            default: false
            description: Enable the Certificate Authority (CA) check.
            type: bool
          certificate_data:
            description: Provide certificate data for the CA check.
            type: str
          cn_check:
            default: false
            description: Enable the Common Name (CN) check.
            type: bool
          domain:
            description: Provide a domain for the protocol.
            type: str
          password:
            description: Provide a password for the protocol.
            required: true
            type: str
          port:
            default: 443
            description: Enter the port number that the job must use to discover the devices.
            type: int
          retries:
            default: 3
            description: Enter the number of repeated attempts required to discover a
              device.
            type: int
          timeout:
            default: 60
            description: Enter the time in seconds after which a job must stop running.
            type: int
          username:
            description: Provide a username for the protocol.
            required: true
            type: str
        type: dict
    type: list

Outputs

discovery_ids:
  description: IDs of the discoveries with duplicate names.
  returned: when discoveries with duplicate name exist for I(state) is C(present)
  sample:
  - 1234
  - 5678
  type: list
discovery_status:
  description:
  - Details of the discovery job created or modified.
  - If I(job_wait) is true, Completed and Failed IPs are also listed.
  returned: when I(state) is C(present)
  sample:
    Completed:
    - 192.168.24.17
    - 192.168.24.20
    - 192.168.24.22
    DiscoveredDevicesByType:
    - Count: 3
      DeviceType: SERVER
    DiscoveryConfigDiscoveredDeviceCount: 3
    DiscoveryConfigEmailRecipient: myemail@dell.com
    DiscoveryConfigExpectedDeviceCount: 9
    DiscoveryConfigGroupId: 125
    Failed:
    - 192.168.24.15
    - 192.168.24.16
    - 192.168.24.18
    - 192.168.24.19
    - 192.168.24.21
    - host123
    JobDescription: D1
    JobEnabled: true
    JobEndTime: '2021-01-01 06:27:29.99'
    JobId: 12666
    JobName: D1
    JobNextRun: null
    JobProgress: '100'
    JobSchedule: startnow
    JobStartTime: '2021-01-01 06:24:10.071'
    JobStatusId: 2090
    LastUpdateTime: '2021-01-01 06:27:30.001'
    UpdatedBy: admin
  type: dict
error_info:
  description: Details of the HTTP Error.
  returned: on HTTP error
  sample:
    error:
      '@Message.ExtendedInfo':
      - Message: Unable to process the request because an error occurred.
        MessageArgs: []
        MessageId: GEN1234
        RelatedProperties: []
        Resolution: Retry the operation. If the issue persists, contact your system
          administrator.
        Severity: Critical
      code: Base.1.0.GeneralError
      message: A general error has occurred. See ExtendedInfo for more information.
  type: dict
job_detailed_status:
  description: Detailed last execution history of a job.
  returned: All time.
  sample:
  - ElapsedTime: 00:00:00
    EndTime: null
    ExecutionHistoryId: 564873
    Id: 656893
    IdBaseEntity: 0
    JobStatus:
      Id: 2050
      Name: Running
    Key: 192.96.24.1
    Progress: '0'
    StartTime: '2023-07-04 06:23:54.008'
    Value: 'Running

      Discovery of target 192.96.24.1 started.

      Discovery target resolved to IP  192.96.24.1 .'
  type: list
msg:
  description: Overall status of the discovery operation.
  returned: always
  sample: Successfully deleted 1 discovery job(s).
  type: str