I am working on a playbook to create export policy rules based on the entered volumes and clients for Linux admin who doesn't have the access to the cluster. It works but there are still a lot of things to work out. Before I continue on those things, I would like to convert it to REST based first.
`---
- hosts: localhost
collections:- netapp.ontap
name: create export-policy-rule task
gather_facts: no
vars_files: - variables.yml
vars:
vol_name: volume123
vserver: initialization
export_policy: initialization
tasks: - name: Info
na_ontap_info:
state: info
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
https: true
validate_certs: false
gather_subset:
- volume_info
register: my_ontap - set_fact:
vserver: "{{ my_ontap.ontap_info.volume_info[item].volume_id_attributes.owning_vserver_name }}"
export_policy: "{{ my_ontap.ontap_info.volume_info[item].volume_export_attributes.policy }}"
with_items: "{{ my_ontap.ontap_info.volume_info }}"
when: my_ontap.ontap_info.volume_info[item] is search ("{{ vol_name }}") - name: create the rule
na_ontap_export_policy_rule:
state: present
policy_name: "{{ export_policy }}"
vserver: "{{ vserver }}"
client_match: 1.1.1.0/24
ro_rule: sys
rw_rule: sys
protocol: nfs
super_user_security: sys
allow_suid: true
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
https: true
validate_certs: false - debug:
msg:- "{{ vserver }}"
- "{{ export_policy }}"
`
- netapp.ontap