Introduction
Storage containers in Nutanix define how data is stored, deduplicated, compressed, and tiered. Automating container creation using Ansible enables consistent configurations across clusters and sites. This article walks through creating storage containers with compression enabled using a reusable playbook.
My Personal Repository on GitHub
Diagram: Container Provisioning Workflow

Use Case
- Create storage containers with compression/dedupe
- Apply consistent naming standards and policies
- Integrate into new site builds or disaster recovery workflows
YAML File: container_config.yml
containers:
- name: app-storage
storage_container: "app-container"
storage_pool: "default-storage-pool"
compression_enabled: true
deduplication_enabled: false
- name: db-storage
storage_container: "db-container"
storage_pool: "default-storage-pool"
compression_enabled: false
deduplication_enabled: true
Playbook: create_containers.yml
- name: Create Nutanix storage containers
hosts: localhost
gather_facts: false
collections:
- nutanix.ncp
vars_files:
- nutanix_credentials.yml
- container_config.yml
tasks:
- name: Create container
loop: "{{ containers }}"
loop_control:
loop_var: container
nutanix.ncp.storage_containers:
state: present
name: "{{ container.storage_container }}"
storage_pool_name: "{{ container.storage_pool }}"
compression_enabled: "{{ container.compression_enabled }}"
deduplication_enabled: "{{ container.deduplication_enabled }}"
cluster_name: "prod-cluster"
Run It
ansible-playbook create_containers.yml --ask-vault-pass -i inventory.yml
Optional Enhancements
- Add
advertised_capacity - Attach a replication policy or protection domain
- Use
tagsfor search and metadata
Summary
This playbook makes Nutanix storage provisioning fast, consistent, and scalable. Whether for onboarding new clusters or configuring containers per business unit, Ansible provides a reliable framework for infrastructure-as-code.
External Documentation:
Table of Contents 1. Introduction: Why Air-Gapped DR for Nutanix? Modern cyber threats—including ransomware and nation-state actors—have exposed the vulnerability of traditional...