vmware / ansible-for-nsxt

Ansible delivers simple IT automation that ends repetitive tasks and frees up DevOps teams for more strategic work. This project is to enable this automation for NSX-T installation.
Other
171 stars 145 forks source link

Cannot deploy edge transpart node using nsxt_transport_nodes module #477

Open Wheezy93 opened 1 year ago

Wheezy93 commented 1 year ago

Describe the bug

Dictionnary path

When i try to deploy an edge node with nsxt_transport_nodes module it seems that the path for 'vm_deployment_config' parameter in nsxt_transport_nodes.py (line 908) is incorrect.

Pop attribute

Moreover when i fixed the path above i encounter another problem : The full traceback is: Traceback (most recent call last): File "/root/.ansible/tmp/ansible-tmp-1695212504.2851267-19820-184974948524025/AnsiballZ_nsxt_transport_nodes.py", line 100, in <module> _ansiballz_main() File "/root/.ansible/tmp/ansible-tmp-1695212504.2851267-19820-184974948524025/AnsiballZ_nsxt_transport_nodes.py", line 92, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/root/.ansible/tmp/ansible-tmp-1695212504.2851267-19820-184974948524025/AnsiballZ_nsxt_transport_nodes.py", line 41, in invoke_module run_name='__main__', alter_sys=True) File "/usr/local/lib/python3.6/runpy.py", line 205, in run_module return _run_module_code(code, init_globals, run_name, mod_spec) File "/usr/local/lib/python3.6/runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/tmp/ansible_vmware.ansible_for_nsxt.nsxt_transport_nodes_payload_g92psq0y/ansible_vmware.ansible_for_nsxt.nsxt_transport_nodes_payload.zip/ansible_collections/vmware/ansible_for_nsxt/plugins/modules/nsxt_transport_nodes.py", line 1108, in <module> File "/tmp/ansible_vmware.ansible_for_nsxt.nsxt_transport_nodes_payload_g92psq0y/ansible_vmware.ansible_for_nsxt.nsxt_transport_nodes_payload.zip/ansible_collections/vmware/ansible_for_nsxt/plugins/modules/nsxt_transport_nodes.py", line 1019, in main File "/tmp/ansible_vmware.ansible_for_nsxt.nsxt_transport_nodes_payload_g92psq0y/ansible_vmware.ansible_for_nsxt.nsxt_transport_nodes_payload.zip/ansible_collections/vmware/ansible_for_nsxt/plugins/modules/nsxt_transport_nodes.py", line 731, in update_params_with_id AttributeError: 'str' object has no attribute 'pop' fatal: [localhost]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1695212504.2851267-19820-184974948524025/AnsiballZ_nsxt_transport_nodes.py\", line 100, in <module>\n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-1695212504.2851267-19820-184974948524025/AnsiballZ_nsxt_transport_nodes.py\", line 92, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-1695212504.2851267-19820-184974948524025/AnsiballZ_nsxt_transport_nodes.py\", line 41, in invoke_module\n run_name='__main__', alter_sys=True)\n File \"/usr/local/lib/python3.6/runpy.py\", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/local/lib/python3.6/runpy.py\", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File \"/usr/local/lib/python3.6/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_vmware.ansible_for_nsxt.nsxt_transport_nodes_payload_g92psq0y/ansible_vmware.ansible_for_nsxt.nsxt_transport_nodes_payload.zip/ansible_collections/vmware/ansible_for_nsxt/plugins/modules/nsxt_transport_nodes.py\", line 1108, in <module>\n File \"/tmp/ansible_vmware.ansible_for_nsxt.nsxt_transport_nodes_payload_g92psq0y/ansible_vmware.ansible_for_nsxt.nsxt_transport_nodes_payload.zip/ansible_collections/vmware/ansible_for_nsxt/plugins/modules/nsxt_transport_nodes.py\", line 1019, in main\n File \"/tmp/ansible_vmware.ansible_for_nsxt.nsxt_transport_nodes_payload_g92psq0y/ansible_vmware.ansible_for_nsxt.nsxt_transport_nodes_payload.zip/ansible_collections/vmware/ansible_for_nsxt/plugins/modules/nsxt_transport_nodes.py\", line 731, in update_params_with_id\nAttributeError: 'str' object has no attribute 'pop'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }

Reproduction steps

  1. Execute nsxt_transport_nodes module
  2. ...

Expected behavior

Fix nsxt_transport_nodes module

Additional context

No response

Priyanka-Middha commented 1 year ago

Hi Wheezy,

Below is the sample Transport node edge deployment which is working fine. Could you please share the yaml which is failing for this Ansible module?


  • hosts: 127.0.0.1 connection: local tasks:
  • name: Create edge transport nodes vmware.ansible_for_nsxt.nsxt_transport_nodes: hostname: "{{mgr_0_ip_address}}" username: "{{username}}" password: "{{password}}" validate_certs: False display_name: "{{display_name}}" description: "{{description}}" host_switch_spec: resource_type: StandardHostSwitchSpec host_switches:
  • host_switch_profiles:
  • name: "{{uplink_profile_name}}" type: UplinkHostSwitchProfile host_switch_name: "{{host_switch_name}}" host_switch_mode: "{{host_switch_mode}}" pnics:
  • device_name: "{{device_name}}" uplink_name: "{{uplink_name}}" ip_assignment_spec: resource_type: StaticIpPoolSpec ip_pool_name: "{{ip_pool_display_name}}" transport_zone_endpoints:
  • transport_zone_name: "{{transport_zone_display_name_1}}"
  • transport_zone_name: "{{transport_zone_display_name_2}}" node_deployment_info: resource_type: EdgeNode display_name: "{{node_display_name}}" deployment_type: VIRTUAL_MACHINE fqdn: "{{ip_address}}" ip_addresses:
  • "{{ip_address}}" node_settings: allow_ssh_root_login: "{{allow_ssh_root_login}}" enable_ssh: "{{enable_ssh}}" dns_servers:
  • "{{dns_server}}" ntp_servers:
  • "{{ntp_server}}" hostname: "{{node_display_name}}" search_domains:
  • "{{search_domains}}" tags:
  • tag: "{{edge_tag}}" scope: "{{edge_scope}}" deployment_config: form_factor: "{{form_factor}}" node_user_settings: cli_password: "{{password}}" root_password: "{{password}}" vm_deployment_config: placement_type: VsphereDeploymentConfig vc_name: "{{prod_vc_display_name}}" vc_username: "{{prod_vc_username}}" vc_password: "{{prod_vc_password}}" host: "{{prod_esx_ip}}" compute: "{{prod_vc_cluster}}" storage: "{{prod_vc_datastore}}" management_network: "{{prod_vc_portgroup}}" data_networks:
  • "{{prod_vc_portgroup}}"
  • "{{prod_vc_portgroup}}"
  • "{{prod_vc_portgroup}}" management_port_subnets:
  • ip_addresses:
  • "{{ip_address}}" prefix_length: "{{prefix_length}}" default_gateway_addresses:
  • "{{gateway}}" reservation_info: cpu_reservation: reservation_in_mhz: "{{reservation_in_mhz}}" reservation_in_shares: "{{reservation_in_shares}}" memory_reservation: reservation_percentage: "{{reservation_percentage}}" resource_allocation: cpu_count: "{{cpu_count}}" memory_allocation_in_mb: "{{memory_allocation_in_mb}}" tags:
  • tag: "{{edge_tn_tag}}" scope: "{{edge_tn_scope}}" state: "{{state}}"

Thanks, Priyanka

Wheezy93 commented 1 year ago

Hi Priyanka,

In attachement my role and default vars file. My goal is to create multiple edge tranport node. So i isolate common parameter and i loop my task on edge node name. create_node.zip

Regards, Denis