summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/intersight/playbooks/claim_device.yml
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/cisco/intersight/playbooks/claim_device.yml')
-rw-r--r--ansible_collections/cisco/intersight/playbooks/claim_device.yml31
1 files changed, 31 insertions, 0 deletions
diff --git a/ansible_collections/cisco/intersight/playbooks/claim_device.yml b/ansible_collections/cisco/intersight/playbooks/claim_device.yml
new file mode 100644
index 000000000..06d397c6c
--- /dev/null
+++ b/ansible_collections/cisco/intersight/playbooks/claim_device.yml
@@ -0,0 +1,31 @@
+---
+#
+# The hosts group used is provided by the group variable or defaulted to 'Intersight_Servers'.
+# You can specify a specific host (or host group) on the command line:
+# ansible-playbook ... -e group=<your host group>
+# e.g., ansible-playbook server_profiles.yml -e group=TME_Demo
+#
+- hosts: "{{ group | default('Intersight_Servers') }}"
+ connection: local
+ gather_facts: false
+ vars:
+ # Create an anchor for api_info that can be used throughout the file
+ api_info: &api_info
+ api_private_key: "{{ api_private_key }}"
+ api_key_id: "{{ api_key_id }}"
+ api_uri: "{{ api_uri | default(omit) }}"
+ validate_certs: "{{ validate_certs | default(omit) }}"
+ state: "{{ state | default(omit) }}"
+ tasks:
+ # Claim device
+ - name: Claim device
+ cisco.intersight.intersight_rest_api:
+ <<: *api_info
+ resource_path: /asset/DeviceClaims
+ api_body: {
+ "SecurityToken": "{{ SecurityToken }}",
+ "SerialNumber": "{{ SerialNumber }}"
+ }
+ update_method: post
+ delegate_to: localhost
+ run_once: true