From a55aad088c6f866bc82c070e760af5f3aefb7790 Mon Sep 17 00:00:00 2001 From: Yang Ding Date: Fri, 1 May 2020 11:25:11 -0700 Subject: [PATCH] Fix a deprecated endpoint and appliance ready wait everywhere Signed-off-by: Yang Ding --- nsxt_yaml/basic_resources.yml | 31 ++++++++++++++++++++++++------- nsxt_yaml/basic_topology.yml | 10 ++++++---- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/nsxt_yaml/basic_resources.yml b/nsxt_yaml/basic_resources.yml index 55322f5..6749a51 100644 --- a/nsxt_yaml/basic_resources.yml +++ b/nsxt_yaml/basic_resources.yml @@ -81,16 +81,13 @@ - hostvars['localhost'].per_cluster_vlans is defined - auto_install_nsx_result.changed == true - - name: Enable auto creation of transport nodes for specified clusters - nsxt_compute_collection_transport_templates: + - name: Create transport node profile for cluster + nsxt_transport_node_profile: hostname: "{{hostvars['localhost'].nsx_manager_ip}}" username: "{{hostvars['localhost'].nsx_manager_username}}" password: "{{hostvars['localhost'].nsx_manager_password}}" validate_certs: False - display_name: "{{item}}-transport_template" - compute_collections: - - compute_manager_name: "{{compute_manager_name}}" - cluster_name: "{{item}}" + display_name: "{{item}}-transport_node_profile" host_switch_spec: resource_type: StandardHostSwitchSpec host_switches: @@ -98,6 +95,7 @@ - name: "{{item}}-profile" type: UplinkHostSwitchProfile host_switch_name: "{{overlay_host_switch}}" + host_switch_mode: "STANDARD" pnics: "{{pnic_list}}" ip_assignment_spec: resource_type: StaticIpPoolSpec @@ -110,7 +108,26 @@ when: - hostvars['localhost'].clusters_to_install_nsx is defined - hostvars['localhost'].per_cluster_vlans is defined - - auto_install_nsx_result.changed == true + register: transport_node_profile_result + + - name: Create transport node collection for the cluster to enable auto creation of TNs + nsxt_transport_node_collections: + hostname: "{{hostvars['localhost'].nsx_manager_ip}}" + username: "{{hostvars['localhost'].nsx_manager_username}}" + password: "{{hostvars['localhost'].nsx_manager_password}}" + validate_certs: False + display_name: "{{item}}-transport_node_collection" + resource_type: "TransportNodeCollection" + compute_manager_name: "{{compute_manager_name}}" + cluster_name: "{{item}}" + transport_node_profile_name: "{{item}}-transport_node_profile" + state: present + with_items: + - "{{hostvars['localhost'].clusters_to_install_nsx}}" + when: + - hostvars['localhost'].clusters_to_install_nsx is defined + - hostvars['localhost'].per_cluster_vlans is defined + - transport_node_profile_result.changed == true ############################################################################### # Install NSX on individual ESX hosts, if any diff --git a/nsxt_yaml/basic_topology.yml b/nsxt_yaml/basic_topology.yml index e8d47e3..4763a5a 100644 --- a/nsxt_yaml/basic_topology.yml +++ b/nsxt_yaml/basic_topology.yml @@ -41,16 +41,18 @@ validate_certs: False wait_time: 60 - - name: Wait 2 minutes before accessing NSX Manager API - pause: minutes=2 + - name: Wait for NSX appliances to be status up + pause: + minutes: "{{hostvars['localhost'].appliance_ready_wait}}" when: - ova_deploy_status.changed == true - name: Generate NSX self-signed certificate if it doens't exist command: python nsx_t_gen.py --router_config false --generate_cert true - - name: Wait 2 minutes before accessing NSX Manager API - pause: minutes=2 + - name: Wait for NSX appliances to be status up + pause: + minutes: "{{hostvars['localhost'].appliance_ready_wait}}" - name: Wait for Manager API server to be up shell: "last=1; while [ $last -ne 0 ]; do curl -s -o /dev/null -ku '{{hostvars['localhost'].nsx_manager_username}}:{{hostvars['localhost'].nsx_manager_password}}' https://{{hostvars['localhost'].nsx_manager_ip}}/api/v1/trust-management/certificates --connect-timeout 5; last=$?; echo \"waiting for NSX Manager to come up\"; done"