ansible-for-nsxt
ansible-for-nsxt copied to clipboard
nsxt_tier0.yml ha config issue
Hello. I am creating nsxt_tier0 with nsxt_tier0.yml in uni-test. But There is a issue.
When I configured nsxt_tier.yml adding ha_config, error occured. but in case of non-ha_config, it worked.
So, I guess error occur If I add ha_configs in nsxt_tier0.yml
What is problem??
@joungwoong, could you share the ansible script/code you are using and the full output (when you run with -vvvv)
I am having a similar issue to this - I can create a Tier-0 gateway using Ansible that will set most things I am after but I cannot create the "HA VIP Configuration"
Below is the playbook I am using:
- name: Create Test Tier0 Gateway(s)
vmware.ansible_for_nsxt.nsxt_policy_tier0:
hostname: "{{ NSXT_hostname }}"
username: "{{ NSXT_username }}"
password: "{{ NSXT_password }}"
validate_certs: false
state: "{{state}}"
display_name: "{{item.display_name}}"
ha_mode: "{{item.ha_mode}}"
failover_mode: "{{item.failover_mode}}"
static_routes: "{{item.static_routes}}"
tags: "{{ item.tags }}"
locale_services: "{{item.locale_services}}"
with_items:
- "{{ test_tier0_gateways }}"
Below is my test variables file with the ha_vip_configs currently commented out, when I run this everything is created as I am expecting:
test_tier0_gateways:
- display_name: CWE-TEST-TIER-0-GW
ha_mode: ACTIVE_STANDBY
failover_mode: PREEMPTIVE
static_routes:
- state: present
display_name: Default
network: 0.0.0.0/0
next_hops:
- ip_address: 192.168.50.1 locale_services:
- state: present
id: test-t0ls
display_name: CWE-TEST-TIER-0-GW
edge_cluster_info:
edge_cluster_display_name: EDGE-CLUSTER-1
preferred_edge_nodes_info:
- edge_cluster_display_name: EDGE-CLUSTER-1
edge_node_display_name: EDGE-NODE-3
interfaces: - display_name: EDGENODE-3
state: present
type: EXTERNAL
subnets:
- ip_addresses: 192.168.50.24 prefix_len: 24 segment_display_name: EXTERNAL-SEGMENT edge_node_info: edge_cluster_display_name: EDGE-CLUSTER-1 edge_node_display_name: EDGE-NODE-3
- display_name: EDGENODE-4
state: present
type: EXTERNAL
subnets:
- ip_addresses: 192.168.50.25 prefix_len: 24 segment_display_name: EXTERNAL-SEGMENT edge_node_info: edge_cluster_display_name: EDGE-CLUSTER-1 edge_node_display_name: EDGE-NODE-4
- edge_cluster_display_name: EDGE-CLUSTER-1
- state: present
display_name: Default
network: 0.0.0.0/0
next_hops:
This is the ha_vip_configs section of the variables file that seems to cause issues:
ha_vip_configs:
- external_interface_info:
- display_name:
- EDGENODE-3
- EDGENODE-4
vip_subnets:
- ip_addresses:
- 192.168.50.23
prefix_len: 24
Have I got the ha_vip_configs section correct?
I am getting the following error when I un-comment it and run it:
"msg": "No NSXTTier0Interface found with display_name ['EDGENODE-3', 'EDGENODE-4'] for the specified configuration."
I am sure that the NSXTTier0interfaces are being created as I get the following message if I run the playbook with the ha_vip_configs section commented out in the vars file:
{
"body": "",
"changed": true,
"id": "EDGENODE-3",
"message": "NSXTTier0Interface with id EDGENODE-3 created.",
"resource_type": "NSXTTier0Interface"
},
{
"body": "",
"changed": true,
"id": "EDGENODE-4",
"message": "NSXTTier0Interface with id EDGENODE-4 created.",
"resource_type": "NSXTTier0Interface"
}
The only difference/possible problem I can see is that the NSXTTier0Interface is being created with an id of EDGENODE(N) rather than display_name.
Can anyone provide any pointers ?
Additionally, if I delete the test Tier-0 gateway and run the whole play (all variables) I get the following error:
"msg": "Failed to add NSXTTier0LocaleService with id test-t0ls.Request body [{'ha_vip_configs': [{'vip_subnets': [{'ip_addresses': ['192.168.50.23'], 'prefix_len': 24}], 'enabled': True, 'external_interface_paths': [\"/infra/tier-0s/CWE-TEST-TIER-0-GW/locale-services/test-t0ls/interfaces/['EDGENODE-3', 'EDGENODE-4']\"]}], 'display_name': 'CWE-TEST-TIER-0-GW', 'edge_cluster_path': '/infra/sites/default/enforcement-points/default/edge-clusters/f334de6e-5beb-4866-b2e9-80b0d93a7418', 'preferred_edge_paths': ['/infra/sites/default/enforcement-points/default/edge-clusters/f334de6e-5beb-4866-b2e9-80b0d93a7418/edge-nodes/1']}]. Error[(400, {'details': 'Field level validation errors: {ha_vip_configs[0].external_interface_paths has violated the minimum valid size 2}', 'httpStatus': 'BAD_REQUEST', 'error_code': 255, 'module_name': 'common-services', 'error_message': 'Field level validation errors: {ha_vip_configs[0].external_interface_paths has violated the minimum valid size 2}'})].",
"successfully_updated_resources": [
ha_vips_configs should be in the following format:
ha_vip_configs: - external_interface_info: - display_name: EDGENODE-3 - display_name: EDGENODE-4 vip_subnets: - ip_addresses: - 192.168.50.23 prefix_len: 24
Problem is still there with the v3.2.0. Looks like you need to create first the T0 route, the locale services + interfaces and then do a second time for update of the T0 with the ha_vip_configs part. Or is there another way to get this done at ones?
Else you get the error: The requested object: %interface% could not be found. I'm also using the above mentioned format:
ha_vip_configs:
enabled: True
external_interface_info:
- display_name: INTERFACENAME-1
- display_name: INTERFACENAME-1
vip_subnets:
- ip_addresses:
- 192.168.0.1
prefix_len: 24