---
title: OpenShift Deployment with Cloud Volumes ONTAP Using Ansible
description: Openshift deployment and Ansible are helping engineers deploy faster than ever. Using Ansible, Cloud Volumes ONTAP automation can simplify OpenShift deployment.
image: https://cloud.netapp.com/hubfs/Deploying%20Cloud%20Volumes%20ONTAP%20and%20OpenShift%20Using%20Ansible-Blog-1.png
---

![NetApp-Blue-logo-sm1](https://bluexp.netapp.com/hubfs/NetApp-Blue-logo-sm1.svg "NetApp-Blue-logo-sm1")

![hamburger icon](https://bluexp.netapp.com/hubfs/NetApp-Blue/hamburger-icon.svg) ![close icon](https://bluexp.netapp.com/hubfs/NetApp-Blue/close-icon.svg)

- Product
  
  ![left nav icons-1](https://bluexp.netapp.com/hubfs/left%20nav%20icons-1.svg)Storage 
    - [NetApp On-premises](https://bluexp.netapp.com/netapp-on-premises)
    - [Cloud Volumes ONTAP](https://bluexp.netapp.com/ontap-cloud)
    - [Amazon FSx for NetApp ONTAP](https://bluexp.netapp.com/fsx-for-ontap)
    - [Azure NetApp Files](https://bluexp.netapp.com/azure-netapp-files)
    - [Google Cloud NetApp Volumes](https://bluexp.netapp.com/google-cloud-netapp-volumes)
  
  
  ![data mobility](https://bluexp.netapp.com/hubfs/NetApp-Blue/data-mobility.svg)Mobility 
    - [Copy and Sync](https://bluexp.netapp.com/cloud-sync-service)
    - [Tiering](https://bluexp.netapp.com/cloud-tiering)
  
  
  ![left nav icons-2](https://bluexp.netapp.com/hubfs/left%20nav%20icons-2.svg)Protection 
    - [Backup and recovery](https://bluexp.netapp.com/cloud-backup)
    - [Disaster recovery](https://bluexp.netapp.com/disaster-recovery)
    - [Replication](https://bluexp.netapp.com/replication)
    - [Ransomware protection](https://bluexp.netapp.com/ransomware-protection)
  
  
  ![left nav icons](https://bluexp.netapp.com/hubfs/left%20nav%20icons.svg)Analysis and control 
    - [Observability](https://bluexp.netapp.com/cloud-insights)
    - [Classification](https://bluexp.netapp.com/netapp-cloud-data-sense)
    - [AIOps & storage health ](https://bluexp.netapp.com/digital-advisor)
    - [Digital wallet](https://bluexp.netapp.com/digital-wallet)
- Resources
  
    - ![solutions database](https://bluexp.netapp.com/hubfs/NetApp-Blue/solutions-protection.svg)CALCULATORS
    - [TCO Azure](https://bluexp.netapp.com/azure-calculator)
    - [TCO AWS](https://bluexp.netapp.com/aws-calculator)
    - [TCO Google Cloud](https://bluexp.netapp.com/google-cloud-calculator)
    - [Cloud Volumes ONTAP Sizer](https://bluexp.netapp.com/cvo-sizer)
    - ![resources explore](https://bluexp.netapp.com/hubfs/NetApp-Blue/resources-explore.svg)EXPLORE
    - [Global Availability Map](https://bluexp.netapp.com/cloud-volumes-global-regions)
- [Help Center](https://bluexp.netapp.com/help-center)

[Get Started](https://cloudmanager.netapp.com/)

 OpenShift Container Platform

# OpenShift Deployment with Cloud Volumes ONTAP Using Ansible

### Share

[![Facebook](https://bluexp.netapp.com/hubfs/Facebook.svg)](https://www.facebook.com/sharer.php?u=https://bluexp.netapp.com/blog/openshift-ansible-and-cloud-volumes-ontap) [![Twitter](https://bluexp.netapp.com/hubfs/Twitter.svg)](https://twitter.com/share?url=https://bluexp.netapp.com/blog/openshift-ansible-and-cloud-volumes-ontap) [![LinkedIn](https://bluexp.netapp.com/hubfs/linkedin-1.svg)](https://www.linkedin.com/shareArticle?mini=true&url=https://bluexp.netapp.com/blog/openshift-ansible-and-cloud-volumes-ontap)

### More about OpenShift Container Platform

- [ How to Solve DevOps and Kubernetes Storage Challenges Using Cloud Volumes ONTAP: A Case Study ](https://bluexp.netapp.com/blog/cvo-blg-how-to-solve-devops-k8s-storage-challenges-using-cvo-a-case-study)
- [ OpenShift Deployment with Cloud Volumes ONTAP Using Ansible ](https://bluexp.netapp.com/blog/openshift-ansible-and-cloud-volumes-ontap)
- [ OpenShift Persistent Storage with Cloud Volumes ONTAP ](https://bluexp.netapp.com/blog/openshift-storage-cloud-volumes-ontap)

### Subscribe to our blog

Thanks for subscribing to the blog.

### October 3, 2019

### Topics: [Cloud Volumes ONTAP](https://bluexp.netapp.com/blog/topic/cloud-volumes-ontap) [DevOps](https://bluexp.netapp.com/blog/topic/devops)[Master](https://bluexp.netapp.com/blog/topic/master)[9 minute read](https://bluexp.netapp.com/blog/topic/9-minute-read)[Kubernetes](https://bluexp.netapp.com/blog/topic/kubernetes)

OpenShift Container Platform and Ansible go hand-in-hand, playing an important role in cloud automation. They both empower DevOps engineers not only to automate the deployment of Kubernetes clusters in on-premises, hybrid, and multicloud environments, but also all the other services in their end-to-end environments.

For example,[OpenShift Container Platform](https://bluexp.netapp.com/blog/cvo-blg-understanding-red-hat-openshift-container-platform) typically requires access to persistent storage for stateful applications, such as database services and message queues. Using Ansible, [the NetApp® Cloud Volumes ONTAP enterprise data platform](https://bluexp.netapp.com/ontap-cloud) can be deployed alongside OpenShift, and the integration performed to enable them to work together using the NetApp Trident storage provisioner for Kubernetes. This gives OpenShift users a reliable and scalable platform to deploy new containerized applications and services.

In this article, we will look at how an OpenShift deployment with Cloud Volumes ONTAP can be used to dynamically provision persistent storage, and how Ansible can be used to automate the deployment and configuration of Cloud Volumes ONTAP.

## **Using OpenShift with Cloud Volumes ONTAP**

Cloud Volumes ONTAP allows you to manage your data uniformly across the major hyperscaler environments, namely AWS, Azure, and [Google Cloud Platform](https://bluexp.netapp.com/blog/object-storage-block-and-shared-file-storage-in-google-cloud). Cloud Volumes ONTAP brings NetApp’s extensive background in enterprise data management to the cloud, providing high availability across Availability Zones, [DR capability across regions](https://bluexp.netapp.com/blog/automated-disaster-recovery-failover-in-the-cloud), storage efficiencies that can dramatically reduce your cloud storage footprint, and much more.

Cloud Volumes ONTAP builds on the compute and storage infrastructure of the cloud to deliver reliable, scalable, and high-performance storage services for cloud-native applications. You can build disk aggregates and volumes using any of the available block-level and object storage services available in your cloud environment. For example, in AWS, all of the [Amazon EBS](https://bluexp.netapp.com/blog/ebs-volumes-5-lesser-known-functions) disk types are supported, as well as the use of Amazon S3 for less frequently accessed data. Cloud Volumes ONTAP uses built-in storage efficiency technologies, such as thin provisioning, data deduplication, and data compression, to [reduce your operational expenditure on cloud storage](https://bluexp.netapp.com/blog/lowering-cloud-data-storage-costs-with-ontap-cloud) in comparison to allocating the storage directly, which can be by as much as 70%.

Block-level cloud storage, such as Amazon EBS and Azure Managed Disks, usually provide redundancy at the Availability Zone level, with snapshot backups providing a greater level of data protection. With Cloud Volumes ONTAP HA, all of your data is protected across Availability Zones, which ensures that you can continue normal operations even in the face of a site-wide failure. Using NetApp SnapMirror replication, you can create DR failover capability that spans cloud regions. This level of data protection is a prerequisite for large, enterprise organizations.

Cloud Volumes ONTAP also provides sophisticated data management features that make it easier to work with and manage your data. For example, [NetApp FlexClone data cloning](https://bluexp.netapp.com/blog/cloning-storage-volumes-with-cloud-volumes-ontap) allows you to create multiple, writable copies of a source volume instantly and without needing to copy any of the source data. In fact, storage is only required for the changes that you make to the clone, which makes these clones ideal for running integration test suites against real data.

NetApp Trident is the open-source and fully supported storage provisioner for Kubernetes that allows for easy and direct integration with Cloud Volumes ONTAP from any Kubernetes cluster. [Using NetApp Trident, you can dynamically provision](https://bluexp.netapp.com/blog/dynamic-kubernetes-persistent-volume-provisioning) OpenShift persistent storage using native Kubernetes constructs and yaml files. This is achieved by setting up the storage classes to be used and then simply issuing persistent volumes claims, just as you would for another backend storage provider.

### **DevOps Automation using Ansible Playbooks**

OpenShift uses Ansible for cluster installation and configuration management. This allows for cluster deployments to be automated and repeatable, which makes rollouts significantly faster and less error prone. Ansible playbooks are also used to scale up clusters by adding more worker nodes, or to perform an upgrade to the latest version of OpenShift.

Ansible, however, has a wider scope that just OpenShift, and herein lies its power. With hundreds of open-source modules available that cover everything from mounting storage onto a server to the configuring of database services and DNS, you can setup your entire end-to-end environment using the same, familiar automation platform. This also includes the installation and configuration of NetApp Cloud Manager, Cloud Volumes ONTAP, and NetApp Trident.

Cloud Manager is Cloud Volumes ONTAP’s graphical centralized management platform. It’s easy to get started with Cloud Manager and Cloud Volumes ONTAP using the modern, web-based UI; however, to support automation, [Cloud Manager also provides a RESTful API interface](https://bluexp.netapp.com/blog/cloud-automation-with-cloud-volumes-ontap-rest) that enables integration with tools such as Ansible. This allows you to automate the deployment of Cloud Manager itself, new Cloud Volumes ONTAP storage environments, disk aggregates and storage volumes, all through Ansible tasks and playbooks.

Using Ansible, you can go further than just the initial setup of Cloud Volumes ONTAP. NetApp is one of only six Red Hat Ansible Certified Module Vendors, and the only data management company with this certification. There are a vast number of NetApp ONTAP modules available that can be used to perform the large bulk of initial Cloud Volumes ONTAP configuration tasks, and nearly all commonly performed day-to-day operations. As a certified vendor, NetApp’s modules are first tested internally, then by the open-source Ansible community, and finally by the engineers at Red Hat to ensure correct operation and verified performance.

The procedural task automation provided by Ansible and the idempotency, i.e. the ability for tasks to be safely re-executed without causing duplication or configuration problems, helps to massively reduce the time taken for complicated rollouts from weeks to minutes. When NetApp themselves moved to Ansible internally for setting up new ONTAP clusters, they were able to make the setup process 96 times faster than it was previously.

## Ansible How-To Guides for Cloud Volumes ONTAP

In this section, we’ll cover some of the Ansible use cases typical to the deployment and setup of Cloud Volumes ONTAP. In order to authenticate yourself when performing Cloud Manager operations, you will first need to acquire a refresh token from [https://services.cloud.netapp.com/refresh-token](https://services.cloud.netapp.com/refresh-token) using your NetApp Cloud Central account.

![Acquire a refresh token by using your NetApp Cloud Central account.](https://cloud.netapp.com/hubfs/qqqq.png)

The refresh token is then used together with your client ID in order to create an access token that can be used in HTTP requests. An example of how this is achieved using Ansible is shown below:

`vars:   auth0_domain: netapp-cloud-account.auth0.com   tasks: - name: Get Token    uri:     url: https:///oauth/token     method: POST     body_format: json     return_content: yes     body: {"grant_type":"refresh_token", "refresh_token": "", "client_id": ""}     status_code: 200,204,202    register: token_response    ignore_errors: no    - name: set token & token_type     set_fact: token=""    - set_fact: token_type=""    - name: set OCCM IP     set_fact: occm_ip="{{item.public_ip}}"`

Here we can make use of Ansible playbook variables to store information that will be passed into Ansible from the command line, such as refToken and client_id, as well as variables to store information from the HTTP response received from the token request. Use of Ansible variables make playbooks more generic and applicable in different environments, such as Staging and Production. 

The reference API documentation that details the available endpoints, the payload expected, and the responses returned is available from within the Cloud Manager UI by clicking the API documentation link:

![API Documentation](https://cloud.netapp.com/hubfs/wwww.png)

### **Deploying Cloud Manager**

The following example Ansible task shows the main steps required to deploy Cloud Manager. The full yaml file [can be found here](https://github.com/edarzi/cloud-manager-automation-samples/blob/master/ansible/OCCM/createOCCM.yml).

`# Deploy OCCM Instance from AMI   - name: Launch OCCM instance   local_action:    module: ec2    aws_access_key: ""    aws_secret_key: ""    instance_tags:      Name: ""    region: ""    keypair: ""    group_id: ""    instance_type: ""    image: ""    vpc_subnet_id: ""    assign_public_ip: yes    instance_profile_name: ""    count: ""    wait: yes   register: ec2   - name: Wait for SSH to come up   wait_for: host={{item.public_dns_name}} port=22 delay=60 timeout=320 state=started   with_items: ""   - name: Wait for OCCM to come up   wait_for: host={{item.public_dns_name}} port=80 delay=60 timeout=600 state=started   with_items: ""`

### **Deploying Cloud Volumes ONTAP**

Ansible can be used to deploy Cloud Volumes ONTAP as a single node or as an HA pair. This can be achieved by separating out the configuration information for the new instance into a separate JSON template file, which is then referenced by the Ansible playbook. As the template file will be read and processed by Ansible, it too can make use of Ansible playbook variables. A template file could look like the following:

`{ "name": "", "tenantId": "", "region": "", "packageName": "aws_standard", "dataEncryptionType": "AWS", "capacityTier": "S3", "subnetId": "", "svmPassword": "", "vpcId": "", "ontapEncryptionParameters": null, "ebsVolumeType": "gp2" }`

The Ansible task to use this template and deploy Cloud Volumes ONTAP would look like the following:

`- name: Create OTC   uri:    url: "http:///occm/api/vsa/working-environments"    method: POST  headers:     Authorization: " "     Referer: "Ansible"    body_format: json    body: ""    status_code: 200,204,202    timeout: 180   register: otc_response`

### **Creating Disk Aggregates and Volumes**

Similar to deploying Cloud Volumes ONTAP, all of the necessary information for creating a disk aggregate or a volume can be stored in a template file and then simply referenced by your Ansible playbook tasks. The following task can be used to create to create a disk aggregate:

`- name: Create Aggregate   uri:    url: "http:///occm/api/vsa/aggregates"    method: POST    headers:     Authorization: " "     Referer: "Ansible"    body_format: json    body: ""    status_code: 200,204,202    timeout: 180   register: aggr_response`

The next example shows an Ansible task to create a new volume:

`- name: Create Volume   uri:    url: "http:///occm/api/vsa/volumes?createAggregateIfNotFound=true"    method: POST    headers:     Authorization: " "     Referer: "Ansible"    body_format: json    body: ""    status_code: 200,204,202    timeout: 180   register: vol_response`

### **Deploying NetApp Trident**

Integrating Cloud Volumes ONTAP with OpenShift is a two-step operation that first requires that NetApp Trident be installed in the destination cluster. This process is started by uploading the Kubernetes configuration yaml file to Cloud Manager. The following shows how this can be achieved with Ansible:

`- name: Install Trident   uri:    url: "http:///occm/api/k8s/load"    method: POST    headers:     Authorization: " "     Referer: "Ansible"    body_format: json    body: ""    status_code: 200,204,202`

The second part of the procedure is to link an existing deployment of Cloud Volumes ONTAP to the OpenShift cluster loaded up in the previous step. Multiple clusters can target the same instance of Cloud Volumes ONTAP. This can be achieved using a task such as this:

`- name: Install Trident uri:    url: "http:///occm/api/k8s/connect//"     method: POST     headers:      Authorization: " "      Referer: "Ansible"     status_code: 200,204,202`

OpenShift and Cloud Volumes ONTAP have now been integrated, and you can start dynamically provisioning OpenShift persistent storage.

## Conclusion

OpenShift, Ansible, and Cloud Volumes ONTAP enable rapid and reliable deployment of end-to-end containerized applications and services. Using Ansible for DevOps allows you to uniformly manage the configuration for a diverse set of cloud infrastructure services. This includes OpenShift deployment, as well as the installation, configuration, and integration of Cloud Volumes ONTAP with your Kubernetes clusters.

[![New call-to-action](https://no-cache.hubspot.com/cta/default/525875/e19edfe1-83be-4cf9-a058-ee0e5ebae0e9.png)](https://cta-redirect.hubspot.com/cta/redirect/525875/e19edfe1-83be-4cf9-a058-ee0e5ebae0e9)

![Robert Bell, Product Evangelist](https://bluexp.netapp.com/hs-fs/hubfs/Robert.jpg?width=75&height=75&name=Robert.jpg)

[Robert Bell](https://bluexp.netapp.com/blog/author/robert-bell-product-marketing-manager)

### Product Evangelist

<https://bluexp.netapp.com/blog/author/robert-bell-product-marketing-manager>

-

```json
{
  "@context" : "https://schema.org",
  "@type" : "TechArticle",
  "author" : {
    "@type" : "Person",
    "name" : "Robert Bell, Product Evangelist"
  },
  "dateModified" : "Oct 3, 2019 10:40:23 AM",
  "datePublished" : "Oct 3, 2019 10:40:23 AM",
  "description" : "Openshift deployment and Ansible are helping engineers deploy faster than ever. Using Ansible, Cloud Volumes ONTAP automation can simplify OpenShift deployment.",
  "headline" : " OpenShift Deployment with Cloud Volumes ONTAP Using Ansible ",
  "image" : [ "https://cloud.netapp.com/hubfs/Deploying%20Cloud%20Volumes%20ONTAP%20and%20OpenShift%20Using%20Ansible-Blog-1.png" ],
  "mainEntityOfPage" : {
    "@id" : "https://bluexp.netapp.com/blog",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://bluexp.netapp.com/hubfs/2016_dev/netapp-logo.png"
    },
    "name" : "Netapp"
  }
}
```