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?

if comment:
command = 'commit-confirm {0} comment {1}'.format(confirm, comment)
else:
command = 'commit-conform {0}'.format(confirm)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be via i commit-confirm?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, absolutely!

@Qalthos Qalthos added the feature This issue/PR relates to a feature request. label Sep 2, 2022
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