Deploying NSX-T Using Ansible – Part 3: Running The Playbook

Posts in the Series: Deploying NSX-T Using Ansible
  1. Deploying NSX-T Using Ansible – Part 1: Setting Up The Environment
  2. Deploying NSX-T Using Ansible – Part 2: Setting Up The Playbook
  3. Deploying NSX-T Using Ansible – Part 3: Running The Playbook

In this post I am going to cover the running of the Ansible NSX-T playbook, so that you can get NSX-T deployed in your environment(s). In case you missed them, in my previous posts, I detailed how to set up your Ansible environment and configure the playbook in preparation for deploying NSX-T.

If you arrived here and want to figure it out for yourself, you can download my playbooks here:

Playbook Overview

The main playbook that you will need to run is called ‘nsxt_create_environment.yml‘, which is located in the root of the Ansible-NSXT folder.

By default, the playbook is targeting the ‘nsxt_managers_controllers‘ group, that has been defined in the inventory hosts file. You can, of course, change this to another group or even a specific host, but I prefer to limit the target hosts during execution, if required (i’ll detail more on that in the next section).

The first section of the playbook is made up of all the vars that are used by the various roles to deploy NSX-T. You will notice that all the variables that have been defined in the ‘group_vars’ files, are being included here. This approach means that I can re-use this playbook (for the most part), without changing anything. All I need to do is correctly set up the ‘group_vars’ files and they will be included. This will allow the playbook to scale to deployments across any number of required sites.

The last section of the playbook are the roles which are being called/used for the deployment. These roles provide the nuggets of functionality that are stitched together in the playbook to create the full solution.

Running the Playbook

Running the playbook is a simple case of executing the following command:

If you are deploying across multiple sites, then one of the great features of this playbook is that the deployment will occur simultaneously. In my lab, my 2 sites are virtualized and are using the same management vCenter to host the NSX-T appliances. Below you can see the import occurring twice, one for each site.

And here is the output of my playbook execution, which shows the configuration for NSX-T at both sites being applied:

Targeting Specific Hosts or Groups

If you only want to deploy a specific NSX-T environment, you can use the ‘–limit’ flag and specify the NSX-T host that is a member of the ‘nsxt_managers_controllers‘ group:

That completes the deployment of NSX-T using Ansible. I will continue to add additional posts to this series in the near future, to cover adding additional fabric nodes and other functionality. Until then, I hope this has been helpful. If you discover any bugs or require some help, then please drop me a message via the Drift app. Also, please provide some feedback on this series so that I may improve it for future readers.

Please rate this post!

Average rating / 5. Vote count:

Leave a Reply

Notify of