ansible-collections / cisco.ios

Ansible Network Collection for Cisco IOS
GNU General Public License v3.0
292 stars 171 forks source link

BGP Module Doesnt Set Password #186

Closed feisa closed 3 years ago

feisa commented 4 years ago
SUMMARY

The bgp module is now applying the password, looks like it might be ignored

ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION

ansible 2.10.2 config file = /home/user/ansible-network/ansible.cfg configured module search path = ['/home/user/ansible-network/library'] ansible python module location = /home/user/.local/lib/python3.6/site-packages/ansible executable location = /usr/bin/ansible python version = 3.6.8 (default, Dec 5 2019, 15:45:45) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]

CONFIGURATION

COLLECTIONS_PATHS(/home/user/ansible-network/ansible.cfg) = ['/home/user/ansible-network/collections'] DEFAULT_FORKS(/home/user/ansible-network/ansible.cfg) = 100 DEFAULT_HOST_LIST(/home/user/ansible-network/ansible.cfg) = ['/home/user/ansible-network/inventories'] DEFAULT_MODULE_PATH(/home/user/ansible-network/ansible.cfg) = ['/home/user/ansible-network/library'] DEFAULT_ROLES_PATH(/home/user/ansible-network/ansible.cfg) = ['/home/user/ansible-network/roles'] DEFAULT_SCP_IF_SSH(/home/user/ansible-network/ansible.cfg) = True GALAXY_SERVER_LIST(/home/user/ansible-network/ansible.cfg) = ['automation_hub', 'release_galaxy'] HOST_KEY_CHECKING(/home/user/ansible-network/ansible.cfg) = False INTERPRETER_PYTHON(/home/user/ansible-network/ansible.cfg) = auto PERSISTENT_COMMAND_TIMEOUT(/home/user/ansible-network/ansible.cfg) = 60000000 PERSISTENT_CONNECT_RETRY_TIMEOUT(/home/user/ansible-network/ansible.cfg) = 100 PERSISTENT_CONNECT_TIMEOUT(/home/user/ansible-network/ansible.cfg) = 6000

OS / ENVIRONMENT

Cisco IOS XE Software, Version 16.12.04 Cisco IOS Software [Gibraltar], ASR1000 Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.12.4, RELEASE SOFTWARE (fc5) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2020 by Cisco Systems, Inc. Compiled Thu 09-Jul-20 21:59 by mcpre

STEPS TO REPRODUCE
- name: Configure Edge BGP Neighbors
  cisco.ios.ios_bgp:
    config:
      bgp_as: "{{ as_number }}"
      log_neighbor_changes: true
      neighbors:
      - neighbor: "{{ item[0].remote_ipv4 }}"
        remote_as: "{{ item[0].remote_as }}"
        password: "{{ item[0].passwd | default(omit) }}"
        description: "{{ item[0].des | default(omit) }}"
        prefix_list_in: "{{ item[0].prefix_in | default(omit) }}"
        prefix_list_out: "{{ item[0].prefix_out| default(omit) }}"
      networks: 
      - prefix: "{{ item[1].route | default(omit) }}" 
        masklen: "{{ item[1].prefix | default(omit) }}"
  when:
    - bgp_neighbors is defined
    - inventory_hostname in groups["ios_routers_edge"]
  with_nested:
    - "{{ bgp_neighbors }}"
    - "{{ bgp_advertisement }}"
  tags:
    - ios-bgp

bgp_neighbors:
  - { remote_as: "18683", remote_ipv4: "66.85.63.241",   des: TO_ISP, route_map_out: TO_EXTERNAL, passwd: password, pwtype: 3des }
EXPECTED RESULTS

Password applies

ACTUAL RESULTS

: 27}]) => { "ansible_facts": { "discovered_interpreter_python": "/usr/libexec/platform-python" }, "ansible_loop_var": "item", "changed": true, "commands": [ "router bgp 65000", "neighbor 66.85.63.241 password ****", "exit" ], "invocation": { "module_args": { "config": { "address_family": null, "bgp_as": 65000, "log_neighbor_changes": true, "neighbors": [ { "description": "TO_ISP", "ebgp_multihop": null, "enabled": null, "local_as": null, "neighbor": "66.85.63.241", "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "peer_group": null, "remote_as": 18683, "timers": null, "update_source": null } ], "networks": [ { "masklen": 27, "prefix": "67.199.249.0", "route_map": null } ], "router_id": null }, "operation": "merge" } }, "item": [ { "des": "TO_ISP", "passwd": "password", "pwtype": "3des", "remote_as": "18683", "remote_ipv4": "66.85.63.241", "route_map_out": "TO_EXTERNAL" }, { "null_route": true, "prefix": 27, "route": "67.199.249.0" } ] }

NilashishC commented 3 years ago

@feisa Looking at the result you shared, the module does seem to configure password for the neighbor. I can also verify that by running the same playbook in my environment. Could you please clarify what the exact issue is here? Thanks.

feisa commented 3 years ago

@NilashishC please see the example code, this is not actually setting the password. Looks like the issue persist through the resource module

  cisco.ios.ios_bgp_global:
    config:
      as_number: 65000
      bgp:
        log_neighbor_changes: true
      neighbor:
        - address: 192.0.2.1
          description:  replace neighbor
          remote_as: 100
        - password: "somepass"          
        - activate: true
          address: 192.0.2.1
    state: merged
  tags:
    - ios-bgp-new

Please see the output below, looks like the password is parsed but not applied the device

ok: [la3-utilc001] => {
    "before": {
        "as_number": "65000",
        "bgp": {
            "log_neighbor_changes": true
        },
        "neighbor": [
            {
                "activate": true,
                "address": "192.0.2.1",
                "description": "replace neighbor",
                "remote_as": 100
            }
        ]
    },
    "changed": false,
    "commands": [],
    "invocation": {
        "module_args": {
            "config": {
                "aggregate_address": null,
                "as_number": "65000",
                "auto_summary": null,
                "bgp": {
                    "additional_paths": null,
                    "advertise_best_external": null,
                    "aggregate_timer": null,
                    "always_compare_med": null,
                    "asnotation": null,
                    "bestpath": null,
                    "client_to_client": null,
                    "cluster_id": null,
                    "confederation": null,
                    "consistency_checker": null,
                    "dampening": null,
                    "deterministic_med": null,
                    "dmzlink_bw": null,
                    "enforce_first_as": null,
                    "enhanced_error": null,
                    "fast_external_fallover": null,
                    "graceful_restart": null,
                    "graceful_shutdown": null,
                    "inject_map": null,
                    "listen": null,
                    "log_neighbor_changes": true,
                    "maxas_limit": null,
                    "maxcommunity_limit": null,
                    "maxextcommunity_limit": null,
                    "nexthop": null,
                    "nopeerup_delay": null,
                    "recursion": null,
                    "redistribute_internal": null,
                    "refresh": null,
                    "regexp": null,
                    "route_map": null,
                    "router_id": null,
                    "scan_time": null,
                    "slow_peer": null,
                    "snmp": null,
                    "soft_reconfig_backup": null,
                    "sso": null,
                    "suppress_inactive": null,
                    "transport": null,
                    "update_delay": null,
                    "update_group": null,
                    "upgrade_cli": null
                },
                "bmp": null,
                "default_information": null,
                "default_metric": null,
                "distance": null,
                "distribute_list": null,
                "maximum_paths": null,
                "maximum_secondary_paths": null,
                "neighbor": [
                    {
                        "activate": null,
                        "additional_paths": null,
                        "address": "192.0.2.1",
                        "advertise": null,
                        "advertise_map": null,
                        "advertisement_interval": null,
                        "aigp": null,
                        "allow_policy": null,
                        "allowas_in": null,
                        "as_override": null,
                        "bmp_activate": null,
                        "capability": null,
                        "cluster_id": null,
                        "default_originate": null,
                        "description": "replace neighbor",
                        "disable_connected_check": null,
                        "distribute_list": null,
                        "dmzlink_bw": null,
                        "ebgp_multihop": null,
                        "fall_over": null,
                        "filter_list": null,
                        "ha_mode": null,
                        "inherit": null,
                        "ipv6_adddress": null,
                        "local_as": null,
                        "log_neighbor_changes": null,
                        "maximum_prefix": null,
                        "next_hop_self": null,
                        "next_hop_unchanged": null,
                        "password": "somepass",
                        "path_attribute": null,
                        "peer_group": null,
                        "remote_as": 100,
                        "remove_private_as": null,
                        "route_map": null,
                        "route_reflector_client": null,
                        "route_server_client": null,
                        "send_community": null,
                        "send_label": null,
                        "shutdown": null,
                        "slow_peer": null,
                        "soft_reconfiguration": null,
                        "tag": null,
                        "timers": null,
                        "translate_update": null,
                        "transport": null,
                        "ttl_security": null,
                        "unsuppress_map": null,
                        "version": null,
                        "weight": null
                    },
                    {
                        "activate": true,
                        "additional_paths": null,
                        "address": "192.0.2.1",
                        "advertise": null,
                        "advertise_map": null,
                        "advertisement_interval": null,
                        "aigp": null,
                        "allow_policy": null,
                        "allowas_in": null,
                        "as_override": null,
                        "bmp_activate": null,
                        "capability": null,
                        "cluster_id": null,
                        "default_originate": null,
                        "description": null,
                        "disable_connected_check": null,
                        "distribute_list": null,
                        "dmzlink_bw": null,
                        "ebgp_multihop": null,
                        "fall_over": null,
                        "filter_list": null,
                        "ha_mode": null,
                        "inherit": null,
                        "ipv6_adddress": null,
                        "local_as": null,
                        "log_neighbor_changes": null,
                        "maximum_prefix": null,
                        "next_hop_self": null,
                        "next_hop_unchanged": null,
                        "password": null,
                        "path_attribute": null,
                        "peer_group": null,
                        "remote_as": null,
                        "remove_private_as": null,
                        "route_map": null,
                        "route_reflector_client": null,
                        "route_server_client": null,
                        "send_community": null,
                        "send_label": null,
                        "shutdown": null,
                        "slow_peer": null,
                        "soft_reconfiguration": null,
                        "tag": null,
                        "timers": null,
                        "translate_update": null,
                        "transport": null,
                        "ttl_security": null,
                        "unsuppress_map": null,
                        "version": null,
                        "weight": null
                    }
                ],
                "redistribute": null,
                "route_server_context": null,
                "scope": null,
                "synchronization": null,
                "table_map": null,
                "template": null,
                "timers": null
            },
            "running_config": null,
            "state": "merged"
        }
    }
}
justjais commented 3 years ago

@feisa for password to be configured as expected under neighbor u need to pass that under address context and not as separate list like:

cisco.ios.ios_bgp_global:
    config:
      as_number: 65000
      bgp:
        log_neighbor_changes: true
      neighbor:
        - address: 192.0.2.1
          description:  replace neighbor
          remote_as: 100
          password: "somepass"          
        - activate: true
          address: 192.0.2.1
    state: merged
  tags:
    - ios-bgp-new

with the ^^ format, password config cmd will be fired and configured as expected under neighbor with address 192.0.2.1. Please let us know if you're able to resolve the issue as suggested and if we can close the respective issue.

justjais commented 3 years ago

@feisa the issue is inactive and is waiting on the info we’re closing the issue, plz reopen a new issue if you’re still facing the reported issue