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

Feature Request: Add option to not discard uncommitted changes #625

Closed
boolzy opened this issue Aug 19, 2023 · 2 comments
Closed

Feature Request: Add option to not discard uncommitted changes #625

boolzy opened this issue Aug 19, 2023 · 2 comments
Assignees

Comments

@boolzy
Copy link

boolzy commented Aug 19, 2023

Issue Type

  • Feature Idea

Module Name

juniper.device.config

juniper.device collection and Python libraries version

ansible [core 2.15.2]
  config file = /home/ansible/.ansible/ansible.cfg
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.4 (main, Jun  9 2023, 07:59:55) [GCC 12.3.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

OS / Environment

Junos: 21.4R3-S3.4

Summary

Adding a feature to not discard uncommitted changes to allow the usage of task loops

Steps to reproduce

  - name: Configure IRBs and VLANs
    juniper.device.config:
      config_mode: private
      commit: false
      check: false
      load: set
      lines:
        - "set interfaces irb unit {{ item }} family inet address 10.1.{{ item }}.1/24"
        - "set vlans vlan{{ item }} vlan-id {{ item }} l3-interface irb.{{ item }}"
    loop: "{{ range(1,254) | list }}"

  - name: Commit changes
    juniper.device.config:
      commit: true
      comment: "Configure IRBs and VLANs"

Expected results

task loop sets expected values, then commits result

Actual results

pending configuration is discarded at the end of the task loop, requiring a commit for every loop of the task

@dineshbaburam91
Copy link
Collaborator

dineshbaburam91 commented May 6, 2024

@boolzy You need to write a separate task using set_fact module to append and store the configurations in the list variable then use that stored variable in the juniper.device.config module to commit the configuration.

Kindly try the solution and let us know.

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/set_fact_module.html

@dineshbaburam91
Copy link
Collaborator

The solution provided. Hence, closing the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants