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

ios_config enchancement, allow restorable config, remove non-config lines from return #50029

Closed
IPvSean opened this issue Dec 17, 2018 · 12 comments
Assignees
Labels
affects_2.8 This issue/PR affects Ansible v2.8 cisco Cisco technologies feature This issue/PR relates to a feature request. ios Cisco IOS community module This issue/PR relates to a module. networking Network category P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed support:network This issue/PR relates to code supported by the Ansible Network Team.
Projects

Comments

@IPvSean
Copy link
Contributor

IPvSean commented Dec 17, 2018

SUMMARY

When a backup config of an IOS / IOS-XE device is done, there is a line in the config ```Building configuration...` which is not a legitimate config, meaning we can't do a restore from the config that is returned. The means playbooks get more complicated, in the workshop we are doing this today->

    - name: REMOVE NON CONFIG LINES
      lineinfile:
        path: "{{playbook_dir}}/backup/{{inventory_hostname}}.config"
        line: "Building configuration..."
        state: absent

    - name: REMOVE NON CONFIG LINES - REGEXP
      lineinfile:
        path: "{{playbook_dir}}/backup/{{inventory_hostname}}.config"
        regexp: 'Current configuration.*'
        state: absent
ISSUE TYPE
  • Feature Idea
COMPONENT NAME

ios_config

ADDITIONAL INFORMATION

This feature could be an additional parameter, something intuitive and easy like

    - name: BACKUP THE CONFIG
      ios_config:
        backup: yes
        remove_extraneous: true
      register: config_output

imho we should make this the default

@ansibot
Copy link
Contributor

ansibot commented Dec 17, 2018

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Dec 17, 2018

@ansibot
Copy link
Contributor

ansibot commented Dec 17, 2018

@IPvSean, just so you are aware we have a dedicated Working Group for network.
You can find other people interested in this in #ansible-network on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. networking Network category support:network This issue/PR relates to code supported by the Ansible Network Team. labels Dec 17, 2018
@ikhan2010 ikhan2010 added this to Needs Triage in Networking via automation Dec 18, 2018
@ikhan2010
Copy link

@justjais Can you please look at this?

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Dec 18, 2018
@justjais
Copy link
Contributor

@ikhan2010 sure, will check and update the issue asap.

@ikhan2010 ikhan2010 added the P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed label Dec 20, 2018
@justjais justjais moved this from Needs Triage to In Progress in Networking Dec 20, 2018
@justjais justjais moved this from In Progress to Review in Networking Dec 20, 2018
@justjais justjais moved this from Review to In Progress in Networking Dec 20, 2018
@justjais justjais moved this from In Progress to Review in Networking Dec 20, 2018
@abenokraitis
Copy link
Contributor

abenokraitis commented Jan 29, 2019

preference by @privateip is to use a filter here instead of modifying module code. Thoughts, @IPvSean ?

@IPvSean
Copy link
Contributor Author

IPvSean commented Jan 29, 2019

@privateip @abenokraitis can I get an example?

@justjais
Copy link
Contributor

justjais commented Jan 29, 2019

@IPvSean this is the example I could come up with:

---
- hosts: ios
  gather_facts: no
  tasks:
  - name: ios backup
    ios_config:
      backup: yes
    register: location
  - shell: cat "{{ location.backup_path }}"
    register: result
  - debug:
      msg: "{{ result.stdout | regex_replace(pattern='Building configuration...', replacement='') }}"
    register: changed_backup
  - local_action: copy content={{ changed_backup.msg }} dest={{ location.backup_path }}

I know it's not straightforward and similar to what you have explained in issue description but via available filters we can solve the issue like above. @privateip kindly confirm if this is similar to what you meant.

@IPvSean
Copy link
Contributor Author

IPvSean commented Jan 29, 2019

i mean personally that looks absolutely awful, that was not the goal of this issue.... my vote is NO 👎 , if I get a vote :)

@IPvSean
Copy link
Contributor Author

IPvSean commented Feb 12, 2019

bump, is there any movement on this?

@ikhan2010
Copy link

@justjais please go ahead and close this, please.

@justjais
Copy link
Contributor

Closing the bug, as we shall be resolving this via available filters.

Networking automation moved this from Review to Done Feb 20, 2019
@dagwieers dagwieers added the ios Cisco IOS community label Mar 4, 2019
@dagwieers dagwieers added the cisco Cisco technologies label Mar 5, 2019
@ansible ansible locked and limited conversation to collaborators Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 cisco Cisco technologies feature This issue/PR relates to a feature request. ios Cisco IOS community module This issue/PR relates to a module. networking Network category P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed support:network This issue/PR relates to code supported by the Ansible Network Team.
Projects
No open projects
Networking
  
Done
Development

No branches or pull requests

6 participants