#Ansible automation with netapp remove-clientmatches

1 messages · Page 1 of 1 (latest)

coarse scarab
#

I am trying to create a code where user provides a client match and we have to find the export-policy of volume and qtree and then find the rule index where client present. When find, that particular client match will be deleted from rule index.
Please note that in this environment, rule indexes have multiple clients added and multiple rule indexes added in export-policy.

I am able to find export-policies for requested volume and qtree, but not able to check how to fetch rule index in netapp.ontap.na_ontap_rest_info
I used below code to gather qtree information like this below:
netapp.ontap.na_ontap_rest_info:
hostname: "{{ host_name }}"
username: "{{ username }}"
password: "{{ password }}"
use_rest: always
https: true
validate_certs: "{{ validate_certs | default ('false') }}"
gather_subset:
- storage_qtrees_config
fields:
- '*'
parameters:
volume.name: "{{ volume_name }}"
register: qtree_info

  • debug: var=qtree_info

This is what I am using to remove client from export-policy:

  • name: Remove requested clients in Export-policy of volume
    netapp.ontap.na_ontap_export_policy_rule:
    hostname: "{{ host_name }}"
    vserver: "{{ vserver_name }}"
    https: true
    validate_certs: false
    username: "{{ username }}"
    password: "{{ password }}"
    state: absent
    ro_rule: any
    rw_rule: never
    protocol: nfs
    super_user_security: sys
    client_match: "{{ stop_sharing }}"
    name: "{{ volume_export_policy }}"

Here the concern is if the rule index has exact match what I am passing in above module, that rule index is getting deleted but if that rule index has multiple clients then its skipping and not doing anything.
This module working like deleting export-policy rule when condition matches and not like export-policy remove-clientmatches.

limber hedge
#

Sorry not 100% what your asking
Could you run the ansible playbook with -vvv and send the log to ng-ansibleteam

coarse scarab
#

What I want to ask is, is it possible to remove client-match from export-policy rules where multiple clients present in export-policy rule indexes.

limber hedge
#

have you had a change to send over the output of the playbook?

coarse scarab
#

This is the module I am using, - name: Remove requested clients in Export-policy of volume
netapp.ontap.na_ontap_export_policy_rule:
hostname: "{{ host_name }}"
vserver: "{{ vserver_name }}"
https: true
validate_certs: false
username: "{{ username }}"
password: "{{ password }}"
state: absent
ro_rule: any
rw_rule: never
protocol: nfs
super_user_security: sys
client_match: "{{ stop_sharing }}"
name: "{{ volume_export_policy }}"

#

Here I am passing for example client_match aaa to remove from export-policy and that export-policy rule has more than one client_match then it deletes whole rule index in export-policy

#

This is my export-policy rules, I want to remove only ghi in this rule index. This we usually do using below command but not able to find this functionality in ansible modules, when I try running this module above, whole rule index gets deleted (very dangerous as other clients matches in same rule indexes will also gets deleted):

#

Vserver: ansible-svm01
Policy Name: 280-01
Rule Index: 1
Access Protocol: nfs
List of Client Match Hostnames, IP Addresses, Netgroups, or Domains: ghi,ijk
RO Access Rule: sys
RW Access Rule: sys
User ID To Which Anonymous Users Are Mapped: 65534
Superuser Security Types: any
Honor SetUID Bits in SETATTR: true
Allow Creation of Devices: true