dellemc.openmanage.ome_template (9.1.0) — module

Create, modify, deploy, delete, export, import and clone a template on OpenManage Enterprise

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

Authors: Jagadeesh N V (@jagadeeshnv), Husniya Hameed (@husniya_hameed), Kritika Bhateja (@Kritika-Bhateja)

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 creates, modifies, deploys, deletes, exports, imports and clones a template on OpenManage Enterprise.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
---
- name: Create a template from a reference device
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    device_id: 25123
    attributes:
      Name: "New Template"
      Description: "New Template description"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Modify template name, description, and attribute value
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "modify"
    template_id: 12
    attributes:
      Name: "New Custom Template"
      Description: "Custom Template Description"
      # Attributes to be modified in the template.
      # For information on any attribute id, use API /TemplateService/Templates(Id)/Views(Id)/AttributeViewDetails
      # This section is optional
      Attributes:
        - Id: 1234
          Value: "Test Attribute"
          IsIgnored: false
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Modify template name, description, and attribute using detailed view
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "modify"
    template_id: 12
    attributes:
      Name: "New Custom Template"
      Description: "Custom Template Description"
      Attributes:
        # Enter the comma separated string as appearing in the Detailed view on GUI
        # NIC -> NIC.Integrated.1-1-1 -> NIC Configuration -> Wake On LAN1
        - DisplayName: 'NIC, NIC.Integrated.1-1-1, NIC Configuration, Wake On LAN'
          Value: Enabled
          IsIgnored: false
        # System -> LCD Configuration -> LCD 1 User Defined String for LCD
        - DisplayName: 'System, LCD Configuration, LCD 1 User Defined String for LCD'
          Value: LCD str by OMAM
          IsIgnored: false
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Deploy template on multiple devices
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "deploy"
    template_id: 12
    device_id:
      - 12765
      - 10173
    device_service_tag:
      - 'SVTG123'
      - 'SVTG456'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Deploy template on groups
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "deploy"
    template_id: 12
    device_group_names:
      - server_group_1
      - server_group_2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Deploy template on multiple devices along with the attributes values to be modified on the target devices
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "deploy"
    template_id: 12
    device_id:
      - 12765
      - 10173
    device_service_tag:
      - 'SVTG123'
    attributes:
      # Device specific attributes to be modified during deployment.
      # For information on any attribute id, use API /TemplateService/Templates(Id)/Views(Id)/AttributeViewDetails
      # This section is optional
      Attributes:
        # specific device where attribute to be modified at deployment run-time.
        # The DeviceId should be mentioned above in the 'device_id' section.
        # Service tags not allowed.
        - DeviceId: 12765
          Attributes:
            - Id: 15645
              Value: "0.0.0.0"
              IsIgnored: false
        - DeviceId: 10173
          Attributes:
            - Id: 18968,
              Value: "hostname-1"
              IsIgnored: false
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Deploy template and Operating System (OS) on multiple devices
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "deploy"
    template_id: 12
    device_id:
      - 12765
    device_service_tag:
      - 'SVTG123'
    attributes:
      # Include this to install OS on the devices.
      # This section is optional
      NetworkBootIsoModel:
        BootToNetwork: true
        ShareType: "NFS"
        IsoTimeout: 1 # allowable values(1,2,4,8,16) in hours
        IsoPath: "/home/iso_path/filename.iso"
        ShareDetail:
          IpAddress: "192.168.0.2"
          ShareName: "sharename"
          User: "share_user"
          Password: "share_password"
      Options:
        EndHostPowerState: 1
        ShutdownType: 0
        TimeToWaitBeforeShutdown: 300
      Schedule:
        RunLater: true
        RunNow: false
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Deploy template on multiple devices and changes the device-level attributes. After the template is deployed,
install OS using its image"
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "deploy"
    template_id: 12
    device_id:
      - 12765
      - 10173
    device_service_tag:
      - 'SVTG123'
      - 'SVTG456'
    attributes:
      Attributes:
        - DeviceId: 12765
          Attributes:
            - Id: 15645
              Value: "0.0.0.0"
              IsIgnored: false
        - DeviceId: 10173
          Attributes:
            - Id: 18968,
              Value: "hostname-1"
              IsIgnored: false
      NetworkBootIsoModel:
        BootToNetwork: true
        ShareType: "NFS"
        IsoTimeout: 1 # allowable values(1,2,4,8,16) in hours
        IsoPath: "/home/iso_path/filename.iso"
        ShareDetail:
          IpAddress: "192.168.0.2"
          ShareName: "sharename"
          User: "share_user"
          Password: "share_password"
      Options:
        EndHostPowerState: 1
        ShutdownType: 0
        TimeToWaitBeforeShutdown: 300
      Schedule:
        RunLater: true
        RunNow: false
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete template
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "delete"
    template_id: 12
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Export a template
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "export"
    template_id: 12
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Start of example to export template to a local xml file
- name: Export template to a local xml file
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "export"
    template_name: "my_template"
  register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Save template into a file
  ansible.builtin.copy:
    content: "{{ result.Content}}"
    dest: "/path/to/exported_template.xml"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# End of example to export template to a local xml file

- name: Clone a template
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "clone"
    template_id: 12
    attributes:
      Name: "New Cloned Template Name"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Import template from XML content
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "import"
    attributes:
      Name: "Imported Template Name"
      # Template Type from TemplateService/TemplateTypes
      Type: 2
      # xml string content
      Content: "<SystemConfiguration Model=\"PowerEdge R940\" ServiceTag=\"SVCTAG1\"
      TimeStamp=\"Tue Sep 24 09:20:57.872551 2019\">\n<Component FQDD=\"AHCI.Slot.6-1\">\n<Attribute
      Name=\"RAIDresetConfig\">True</Attribute>\n<Attribute Name=\"RAIDforeignConfig\">Clear</Attribute>\n
      </Component>\n<Component FQDD=\"Disk.Direct.0-0:AHCI.Slot.6-1\">\n<Attribute Name=\"RAIDPDState\">Ready
      </Attribute>\n<Attribute Name=\"RAIDHotSpareStatus\">No</Attribute>\n</Component>\n
      <Component FQDD=\"Disk.Direct.1-1:AHCI.Slot.6-1\">\n<Attribute Name=\"RAIDPDState\">Ready</Attribute>\n
      <Attribute Name=\"RAIDHotSpareStatus\">No</Attribute>\n</Component>\n</SystemConfiguration>\n"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Import template from local XML file
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "import"
    attributes:
      Name: "Imported Template Name"
      Type: 2
      Content: "{{ lookup('ansible.builtin.file', '/path/to/xmlfile') }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Deploy template and Operating System (OS) on multiple devices."
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "deploy"
    template_id: 12
    device_id:
      - 12765
    device_service_tag:
      - 'SVTG123'
    attributes:
      # Include this to install OS on the devices.
      # This section is optional
      NetworkBootIsoModel:
        BootToNetwork: true
        ShareType: "CIFS"
        IsoTimeout: 1 # allowable values(1,2,4,8,16) in hours
        IsoPath: "/home/iso_path/filename.iso"
        ShareDetail:
          IpAddress: "192.168.0.2"
          ShareName: "sharename"
          User: "share_user"
          Password: "share_password"
      Options:
        EndHostPowerState: 1
        ShutdownType: 0
        TimeToWaitBeforeShutdown: 300
      Schedule:
        RunLater: true
        RunNow: false
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a compliance template from reference device
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "create"
    device_service_tag:
      - "SVTG123"
    template_view_type: "Compliance"
    attributes:
      Name: "Configuration Compliance"
      Description: "Configuration Compliance Template"
      Fqdds: "BIOS"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Import a compliance template from XML file
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "import"
    template_view_type: "Compliance"
    attributes:
      Name: "Configuration Compliance"
      Content: "{{ lookup('ansible.builtin.file', './test.xml') }}"
      Type: 2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a template from a reference device with Job wait as false
  dellemc.openmanage.ome_template:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    device_id: 25123
    attributes:
      Name: "New Template"
      Description: "New Template description"
      Fqdds: iDRAC,BIOS,
    job_wait: false

Inputs

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

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

command:
    aliases:
    - state
    choices:
    - create
    - modify
    - deploy
    - delete
    - export
    - import
    - clone
    default: create
    description:
    - C(create) creates a new template.
    - C(modify) modifies an existing template.
    - C(deploy) creates a template-deployment job.
    - C(delete) deletes an existing template.
    - C(export) exports an existing template.
    - C(import) creates a template from a specified configuration text in SCP XML format.
    - C(clone) creates a clone of a existing template.
    type: str

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 or OpenManage Enterprise Modular 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(command) is C(create), or C(deploy).
    type: bool

password:
    description:
    - OpenManage Enterprise or OpenManage Enterprise Modular 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

username:
    description:
    - OpenManage Enterprise or OpenManage Enterprise Modular 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

device_id:
    default: []
    description:
    - Specify the list of targeted device ID(s) when I(command) is C(deploy). When I (command)
      is C(create), specify the ID of a single device.
    - Either I(device_id) or I(device_service_tag) is mandatory or both can be applicable.
    elements: int
    type: list

attributes:
    description:
    - Payload data for the template operations. All the variables in this option are added
      as payload for C(create), C(modify), C(deploy), C(import), and C(clone) operations.
      It takes the following attributes.
    - 'Attributes: List of dictionaries of attributes (if any) to be modified in the deployment
      template. This is applicable when I(command) is C(deploy) and C(modify). Use the
      I(Id) If the attribute Id is available. If not, use the comma separated I (DisplayName).
      For more details about using the I(DisplayName), see the example provided.'
    - 'Name: Name of the template. This is mandatory when I(command) is C(create), C(import),
      C(clone), and optional when I(command) is C(modify).'
    - 'Description: Description for the template. This is applicable when I(command) is
      C(create) or C(modify).'
    - 'Fqdds: This allows to create a template using components from a specified reference
      server. One or more, of the following values must be specified in a comma-separated
      string: iDRAC, System, BIOS, NIC, LifeCycleController, RAID, and EventFilters. If
      none of the values are specified, the default value ''All'' is selected. This is
      applicable when I (command) is C(create).'
    - 'Options: Options to control device shutdown or end power state post template deployment.
      This is applicable for C(deploy) operation.'
    - 'Schedule: Provides options to schedule the deployment task immediately, or at a
      specified time. This is applicable when I(command) is C(deploy).'
    - 'NetworkBootIsoModel: Payload to specify the ISO deployment details. This is applicable
      when I(command) is C(deploy).'
    - 'Content: The XML content of template. This is applicable when I(command) is C(import).'
    - 'Type: Template type ID, indicating the type of device for which configuration is
      supported, such as chassis and servers. This is applicable when I(command) is C(import).'
    - 'TypeId: Template type ID, indicating the type of device for which configuration
      is supported, such as chassis and servers. This is applicable when I(command) is
      C(create).'
    - Refer OpenManage Enterprise API Reference Guide for more details.
    type: dict

template_id:
    description:
    - ID of the existing template.
    - This option is applicable when I(command) is C(modify), C(deploy), C(delete), C(clone)
      and C(export).
    - This option is mutually exclusive with I(template_name).
    type: int

template_name:
    description:
    - Name of the existing template.
    - This option is applicable when I(command) is C(modify), C(deploy), C(delete), C(clone)
      and C(export).
    - This option is mutually exclusive with I(template_id).
    type: str

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

job_wait_timeout:
    default: 1200
    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

device_group_names:
    default: []
    description:
    - Specify the list of groups when I (command) is C(deploy).
    - Provide at least one of the mandatory options I(device_id), I(device_service_tag),
      or I(device_group_names).
    elements: str
    type: list

device_service_tag:
    default: []
    description:
    - Specify the list of targeted device service tags when I (command) is C(deploy).
      When I(command) is C(create), specify the service tag of a single device.
    - Either I(device_id) or I(device_service_tag) is mandatory or both can be applicable.
    elements: str
    type: list

template_view_type:
    choices:
    - Deployment
    - Compliance
    - Inventory
    - Sample
    - None
    default: Deployment
    description:
    - Select the type of view of the OME template.
    - This is applicable when I(command) is C(create),C(clone) and C(import).
    type: str

Outputs

Content:
  description: XML content of the exported template. This content can be written to
    a xml file.
  returned: success, when I(command) is C(export)
  sample: "<SystemConfiguration Model=\"PowerEdge R940\" ServiceTag=\"DEFG123\" TimeStamp=\"\
    Tue Sep 24 09:20:57.872551 2019\">\n<Component FQDD=\"AHCI.Slot.6-1\">\n<Attribute\
    \ Name=\"RAIDresetConfig\">True</Attribute>\n<Attribute Name=\"RAIDforeignConfig\"\
    >Clear</Attribute>\n</Component>\n<Component FQDD=\"Disk.Direct.0-0:AHCI.Slot.6-1\"\
    > \n<Attribute Name=\"RAIDPDState\">Ready</Attribute>\n<Attribute Name=\"RAIDHotSpareStatus\"\
    >No</Attribute> \n</Component>\n<Component FQDD=\"Disk.Direct.1-1:AHCI.Slot.6-1\"\
    >\n<Attribute Name=\"RAIDPDState\">Ready </Attribute>\n<Attribute Name=\"RAIDHotSpareStatus\"\
    >No</Attribute>\n</Component>\n</SystemConfiguration>"
  type: str
TemplateId:
  description: ID of the template for C(export).
  returned: success, when I(command) is C(export)
  sample: 13
  type: int
devices_assigned:
  description: Mapping of devices with the templates already deployed on them.
  returned: I(command) is C(deploy)
  sample:
    '10312': 23
    '10362': 28
  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
msg:
  description: Overall status of the template operation.
  returned: always
  sample: Successfully created a template with ID 23
  type: str
return_id:
  description: ID of the template for C(create), C(modify), C(import) and C(clone)
    or task created in case of C(deploy).
  returned: success, when I(command) is C(create), C(modify), C(import), C(clone)
    and C(deploy)
  sample: 12
  type: int