chrifey.ontap_volume_nfs_share

NFS Share Management

This guide is for managing an NFS export, which includes:

  • A flexvol with a specific path
  • A qtree
  • An export policy for the qtree

It also shows how to manage different volumes or systems using group variables.

Safe Mode

We want to add a "safe mode" to stop accidental deletions of volumes or qtrees.

We created two task files (no_safemode.yml and safemode.yml) and you can choose which one to use based on an environment variable in the ansible-playbook command.

Example:

ansible-playbook -i inventory site.yml -e safemode=true

If you set a volume or qtree to absent, safe mode will ask for confirmation before deleting each one. Without safe mode, it will delete without asking for confirmation.

Requirements

Getting Started:

Install Ansible using yum on RHEL or CentOS:

yum install ansible python-pip
pip install netapp-lib

Alternatively, you can use Python virtual environments:

yum install python-virtualenv
virtualenv ansible
source ansible/bin/activate
pip install ansible
pip install netapp-lib

Role Variables

We recommend setting up group variables for different environment parameters like credentials.

First, create an inventory file inventory/site/hosts:

[netapp]
localhost netapp_user=USERNAME netapp_password=SECRET

Since this file contains sensitive information, it's strongly advised to encrypt it using ansible-vault:

ansible-vault encrypt --ask-vault-pass inventory/site/hosts
ansible-vault view --ask-vault-pass inventory/site/hosts
ansible-vault edit --ask-vault-pass inventory/site/hosts

Next, create a vars file for your environment settings:

The example below demonstrates inventory/site/group_vars/all.yml for the ontap-volume-nfs-share role:

# Environment specific variables
netapp_volumes:
  - { state: 'present', nacluster: 'cluster1.localdomain', vserver: 'vserver1', flexvol: 'flexvol1', space_guarantee: 'none', percent_snapshot_space: '5', aggregate: 'aggr1', size: '10', unit: 'gb', exportpolicy: 'default'  }

netapp_qtrees:
  - { state: 'present', nacluster: 'cluster1.localdomain', vserver: 'vserver1', qtree: 'qtree1', flexvol: 'flexvol1',
      exportpolicy: 'db-nodes', ro_rule: 'sys', rw_rule: 'sys', super_user_security: 'sys', client_match: '0.0.0.0/0' }

You can manage multiple volumes with one groupvars file by adding more entries in the netapp_volumes or netapp_qtrees lists. You may also create different "sites" for different applications that require specific volumes.

Dependencies

No other roles are required.

Example Playbook

Here’s a simple playbook using the ontap-volume-nfs-share role:

---
- hosts: localhost
  connection: local
  gather_facts: no
  roles:
   - ontap-volume-nfs-share

You can run the playbook like this (using --ask-vault-pass to enter the password for the encrypted file):

ansible-playbook --ask-vault-pass -i inventory/site/hosts playbooks/site.yml

License

BSD

Author Information

This was developed during a hackathon with:

  • Sven Mundschenk
  • Stefan Gaertner
  • Steffen Knoth
  • Christian Fey
Informazioni sul progetto

Role to configure nfs exports (volume, qtree, policy)

Installa
ansible-galaxy install chrifey.ontap_volume_nfs_share
Licenza
Unknown
Download
80
Proprietario