cisco.asa icon indicating copy to clipboard operation
cisco.asa copied to clipboard

Add regex for network_os_model

Open SD-Miles opened this issue 1 year ago • 2 comments

SUMMARY
  • Fixes #86

I have just incorporated the workaround suggested by @cjhelmkamp and @jguirlinger in the issue discussion, which adds regex to properly identify the hardware model.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME
  • asa_facts
ADDITIONAL INFORMATION

Before fix (anonymized) -- you'll notice that there's no "ansible_net_model" value:

sdmiles@WORKSTATION:~/ansible_network$ ansible example-asa.test.net -i network_inventory.yml -m cisco.asa.asa_facts
example-asa.test.net | SUCCESS => {
    "ansible_facts": {
        "ansible_net_api": "cliconf",
        "ansible_net_asatype": "ASA",
        "ansible_net_filesystems": [
            "disk0:"
        ],
        "ansible_net_filesystems_info": {
            "disk0:": {}
        },
        "ansible_net_gather_network_resources": [],
        "ansible_net_gather_subset": [
            "default",
            "hardware"
        ],
        "ansible_net_hostname": "example-asa",
        "ansible_net_image": "disk0:/asa917-32-k8.bin",
        "ansible_net_memfree_mb": 1595645,
        "ansible_net_memtotal_mb": 2097152,
        "ansible_net_memused_mb": 501506,
        "ansible_net_python_version": "3.10.6",
        "ansible_net_serialnum": "DHI3201L1R7",
        "ansible_net_system": "asa",
        "ansible_net_version": "9.1(7)32",
        "ansible_network_resources": {}
    },
    "changed": false
}

After fix (anonymized) -- the "ansible_net_model" value is now present:

sdmiles@WORKSTATION:~/ansible_network$ ansible example-asa.test.net -i network_inventory.yml -m cisco.asa.asa_facts
example-asa.test.net | SUCCESS => {
    "ansible_facts": {
        "ansible_net_api": "cliconf",
        "ansible_net_asatype": "ASA",
        "ansible_net_filesystems": [
            "disk0:"
        ],
        "ansible_net_filesystems_info": {
            "disk0:": {}
        },
        "ansible_net_gather_network_resources": [],
        "ansible_net_gather_subset": [
            "hardware",
            "default"
        ],
        "ansible_net_hostname": "example-asa",
        "ansible_net_image": "disk0:/asa917-32-k8.bin",
        "ansible_net_memfree_mb": 1595646,
        "ansible_net_memtotal_mb": 2097152,
        "ansible_net_memused_mb": 501505,
        "ansible_net_model": "ASA5520",
        "ansible_net_python_version": "3.10.6",
        "ansible_net_serialnum": "DHI3201L1R7",
        "ansible_net_system": "asa",
        "ansible_net_version": "9.1(7)32",
        "ansible_network_resources": {}
    },
    "changed": false
}

SD-Miles avatar Feb 07 '23 17:02 SD-Miles