0% found this document useful (0 votes)
221 views

Automating NetApp With Ansible

1. Ansible and NetApp have partnered to develop Ansible modules to automate and manage NetApp storage platforms like ONTAP, Element, and E-Series through provisioning, deployment, and configuration tasks in a simple and idempotent way. 2. Ansible AWX is an open source project that provides a web UI and API to manage Ansible playbooks, inventories, credentials, and vaults. It allows adding NetApp clusters to inventories and creating credentials to authenticate for playbook runs. 3. Playbooks can be created with YAML files to automate NetApp tasks like stopping SVMs using the appropriate modules, inputs, and credentials. Templates can also be added to AWX to
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
221 views

Automating NetApp With Ansible

1. Ansible and NetApp have partnered to develop Ansible modules to automate and manage NetApp storage platforms like ONTAP, Element, and E-Series through provisioning, deployment, and configuration tasks in a simple and idempotent way. 2. Ansible AWX is an open source project that provides a web UI and API to manage Ansible playbooks, inventories, credentials, and vaults. It allows adding NetApp clusters to inventories and creating credentials to authenticate for playbook runs. 3. Playbooks can be created with YAML files to automate NetApp tasks like stopping SVMs using the appropriate modules, inputs, and credentials. Templates can also be added to AWX to
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

1

Automating NetApp with Ansible

Senthilkumar Muthusamy

As enterprises make the move to adopt sophisticated next-generation


data center technologies, time to market through the automation of
IT tasks has become an essential element.
To enable this adoption around storage technologies, Ansible and
NetApp have partnered to develop a collection of automation and
storage configuration management modules to easily provision,
deploy and manage NetApp ONTAP, Element and E-Series storage
platforms.
NetApp is a Red Hat Certified Support Module Vendor.
The Ansible and NetApp modules provide idempotent provisioning
for:

• Aggregates
• Asynchronous Mirroring
• Checking Connections
• Disk Pools
• Hosts and Host Groups (Clusters)
• License Management
• LUN Mapping
• QTrees
• Snapshot Scheduler
• Standard Volumes and Flex Vols
• SVM
• Thin Volumes
• Users, User Roles and Accounts
• Volume Access Groups
• Volume Snapshots
• and much more...

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 1


2

These modules have been qualified by NetApp engineering to ensure


they meet a variety of needs including provisioning, replication and
general management.

Solution Benefits
• With Ansible customers can automate NetApp solutions to
deliver flexible, scalable and highly reliable storage deployment
and management solutions for NetApp ONTAP, Element and E-
Series storage systems
• Roll storage-infrastructure configurations into your CI/CD
processes and application configurations for maximum agility
with over 60 Ansible modules for NetApp.

• Ansible seamlessly unites workflow orchestration with


configuration management, provisioning and application
deployment in one easy-to-use and deploy platform

• Ansible and NetApp enable a lower cost of ownership and ease


of setup by reducing the time to deploy and manage your
storage

• As the only storage vendor to deliver Red Hat Certified Support


Modules, a partnership with NetApp ensures targeted, quality
storage automation modules

• NetApp supported SDKs for ONTAP, Element and E-Series offer


extensibility by making it easier to develop new modules

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 2


3

AWX Project:
The AWX project—AWX for short—is an open source community
project, sponsored by Red Hat, that enables users to better control
their community Ansible project use in IT environments. AWX is the
upstream project from which the automation controller component is
ultimately derived.
Ansible AWX is the upstream project of Ansible Automation Controller
(formerly Ansible Tower), providing a modern web-UI and API
interface to manage Ansible Playbooks, inventories, Credentials, and
Vaults between your team in your organization. The AWX source code
is available under Apache License 2.0.
1. Login to Ansible AWX.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 3


4

2. Once authenticated, it will launch the dashboard.

Add a managed nodes and hosts and


creates an Inventory.

3. Add a NetApp ONTAP cluster in an Inventory.


An inventory is a list of managed nodes, or hosts, that Ansible deploys
and configures.
• Creating inventories to track a list of servers and devices that
you want to automate.
• Using dynamic inventories to track cloud services with servers
and devices that are constantly starting and stopping.
• Using patterns to automate specific sub-sets of an inventory.
• Expanding and refining the connection methods Ansible uses
for your inventory.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 4


5

4. Select the credentials tab, create credential method.

Select and create the


Authentication credentials

5. Select your credentials type


a. Active Directory
b. AWS
c. ONTAP
d. Ansible Tower and more…

To create a credential, select the


credential type.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 5


6

6. Select the ONTAP authentication.

You can select the ONTAP


authentication

Credentials added successfully. These credentials are required for


executing the Playbooks.

Credentials added successfully.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 6


7

You can select the credentials using cloud also.

Example of Credentials YAML file with input configuration.

Example YAML file for ONTAP credentials


authentication input values.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 7


8

Create a new project and add the required NetApp ONTAP ansible
modules and all YML or JSON files in Ansible.
Git is a distributed version control and Source Code Management
(SCM) utility.

Create a new project and specify the

SCM details.

Understanding Playbooks
Now that we have Ansible installed, let’s understand the special file
that makes things happen. This file is called a ‘playbook’. The
playbook is written in yaml, which is itself a simplified version of json.
A playbook is composed of one or more sections, which each can
contain one or more tasks to run.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 8


9

Create and store the YAML play books in ansible project location.

Create a YML or JSON file for


each job to automate.

Sample playbook file for stopping SVM. It will stop the SVM as per the
input details.
For Ex:
1. To run and deploy this needs a credential.
• Cluster Name

• User name

• Password

• SVM Name

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 9


10

Sample YAML file for stopping the


SVM

Add a template to AWX and initiate the templates.


Ex: Create Cluster Peering.
Provide the following inputs to create cluster peer.
b. Source Cluster
c. Destination Cluster

You can select the job template and


run to deploy.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 10


11

Specify the input values to deploy the


playbook job (For Ex: Cluster Peer)

Before initiating the playbook, list the cluster peer details.


Clusters are not peered.

Before initiate the cluster peer playbook,


clusters are not peered.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 11


12

Initiate the cluster peering Job Template YAML.

Run the cluster peering job


template.

Select the Source and Destination NetApp ONTAP cluster to peer.

Specify the Source and Destination cluster to


peer.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 12


13

Click the preview to check playbook run details.


a. Credential details
b. Inventory details

Job type

Credential

Source and destination cluster


details

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 13


14

Create cluster peering playbook is running.


It will be using the input values and creates a cluster peer.

Ex: Task-Getting the clusters


intercluster LIF

Job is running….

Template job (cluster peer) created successfully.

All the tasks completed successfully.

Job completed
successfully.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 14


15

Login to ONTAP cluster and check the cluster peer status.

Check the cluster peer status on both the source and destination
cluster.

Check the cluster peer status on


both the nodes (ex: onPrem and
remote)

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 15


16

Creating Source Data Type SVM using Ansible with Playbook Template.
Specify the following input details to create SVM:
1. SVM name
2. Cluster Name
3. SVM DATA LIF
a. IP address and Netmask
b. Node Port
c. Role
d. Access Protocol
e. Source LIF Home Node
4. Aggregate Name
5. Volume Name
6. Share Name
7. DNS and other details.

Creating Data SVM using playbook job


template.

SVM Name

Select the cluster and LIF Home


port

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 16


17

SVM LIF role, Home Node and


Data Access Protocol

Create volume with input detail.

List the Preview details and run the play book.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 17


18

Play book is running and it will create a SVM with a specified detail.

Playbook creating the SVM


with specified input values.

Play book executed successfully.

Volume create task and CIFS


share create task completed.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 18


19

Login to ONTAP Cluster CLI and check the vserver and SVM data LIF
details.

SVM (ex:prod) created


successfully.

Data LIF also created.

List the volume and CIFS Share details.

Volume (ex:share)
created.

CIFS share also created.

Access the CIFS share folder.


Access the share folder and create
files.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 19


20

Provide the Access credentials to access the CIFS share.

Access the Share folder and create files.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 20


21

Create a file (ex:n1.txt).

Create a SVM on destination cluster for DR purpose. Using DR_SVM


playbook to create an SVM.

Create SVM for DR (SVM-DR) with


Dp_destination subtype.

Create a Destination SVM using the following details:


1. Destination Cluster Name
2. Destination SVM Name
3. Workflow
a. Creating SVM peer (ex:Prod and Prod_dr)
b. Creating SVM level snapmirror
i. Source SVM: prod
ii. Destination SVM: prod_dr

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 21


22

Creating SVM peering and snapmirror


(SVM Level) automatically using playbook
job template.

Login to Destination ONTAP Cluster and check the vserver status.


1. Name: prod-dr
2. Sub-type: dp-destination

SVM created with


dp_destination subtype.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 22


23

5 tasks are completed.

List the SVM peer status.

Check the peer status. (onPerm -prod SVM


→ remote-prod_dr SVM)

List the SVM level snapmirror details.

List the snapmirror status.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 23


24

Creating Workflow Template:


A workflow job template links together a sequence of disparate
resources that accomplishes the task of tracking the full set of jobs
that were part of the release process as a single unit. These resources
may include:

• job templates

• workflow templates

• project syncs

• inventory source syncs

• Workflows allow you to configure a sequence of disparate job


templates (or workflow templates) that may or may not share
inventory, playbooks, or permissions. However, workflows have
‘admin’ and ‘execute’ permissions, similar to job templates. A
workflow accomplishes the task of tracking the full set of jobs
that were part of the release process as a single unit.

• Job or workflow templates are linked together using a graph-like


structure called nodes. These nodes can be jobs, project syncs,
or inventory syncs. A template can be part of different workflows
or used multiple times in the same workflow. A copy of the graph
structure is saved to a workflow job when you launch the
workflow.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 24


25

• It is possible to launch several workflows simultaneously, and set


a schedule for when to launch them. You can set notifications on
workflows, such as when a job completes, similar to that of job
templates.

• You can build a recursive workflow, but if Tower detects an


error, it will stop at the time the nested workflow attempts to
run.

• Artifacts gathered in jobs in the sub-workflow will not be passed


to downstream nodes.

• An inventory can be set at the workflow level, or prompt for


inventory on launch.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 25


26

Workflow Visualizer
Ansible Tower 3.1 introduced the Workflow Visualizer
(formerly Workflow Editor), which provides a graphical way of linking
together job templates, workflow templates, project syncs, and
inventory syncs to build a workflow template.

Create a new workflow template. (Use Template tab and add workflow
template)

Create a new workflow template

Workflow name and Inventory


details

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 26


27

Using Workflow Visualizer, you can define the complete workflow


using the playbook YAML.
For example, In this document I have created DR test (SVM Level DR)
using workflow job.
Following Tasks will perform automatically:
Architecture:
1. Source Cluster: onPerm
2. Source SVM: prod
3. Destination Cluster: remote
4. Destination SVM: prod_dr (dp_destination)
5. Snapmirrored state.

Automated Workflow Tasks:


1. Quiesce the Mirror relationship
2. Stop the source SVM (prod)
3. Break the snapmirror relationship
4. Start the Destination SVM (prod_dr)
5. Configure the DR SVM (prod_dr)

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 27


28

Configure the DR_test workflow.

Start – Initial Step

Add the workflow task (quiesce mirror) – select the play book job
template.

Add a task quiesce mirror.

Specify the Destination SVM to quiesce it.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 28


29

Workflow task added.

Same as add the next workflow task (stop the source SVM(prod) for
test.

Add stop source SVM playbook


to run next automatically.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 29


30

You can set the rule for next task to run.


For example, last task completed successfully then it will run the next
task automatically.
Example:
Task1 – Quiesce the mirror
Task2 – Stop the Source SVM(prod) – On – Success then it will
start the task3 (break the snapmirror)

Next run only On Success of last


workflow task.

As per our workflow process, if the


prod SVM was stopped then it will
run the next task(break mirror)

Then it breaks the snapmirror relationship.

Add a break mirror playbook yaml.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 30


31

Next to start the destination SVM (prod_dr).

Add the start dr svm job


template playbook to start the
prod-dr SVM automatically after
break the mirror.

Add the configure dr_svm job template play book to configure the
prod_dr SVM automatically.
Workflow template defined by the tasks (job templates)
1. Quiesce Mirror
2. Stop the Source SVM
3. Break the snapmirror
4. Start the Destination SVM
5. Configure the Destination SVM

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 31


32

DR_Test workflow template created


successfully with the tasks template.

Initiate the workflow template to test DR SVM Level. As defined in


Workflow it will initiate job template. On Success of stopping the
Source SVM then it will break the mirror relationship.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 32


33

Workflow template is running and


initiating the tasks as defined.

On Success of the
previous task, it
Quiesce the Stop the source break the snapmirror.
mirror task SVM task

As per the workflow definition all the tasks completed successfully.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 33


34

Now you can login to NetApp ONTAP CLI or System Manager and check
the status.

Snapmirror is in Broken-off state.

Destination SVM is Running.

Source SVM is Stopped and LIF


also down state.

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 34


35

Now access the CIFS share folder using Destination SVM LIF IP address.

Now you begin to see the power that Ansible gives you, and it’s not
limited to just what ONTAP or Element can do. You can use Ansible to
provision storage, and then present that share to a host all in one
playbook.

Example NetApp Ansible LUN Module:


- name: Create LUN
netapp.ontap.na_ontap_lun:
state: present
name: prod01_lun
flexvol_name: Prod_Volume
vserver: svm_senthil
size: 500
size_unit: mb
os_type: linux
space_reserve: true
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"

- name: Resize LUN


netapp.ontap.na_ontap_lun:
state: present
name: prod01_lun
force_resize: true
flexvol_name: Prod_Volume
vserver: svm_senthil
size: 750
size_unit: mb
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 35


36

- name: Create LUNs using SAN application


tags: create
netapp.ontap.na_ontap_lun:
state: present
name: esx_ds_001
size: 15
size_unit: gb
os_type: vmware
space_reserve: false
san_application_template:
name: san-esxi_LUN
igroup_name: Prod_esxi_igroup
lun_count: 3
protection_type:
local_policy: default
exclude_aggregates: aggr0
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"

SENTHILKUMAR MUTHUSAMY | SAN MASTERS 36

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy