Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module nsxt_transport_node_profiles can't be used to create complete profile #70

Open
targuan opened this issue Apr 1, 2019 · 1 comment

Comments

@targuan
Copy link

targuan commented Apr 1, 2019

In the GUI of nsx-t 2.4, the NIOC and LLDP profiles are required when adding a n-vds to a transport node profile.
The ansible module only allow to pass host_switch_profile by name and the profile types NiocProfile/LldpHostSwitchProfile cannot be found by their name.

@alexfeig
Copy link

alexfeig commented Aug 6, 2019

Hi, I just had this happen to me with UplinkHostSwitchProfile as well, so I tested to check if NiocProfile or LldpHostSwitchProfile would fail, and they did.

Error:

<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/alexf/.ansible/tmp/ansible-tmp-1565116543.08-219395642106366/ > /dev/null 2>&1 && sleep 0'
failed: [localhost] (item={u'host_switches': [{u'pnics': [{u'uplink_name': u'uplink-1', u'device_name': u'vmnic1'}], u'host_switch_name': u'overlay-nvds', u'host_switch_profiles': [{u'type': u'UplinkHostSwitchProfile', u'name': u'nsx-edge-single-nic-uplink-profile'}, {u'type': u'NiocProfile', u'name': u'nsx-default-nioc-hostswitch-profile'}, {u'type': u'LldpHostSwitchProfile', u'name': u'LLDP [Send Packet Enabled]'}], u'ip_assignment_spec': {u'resource_type': u'StaticIpPoolSpec', u'ip_pool_name': u'tep-pool'}}, {u'pnics': [{u'uplink_name': u'uplink-1', u'device_name': u'vmnic0'}], u'host_switch_name': u'overlay-nvds', u'host_switch_profiles': [{u'type': u'UplinkHostSwitchProfile', u'name': u'nsx-edge-single-nic-uplink-profile'}, {u'type': u'NiocProfile', u'name': u'nsx-default-nioc-hostswitch-profile'}, {u'type': u'LldpHostSwitchProfile', u'name': u'LLDP [Send Packet Enabled]'}], u'ip_assignment_spec': {u'resource_type': u'AssignedByDhcp'}, u'vmk_install_migration': [{u'destination_network': u'a222ef22-3bff-42c2-9aff-1c91b3878fdc', u'device_name': u'vmk0'}]}], u'display_name': u'tn-profile', u'transport_zone_endpoints': [{u'transport_zone_name': u'overlay-tz'}, {u'transport_zone_name': u'vlan-tz'}]}) => {
    "ansible_loop_var": "item", 
    "changed": false, 
    "invocation": {
        "module_args": {
            "description": null, 
            "display_name": "tn_profile", 
            "host_switch_spec": {
                "host_switches": [
                    {
                        "host_switch_name": "overlay-nvds", 
                        "ip_assignment_spec": {
                            "ip_pool_name": "tep-pool", 
                            "resource_type": "StaticIpPoolSpec"
                        }, 
                        "pnics": [
                            {
                                "device_name": "vmnic1", 
                                "uplink_name": "uplink-1"
                            }
                        ]
                    }, 
                    {
                        "host_switch_name": "overlay-nvds", 
                        "host_switch_profiles": [
                            {
                                "name": "nsx-edge-single-nic-uplink-profile", 
                                "type": "UplinkHostSwitchProfile"
                            }, 
                            {
                                "name": "nsx-default-nioc-hostswitch-profile", 
                                "type": "NiocProfile"
                            }, 
                            {
                                "name": "LLDP [Send Packet Enabled]", 
                                "type": "LldpHostSwitchProfile"
                            }
                        ], 
                        "ip_assignment_spec": {
                            "resource_type": "AssignedByDhcp"
                        }, 
                        "pnics": [
                            {
                                "device_name": "vmnic0", 
                                "uplink_name": "uplink-1"
                            }
                        ], 
                        "vmk_install_migration": [
                            {
                                "destination_network": "a222ef22-3bff-42c2-9aff-1c91b3878fdc", 
                                "device_name": "vmk0"
                            }
                        ]
                    }
                ], 
                "resource_type": "StandardHostSwitchSpec"
            }, 
            "hostname": "192.168.50.156", 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "port": 443, 
            "resource_type": "TransportNodeProfile", 
            "state": "present", 
            "transport_zone_endpoints": [
                {
                    "transport_zone_name": "overlay-tz"
                }, 
                {
                    "transport_zone_name": "vlan-tz"
                }
            ], 
            "username": "admin", 
            "validate_certs": false
        }
    }, 
    "item": {
        "display_name": "tn-profile", 
        "host_switches": [
            {
                "host_switch_name": "overlay-nvds", 
                "host_switch_profiles": [
                    {
                        "name": "nsx-edge-single-nic-uplink-profile", 
                        "type": "UplinkHostSwitchProfile"
                    }, 
                    {
                        "name": "nsx-default-nioc-hostswitch-profile", 
                        "type": "NiocProfile"
                    }, 
                    {
                        "name": "LLDP [Send Packet Enabled]", 
                        "type": "LldpHostSwitchProfile"
                    }
                ], 
                "ip_assignment_spec": {
                    "ip_pool_name": "tep-pool", 
                    "resource_type": "StaticIpPoolSpec"
                }, 
                "pnics": [
                    {
                        "device_name": "vmnic1", 
                        "uplink_name": "uplink-1"
                    }
                ]
            }, 
            {
                "host_switch_name": "overlay-nvds", 
                "host_switch_profiles": [
                    {
                        "name": "nsx-edge-single-nic-uplink-profile", 
                        "type": "UplinkHostSwitchProfile"
                    }, 
                    {
                        "name": "nsx-default-nioc-hostswitch-profile", 
                        "type": "NiocProfile"
                    }, 
                    {
                        "name": "LLDP [Send Packet Enabled]", 
                        "type": "LldpHostSwitchProfile"
                    }
                ], 
                "ip_assignment_spec": {
                    "resource_type": "AssignedByDhcp"
                }, 
                "pnics": [
                    {
                        "device_name": "vmnic0", 
                        "uplink_name": "uplink-1"
                    }
                ], 
                "vmk_install_migration": [
                    {
                        "destination_network": "a222ef22-3bff-42c2-9aff-1c91b3878fdc", 
                        "device_name": "vmk0"
                    }
                ]
            }
        ], 
        "transport_zone_endpoints": [
            {
                "transport_zone_name": "overlay-tz"
            }, 
            {
                "transport_zone_name": "vlan-tz"
            }
        ]
    }, 
    "msg": "No id exist with display name nsx-edge-single-nic-uplink-profile"
}

Task:

- name: Create Transport Node Profile
  nsxt_transport_node_profiles:
    hostname: "{{ nsx_ipaddress }}"
    username: "admin"
    password: "{{ nsx_password }}"
    validate_certs: False
    resource_type: TransportNodeProfile
    display_name: "tn_profile"
    host_switch_spec:
      resource_type: StandardHostSwitchSpec
      host_switches: "{{ item.host_switches }}"
    transport_zone_endpoints: "{{ item.transport_zone_endpoints }}"
    state: present
  with_items:
    - "{{ transport_node_profiles }}"

Variables:

{
    "transport_node_profiles": [{
        "display_name": "tn-profile",
        "host_switches": [{
                "host_switch_profiles": [{
                        "name": "nsx-edge-single-nic-uplink-profile",
                        "type": "UplinkHostSwitchProfile"
                    },
                    {
                        "name": "nsx-default-nioc-hostswitch-profile",
                        "type": "NiocProfile"
                    },
                    {
                        "name": "LLDP [Send Packet Enabled]",
                        "type": "LldpHostSwitchProfile"
                    }
                ],
                "host_switch_name": "overlay-nvds",
                "pnics": [{
                    "device_name": "vmnic1",
                    "uplink_name": "uplink-1"
                }],
                "ip_assignment_spec": {
                    "resource_type": "StaticIpPoolSpec",
                    "ip_pool_name": "tep-pool"
                }
            }, {
                "host_switch_profiles": [{
                        "name": "nsx-edge-single-nic-uplink-profile",
                        "type": "UplinkHostSwitchProfile"
                    },
                    {
                        "name": "nsx-default-nioc-hostswitch-profile",
                        "type": "NiocProfile"
                    },
                    {
                        "name": "LLDP [Send Packet Enabled]",
                        "type": "LldpHostSwitchProfile"
                    }
                ],
                "host_switch_name": "overlay-nvds",
                "pnics": [{
                    "device_name": "vmnic0",
                    "uplink_name": "uplink-1"
                }],
                "ip_assignment_spec": {
                    "resource_type": "AssignedByDhcp"
                },
                "vmk_install_migration" : [ {
                    "device_name" : "vmk0",
                    "destination_network" : "a222ef22-3bff-42c2-9aff-1c91b3878fdc"
                } ]
            }
        ],
        "transport_zone_endpoints": [{
                "transport_zone_name": "overlay-tz"
            },
            {
                "transport_zone_name": "vlan-tz"
            }
        ]
    }]
}

alexfeig added a commit to alexfeig/ansible-for-nsxt that referenced this issue Aug 6, 2019
The default endpoint path of `/host-switch-profiles` does not return _system_owned objects.

Added `include_system_owned=true` and fixed a couple of minor issues with error messages.

Signed-off-by: Alex Feigenson <alex.feigenson@gmail.com>
madhukark added a commit that referenced this issue Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants