Skip to content

Commit

Permalink
Fix a deprecated endpoint and appliance ready wait everywhere
Browse files Browse the repository at this point in the history
Signed-off-by: Yang Ding <[email protected]>
  • Loading branch information
Dyanngg committed May 5, 2020
1 parent 8c8ce8c commit a55aad0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
31 changes: 24 additions & 7 deletions nsxt_yaml/basic_resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,21 @@
- 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:
- host_switch_profiles:
- name: "{{item}}-profile"
type: UplinkHostSwitchProfile
host_switch_name: "{{overlay_host_switch}}"
host_switch_mode: "STANDARD"
pnics: "{{pnic_list}}"
ip_assignment_spec:
resource_type: StaticIpPoolSpec
Expand All @@ -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
Expand Down
10 changes: 6 additions & 4 deletions nsxt_yaml/basic_topology.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit a55aad0

Please sign in to comment.