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

change to variable to use '_' underscore rather than '-' dash #106

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from

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