Comments (4)
Hello @nkhambal,
Did you resolve this problem already?
Please look at the Nokia MD-CLI playbook example
The syntax your using isn't the same as in the Nokia MD-CLI sample as linked above your using:
cli_command:
command: configure private
vs the sample:
cli_config:
config: |
configure private
from ansible-networking-collections.
@nkhambal, the cli_config
should take care about changing into configuration mode and to finally commit the change. It must not be manually to ensure function.
from ansible-networking-collections.
Following playbook worked with one exception of "commit" tag. It commits even when it is set to "No". Is there an option to perform a commit "validate" and then "rollback" without actually committing the configuration?
---
- name: Configure Nokia.
hosts: nokia-hosts
serial: 1
vars:
- ansible_network_os: nokia.sros.md
- ansible_user: "{{ SSH_USER }}"
- ansible_password: "{{ SSH_PASSWORD }}"
- ansible_command_timeout: 60
- ansible_python_interpreter: "/Users/nileshkhambal/Documents/myansible/bin/python3"
connection: network_cli
gather_facts: No
collections:
- nokia.sros
vars_files:
- prod-tacacs-vault.yaml
tasks:
- name: Apply Configuration from File
cli_config:
config: "{{ lookup('file', devfilename)}}"
commit: No
vars:
devfilename: "{{ inventory_hostname }}.set"
register: configResult
- name: Print Results
debug:
msg: "{{ configResult.diff.split('\n') }}"
from ansible-networking-collections.
Replying the answer to my own query. To skip commit and discard candidate after validate, use "commit: False". Default is "commit: True". Following playbook worked. It fetches the template and generates the configuration (deleting mpls lsp configuration in this case) and pushes it via cli_config. Does compare, validate and then discards the configuration providing the diff.
NOTE: make sure you use "delete configure router" and not just "delete router" in the template. Later works with "configure private" but not "edit-config private" which is what the module uses to configure the device.
---
- name: Configure Nokia.
hosts: nokia-hosts
serial: 1
vars:
- ansible_network_os: nokia.sros.md
- ansible_user: "{{ SSH_USER }}"
- ansible_password: "{{ SSH_PASSWORD }}"
- ansible_command_timeout: 60
- ansible_python_interpreter: "/Users/nileshkhambal/Documents/myansible/bin/python3"
- remoteLsr: "{{ egress_lsr }}"
connection: network_cli
gather_facts: No
collections:
- nokia.sros
vars_files:
- prod-tacacs-vault.yaml
tasks:
- name: Apply Configuration from File
cli_config:
config: "{{ lookup('template', './delete_nokia_lsps_template.j2')}}"
commit: False
vars:
ingressLsr: "{{ inventory_hostname| upper }}"
egressLsr: "{{ remoteLsr| upper }}"
register: configResult
- name: Print Results
debug:
msg: "{{ configResult.diff.split('\n') }}"
from ansible-networking-collections.
Related Issues (20)
- [Py3.8] dictionary keys changed during iteration. HOT 1
- Usage of CONFIG in gNMI SetRequest() HOT 3
- Cannot use cli_command when VSR does not have license installed
- Modules fail to exucute successfully on ISAM devices HOT 11
- Automatic revert time-out when subscribers are active HOT 7
- communication fails on SROS version 21.2.R1 HOT 10
- Collection does not appear to support FQCN HOT 6
- Handling /file portion of the CLI possible? HOT 2
- cli_command does not return failed commands to ansible HOT 3
- Python package dependencies not installed when installing Galaxy collection
- Ansible Galaxy package has not been updated for 2 years
- Need custom "origin" support for Cisco devices
- admin save config doesn't seem to work in classic mode
- Generated pb2 file is incompatible with newer protobuf versions
- network os nokia.sros.md is not supported
- cli_command etc. cannot be fully qualified HOT 2
- Please update collection!
- cli_config reply message doesn't contain INFO messages HOT 11
- ansible 2.10 No module named 'ansible.module_utils.network' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-networking-collections.