Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Retrieving a value from Cluster, and assign it to a variable in Playbook
2020-07-21
03:27 PM
1,656 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How can I retrieve the corresponding export policy name based on a known volume name, then assign it to a variable in Playbook. The goal is to use the NA module to create a rule based on the policy name.
I don't know if Playbook can do that. Thank you!
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not sure if this is the best way to do it you can make an API call to the OnTap system to get the export policy name.
---
- hosts: localhost
tasks:
- name: Get NetApp UUID of Volume
uri:
url: https://cluster_name/api/storage/volumes?name=volume_name&fields=nas.export_policy.name&return_records=true&return_timeout=15
url_username: username
url_password: password
method: GET
force_basic_auth: yes
validate_certs: no
register: vol_export_policy
- name: Set export policy fact
set_fact:
export_policy: "{{ vol_export_policy.json.records[0].nas.export_policy.name }}"
