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

Ansible_net_model is not returned in facts #86

Open
Aidar5 opened this issue Jan 27, 2021 · 8 comments · May be fixed by #193
Open

Ansible_net_model is not returned in facts #86

Aidar5 opened this issue Jan 27, 2021 · 8 comments · May be fixed by #193

Comments

@Aidar5
Copy link

Aidar5 commented Jan 27, 2021

SUMMARY

Return value "ansible_net_model" is absent when requesting ASA facts via CISCO ASA Ansible Collection.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

cisco.asa.asa_facts – Collect facts from remote devices running Cisco ASA

ANSIBLE VERSION
ansible 2.10.3
CONFIGURATION
COLLECTIONS_PATHS(/etc/ansible/ansible.cfg) = ['/etc/ansible/collections']
DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = ['/etc/ansible/roles']
OS / ENVIRONMENT

For example: Cisco ASA5508, Cisco FPR2110

STEPS TO REPRODUCE

Get facts from device using "cisco.asa.asa_facts" plugin

- hosts: asa
  connection: network_cli
  gather_facts: no

  vars:
    ansible_python_interpreter: /usr/bin/python3.6
    ansible_user: name
    ansible_ssh_pass: passwd
    ansible_become: true
    ansible_become_method: ansible.netcommon.enable
    ansible_become_pass: become_password
    ansible_connection: ansible.netcommon.network_cli
    ansible_network_os: cisco.asa.asa

  collections:
    - cisco.asa

  tasks:
    - name: Gather all legacy facts
      asa_facts:
        gather_subset: all
EXPECTED RESULTS

I expect to see "ansible_net_model" in returned value as it stated in documentation https://docs.ansible.com/ansible/2.10/collections/cisco/asa/asa_facts_module.html

ACTUAL RESULTS

"ansible_net_model" is not seen in response.

@justjais
Copy link
Member

justjais commented Mar 1, 2021

@Aidar5 Thanks for raising the issue, can u share the out of sh version from your ASA platform.

@vrelk
Copy link

vrelk commented Mar 24, 2021

I would like to add on to this that for mine net_serialnum is returned as null, in addition to the lack of a net_model.
Show version: https://gist.github.com/vrelk/3521f1e67dab0d5b3043fa81e5bbaf43
Returned facts using 'all': https://gist.github.com/vrelk/d1098691f0716946172505d1de41cc93

Show inventory:

Name: "Chassis", DESCR: "ASA 5525-X with SW, 8 GE Data, 1 GE Mgmt, AC"
PID: ASA5525           , VID: V03     , SN: FTX182811DG
Ansible version: 2.10.3

Collection        Version
----------------- -------
ansible.netcommon 2.0.0
ansible.utils     2.0.1
cisco.asa         2.0.0

@Aidar5
Copy link
Author

Aidar5 commented Mar 28, 2021

Here is a "sh version" output:

Cisco Adaptive Security Appliance Software Version 9.12(4)
SSP Operating System Version 2.6(1.198)
Device Manager Version 7.13(1)

Compiled on Thu 21-May-20 12:17 PDT by builders
System image file is "disk0:/mnt/boot/installables/switch/fxos-k8-fp2k-npu.2.6.1.198.SPA"
Config file at boot was "startup-config"

Hardware: FPR-2110, 6586 MB RAM, CPU MIPS 1200 MHz, 1 CPU (6 cores)

License mode: Smart Licensing
License reservation: Enabled

@cjhelmkamp
Copy link

cjhelmkamp commented Jul 12, 2021

I have also encountered this problem. I have included a work around as well as the output of show version on the ASA I am working on.

/home/USERNAME/.ansible/collections/ansible_collections/cisco/asa/plugins/cliconf/asa.py

           match = re.search(r"^Model Id:\s+(.+) \(revision", data, re.M)
            if match:
                device_info["network_os_model"] = match.group(1)
            # added to match model
            match = re.search(r"Hardware:\s+ (\w+)", data, re.M)
           if match:
               device_info["network_os_model"] = match.group(1)

sh version

Cisco Adaptive Security Appliance Software Version 9.2(4) 
Device Manager Version 7.10(1)

Compiled on Tue 14-Jul-15 22:19 by builders
System image file is "disk0:/asa924-k8.bin"
Config file at boot was "startup-config"

MFE-150-ASA up 187 days 11 hours

Hardware:   ASA5505, 512 MB RAM, CPU Geode 500 MHz,
Internal ATA Compact Flash, 128MB
BIOS Flash M50FW016 @ 0xfff00000, 2048KB

Encryption hardware device : Cisco ASA-5505 on-board accelerator (revision 0x0)
                             Boot microcode        : CN1000-MC-BOOT-2.00 
                             SSL/IKE microcode     : CNLite-MC-SSLm-PLUS-2.06
                             IPSec microcode       : CNlite-MC-IPSECm-MAIN-2.09
                             Number of accelerators: 1

 0: Int: Internal-Data0/0    : address is c471.fe31.3f45, irq 11
 1: Ext: Ethernet0/0         : address is c471.fe31.3f3d, irq 255
 2: Ext: Ethernet0/1         : address is c471.fe31.3f3e, irq 255
 3: Ext: Ethernet0/2         : address is c471.fe31.3f3f, irq 255
 4: Ext: Ethernet0/3         : address is c471.fe31.3f40, irq 255
 5: Ext: Ethernet0/4         : address is c471.fe31.3f41, irq 255
 6: Ext: Ethernet0/5         : address is c471.fe31.3f42, irq 255
 7: Ext: Ethernet0/6         : address is c471.fe31.3f43, irq 255
 8: Ext: Ethernet0/7         : address is c471.fe31.3f44, irq 255
 9: Int: Internal-Data0/1    : address is 0000.0003.0002, irq 255
10: Int: Not used            : irq 255
11: Int: Not used            : irq 255

Licensed features for this platform:
Maximum Physical Interfaces       : 8              perpetual
VLANs                             : 20             DMZ Unrestricted
Dual ISPs                         : Enabled        perpetual
VLAN Trunk Ports                  : 8              perpetual
Inside Hosts                      : Unlimited      perpetual
Failover                          : Active/Standby perpetual
Encryption-DES                    : Enabled        perpetual
Encryption-3DES-AES               : Enabled        perpetual
AnyConnect Premium Peers          : 2              perpetual
AnyConnect Essentials             : Disabled       perpetual
Other VPN Peers                   : 25             perpetual
Total VPN Peers                   : 25             perpetual
Shared License                    : Disabled       perpetual
AnyConnect for Mobile             : Disabled       perpetual
AnyConnect for Cisco VPN Phone    : Disabled       perpetual
Advanced Endpoint Assessment      : Disabled       perpetual
UC Phone Proxy Sessions           : 2              perpetual
Total UC Proxy Sessions           : 2              perpetual
Botnet Traffic Filter             : Disabled       perpetual
Intercompany Media Engine         : Disabled       perpetual
Cluster                           : Disabled       perpetual

This platform has an ASA 5505 Security Plus license.

Serial Number: JMX14xxxxxx
Running Permanent Activation Key: 0x6e11f248 0x14e86fbe 0xc040896c 0xa9048034 0x422019b7 
Configuration register is 0x1
Configuration last modified by username at 11:14:25.929 CST Thu Mar 11 2021

@jguirlinger
Copy link

I have also encountered this problem. I have included a work around as well as the output of show version on the ASA I am working on.

/home/USERNAME/.ansible/collections/ansible_collections/cisco/asa/plugins/cliconf/asa.py

           match = re.search(r"^Model Id:\s+(.+) \(revision", data, re.M)
            if match:
                device_info["network_os_model"] = match.group(1)
            # added to match model
            match = re.search(r"Hardware:\s+ (\w+)", data, re.M)
           if match:
               device_info["network_os_model"] = match.group(1)

Thanks, was useful, in my case I had to adapt your regex ( "([\w-]+)" instead of "(\w+)" ) because some of my devices are Firepower (FPR-2140 for example )

@viktklass
Copy link

@jguirlinger
works perfect for me, thx! :)
pull-request?

@ro8harp
Copy link

ro8harp commented Mar 4, 2022

I was having this same issue and came across this thread. Thanks for the workaround @jguirlinger, works now.

@SD-Miles SD-Miles linked a pull request Feb 7, 2023 that will close this issue
@dpflick
Copy link

dpflick commented Mar 29, 2023

This worked for me too! Will this be added to a new update soon?

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

Successfully merging a pull request may close this issue.

8 participants