W3cubDocs

/Ansible

cisco.ucs.ucs_service_profile_association – Configures Service Profile Association on Cisco UCS Manager

Note

This plugin is part of the cisco.ucs collection (version 1.6.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install cisco.ucs.

To use it in a playbook, specify: cisco.ucs.ucs_service_profile_association.

New in version 2.1: of cisco.ucs

Synopsis

  • Configures Service Profile Association (change association or disassociate) on Cisco UCS Manager.

Requirements

The below requirements are needed on the host that executes this module.

  • ucsmsdk

Parameters

Parameter Choices/Defaults Comments
hostname
string / required
IP address or hostname of Cisco UCS Manager.
Modules can be used with the UCS Platform Emulator https://cs.co/ucspe
org_dn
string
Default:
"org-root"
The distinguished name (dn) of the organization where the resource is assigned.
password
string / required
Password for Cisco UCS Manager authentication.
port
integer
Port number to be used during connection (by default uses 443 for https and 80 for http connection).
proxy
string
If use_proxy is no, specfies proxy to be used for connection. e.g. 'http://proxy.xy.z:8080'
restrict_migration
string
    Choices:
  • yes
  • no
Restricts the migration of the service profile after it has been associated with a server.
If set to no, Cisco UCS Manager does not perform any compatibility checks on the new server before migrating the existing service profile.
If set to no and the hardware of both servers used in migration are not similar, the association might fail.
server_assignment
string / required
    Choices:
  • server
  • pool
Specifies how to associate servers with this service profile using the following choices:
server - Use to pre-provision a slot or select an existing server. Slot or server is specified by the server_dn option.
pool - Use to select from a server pool. The server_pool option specifies the name of the server pool to use.
Option is not valid if the service profile is bound to a template.
Optional if the state is absent.
server_dn
string
The Distinguished Name (dn) of the server object used for pre-provisioning or selecting an existing server.
Required if the server_assignment option is server.
Optional if the state is absent.
server_pool_name
string
Name of the server pool used for server pool based assignment.
Required if the server_assignment option is pool.
Optional if the state is absent.
service_profile_name
string / required
The name of the Service Profile being associated or disassociated.
state
string
    Choices:
  • present
  • absent
If present, will verify service profile association and associate with specified server or server pool if needed.
If absent, will verify service profile is not associated and will disassociate if needed. This is the same as specifying Assign Later in the webUI.
use_proxy
boolean
    Choices:
  • no
  • yes
If no, will not use the proxy as defined by system environment variable.
use_ssl
boolean
    Choices:
  • no
  • yes
If no, an HTTP connection will be used instead of the default HTTPS connection.
username
string
Default:
"admin"
Username for Cisco UCS Manager authentication.

Examples

- name: Change Service Profile Association to server pool Container-Pool and restrict migration
  cisco.ucs.ucs_service_profile_association:
    hostname: 172.16.143.150
    username: admin
    password: password
    service_profile_name: test-sp
    server_assignment: pool
    server_pool_name: Container-Pool
    restrict_migration: 'yes'

- name: Attempt to change association once a minute for up to 10 minutes
  cisco.ucs.ucs_service_profile_association:
    hostname: 172.16.143.150
    username: admin
    password: password
    service_profile_name: test-sp
    server_assignment: server
    server_dn: sys/chassis-2/blade-1
  register: result
  until: result.assign_state == 'assigned' and result.assoc_state == 'associated'
  retries: 10
  delay: 60

- name: Disassociate Service Profile
  cisco.ucs.ucs_service_profile_association:
    hostname: 172.16.143.150
    username: admin
    password: password
    service_profile_name: test-sp
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
assign_state
string
success
The logical server Assigned State (assigned, unassigned, or failed).

Sample:
assigned
assoc_state
string
success
The logical server Association State (associated or unassociated).

Sample:
associated


Authors

  • David Soper (@dsoper2)
  • CiscoUcs (@CiscoUcs)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/cisco/ucs/ucs_service_profile_association_module.html