ansible-junos-stdlib icon indicating copy to clipboard operation
ansible-junos-stdlib copied to clipboard

Feature Request: Add option to not discard uncommitted changes

Open boolzy opened this issue 2 years ago • 0 comments

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

boolzy avatar Aug 19 '23 03:08 boolzy