Declarative Networking: Automating NSX-T Fabric with Ansible
Provisioning Tier-0 gateways, Tier-1 routers, and overlay segments using Ansible collections for NSX-T Policy API.
βImperative scripts tell a system how to build something step by step. Declarative playbooks specify what the final state must look like, letting the API handle the rest.β
At NTT Data, we automated complex NSX-T Data Center fabric deployments using Ansible playbooks.
Imperative vs. Declarative Automation
- Imperative (Legacy): Execute API call 1 to create router -> wait -> execute API call 2 to create interface -> wait -> bind interface.
- Declarative (NSX-T Policy API): Post a single unified JSON/YAML payload defining the end-state topology. The controller resolves dependency graphs automatically.
[!NOTE] Using the
vmware.ansible_nsxtcollection allows network teams to manage firewall rules, segments, and gateways using simple, human-readable YAML.
# # Declarative NSX-T Segment Provisioning Playbook
- name: Create Overlay Segment
vmware.ansible_nsxt.nsxt_policy_segment:
hostname: "{{ nsx_manager }}"
username: "{{ nsx_user }}"
password: "{{ nsx_password }}"
display_name: "Seg-App-Production"
tier1_id: "T1-Gateway-01"
subnets:
- gateway_address: "10.200.1.1/24"
state: present
The Verdict
Key Takeaway
Adopt Declarative APIs for Infrastructure Automation.
Declarative playbooks reduce code complexity and eliminate manual state tracking. Use Ansible and the NSX-T Policy API to build scalable, self-healing network fabrics.
Sachin Kumar Sharma
Associate Director (Infrastructure & Cloud Architecture Strategy) | 20+ Yrs Exp
Architecting resilient multi-cloud enterprise landing zones, SDN overlay fabrics, DevSecFinOps automation pipelines, and autonomous Agentic AI platforms.