Skip to content

Conversation

@epicanthal
Copy link

Referencing the variable 'cisco_ios.config.interface-config' results in "VARIABLE IS NOT DEFINED!: 'config' is undefined"

Tasks:

    - name: PARSE THE RAW OUTPUT
      command_parser:
        file: "{{ parser_template_dir }}/ios/show_run_interface.yaml"
        content: "{{ ansible_net_config }}"

    - debug: var=cisco_ios.config.interface-config.Vlan1

Sample data with -v:

TASK [PARSE THE RAW OUTPUT] *******************************************************************************
ok: [cia-lab-3850] => {
    "ansible_facts": {
        "cisco_ios": {
            "config": {
                "interface-config": {
                    "FortyGigabitEthernet1/1/1": {
                        "cdp": true, 
                        "description": null, 
                        "duplex": null, 
                        "enabled": true, 
                        "ip_addess": [], 
                        "ip_helper": [], 
                        "mtu": null, 
                        "name": "FortyGigabitEthernet1/1/1", 
                        "speed": null
                    }, 
                    "FortyGigabitEthernet1/1/2": {
                        "cdp": true, 
                        "description": null, 
                        "duplex": null, 

<truncated>
                    "Vlan1": {
                        "cdp": true, 
                        "description": null, 
                        "duplex": null, 
                        "enabled": true, 
                        "ip_addess": [], 
                        "ip_helper": [], 
                        "mtu": null, 
                        "name": "Vlan1", 
                        "speed": null
                    }
                }
            }
        }
    }, 
    "changed": false, 
    "included": [
        "/var/lib/awx/projects/net_compliance/parser_templates/ios/show_run_interface.yaml"
    ]
}

TASK [debug] **********************************************************************************************
ok: [cia-lab-3850] => {
    "cisco_ios.config.interface-config.Vlan1": "VARIABLE IS NOT DEFINED!: 'config' is undefined"
}

After changing variable to use to '_' underscore, the expected data is returned:

TASK [debug] **********************************************************************************************
ok: [cia-lab-3850] => {
    "cisco_ios.config.interface_config.Vlan1": {
        "cdp": true, 
        "description": null, 
        "duplex": null, 
        "enabled": true, 
        "ip_addess": [], 
        "ip_helper": [], 
        "mtu": null, 
        "name": "Vlan1", 
        "speed": null
    }
}

@ansible-zuul
Copy link

ansible-zuul bot commented Apr 19, 2019

Build failed.

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 this pull request may close these issues.

2 participants