#Increase quota size using ansible

1 messages · Page 1 of 1 (latest)

worthy ether
#

Hi all,

I've got a question related to quota's. We've got quite a few customers that have quota's in our NetApp for the purpose of their CIFS shares. At the moment whenever a customer runs out of space within their quota we will increase the quota by the amount of GB specified by the customer in 10GB increments.

Now, the problem is that some of our quota's have gone over 1TB and then we always have to use ActiveIQ to create a report to convert the TB to GB to be sure we increase the proper number.

For example, one customer has a quota which is at the moment 5170GB in size, but the NetApp will show this in TB values, which is 5.05TB. Which is somewhat simple, multiply the 5.05 by 1024 and round it down and you'll have the number.

However, i was wondering if there was a way in ansible to automate this process. i've got a default ansible playbook that will create a quota but i was wondering if someone knew how to create a playbook where i simply specify that i want to increase the current quota size by X in GB ? Or if there's a way to run a playbook that will get the current quota size in GB then allow me to increase having the proper number in GB.

Thanks!

Dimitri

lilac schooner
#

So you can use the na_ontap_rest_info module to get info from ontap https://docs.ansible.com/ansible/devel/collections/netapp/ontap/na_ontap_rest_info_module.html#ansible-collections-netapp-ontap-na-ontap-rest-info-module

with the sub set storage/quota/rules i believe the REST API will return the number in bytes (i think not 100% sure). You can registart that variable in a playbook and do some logical around it to see if you need to increase it.

And then use the the Quota modules to modify the existing quota.
https://docs.ansible.com/ansible/devel/collections/netapp/ontap/na_ontap_quotas_module.html#ansible-collections-netapp-ontap-na-ontap-quotas-module

worthy ether
#

@lilac schooner , thank you for your quick reply. So far i've got this, which will get me my output with the hard_limit specified.

is it possible to extract from the output ONLY the hard limits value to use it as a variable for input?


  • hosts: localhost
    name: increase quota on NetApp Systems
    vars_prompt:

    • name: username
      prompt: Please enter your username
      private: false
    • name: password
      prompt: Please enter your password
      unsafe: true
    • name: Source_Host_IP
      prompt: Please enter the source host IP
      private: false

    collections:

    • netapp.ontap
      tasks:

    • name: Get current quota size
      netapp.ontap.na_ontap_rest_info:
      hostname: "{{ Source_Host_IP }}"
      username: "{{ username }}"
      password: "{{ password }}"
      use_rest: Always
      fields:
      - 'space'
      - 'qtree'
      - 'svm.name'
      gather_subset:
      - storage/quota/reports
      validate_certs: false
      max_records: 10000
      parameters:
      volume.name: HM0_STCL01_N01_CAP_EQC1VOL001
      qtree.name: name
      register: netapp

    • name: Print the quota hard limit
      debug: "{{ netapp.ontap_info.hard_limit }}"