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

[WIP] added commit-confirm options to vyos_config #229

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

Conversation

lucaelin
Copy link

SUMMARY

I've added an option to the vyos_config module to use commit-confirm with a given timeout instead of running a straight commit. This functionality is included in vyos and now exposed to the vyos_config module. If no confirmation is received by vyos, it will reboot into the previously existing config, as an attempt to restore functionality.

The module can also automatically confirm the configuration if the connection remains working after applying the new config, or not confirm the configuration for you, leaving it up to the user to allow further testing and manual confirmation.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

commit-confirm

ADDITIONAL INFORMATION

If you accidentally remove the interface configuration your playbook is using to connect to the router, you would previously get a timeout from the module, but the broken config would still remain on the device. This change allows you to specify a timeout, after which the router reboots into the old configuration.

- name: render a Jinja2 template onto the VyOS router
  vyos.vyos.vyos_config:
    src: "../files/{{ template }}.j2"
    match: smart
    save: yes
    confirm: automatic
- name: render a Jinja2 template onto the VyOS router and test it for one minute
  vyos.vyos.vyos_config:
    src: "../files/{{ template }}.j2"
    match: smart
    save: yes
    confirm: manual
    confirm_timeout: 1

- name: check connectivity
  vyos.vyos.vyos_ping:
    dest: 1.1.1.1
    
- name: confirm configuration
  vyos.vyos.vyos_command:
    commands: 
      - configure
      - confirm
      - exit

I think tests should be implemented for this feature, but I am not sure how. Can you point me in the right directions here please?

plugins/cliconf/vyos.py Outdated Show resolved Hide resolved
@Qalthos Qalthos added the feature This issue/PR relates to a feature request. label Sep 2, 2022
@sever-sever
Copy link
Member

@lucaelin, could you rebase/resolve conflicts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request.
Development

Successfully merging this pull request may close these issues.

3 participants