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

Issue with arubaoss_config diff_against #93

Open
uoe-ahewittbell opened this issue May 3, 2024 · 0 comments
Open

Issue with arubaoss_config diff_against #93

uoe-ahewittbell opened this issue May 3, 2024 · 0 comments

Comments

@uoe-ahewittbell
Copy link

Hi,

I've been using this module but noticed that the diff_against startup config doesn't work correctly:

Playbook

---
- hosts: test
  collections:
    - arubanetworks.aos_switch
  tasks:
    - name: >
        Check running config matches startup. Returns OK if matching.
        Changed if not, which will then be saved.
      arubaoss_config:
        diff_against: startup
        save_when: modified


      vars:
        ansible_connection: network_cli

Output:

"before": "show config configInvalid input: config\r\nSWITCH-NAME# "

Digging into the module used, it appears there is issue with the command. as the command is not valid. "show config config"

#aos-switch-ansible-collection/plugins/modules/arubaoss_config.py
    elif module.params['save_when'] == 'modified':
        output = run_commands(module,
                              ['show running-config', 'show config config'])

        running_config = NetworkConfig(
            contents=output[0], ignore_lines=diff_ignore_lines)
        startup_config = NetworkConfig(
            contents=output[1], ignore_lines=diff_ignore_lines)

        if running_config.sha1 != startup_config.sha1:
            save_config(module, result)
    elif module.params['save_when'] == 'changed':
        if result['changed']:
            save_config(module, result)

    if module._diff:
        if not running_config:
            output = run_commands(module, 'show running-config')
            contents = output[0]
        else:
            contents = running_config.config_text

        # recreate the object in order to process diff_ignore_lines
        running_config = NetworkConfig(
            contents=contents, ignore_lines=diff_ignore_lines)

        if module.params['diff_against'] == 'running':
            if module.check_mode:
                module.warn("unable to perform diff against "
                            "running-config due to check mode")
                contents = None
            else:
                contents = config.config_text

        elif module.params['diff_against'] == 'startup':
            if not startup_config:
                output = run_commands(module, 'show config config')
                contents = output[0]
            else:
                contents = startup_config.config_text

Switch model: 2930m
version: 16.10.0020

Alternate way could be using the following command:

show config status

The running configuration matches the saved configuration.

Or changing it to show config.

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

No branches or pull requests

1 participant