Open gmoisio opened 5 years ago
@gmoisio The support to specify custom file names is already present in JSNAPy, but is not currently supported via Ansible module: juniper_junos_jsnappy. Link: https://github.com/Juniper/jsnapy/wiki/4.-Module
Marking as an enhancement. Thanks for reporting the feature, will work on it and raise a PR.
Are there any specifics or ideas you think should be included in the feature ??
Hi, thank you for your answer.
Using the snap_file_name parameter as in JSNAPy would be great. The parameter named "devicename" is in fact the IP@ of the ansible_host in ansible/vagrant. The "prefix" parameter would be the {{ inventory_hostname }} to build a unique file name.
Thanks Best Regards
Hi, one more question please. When using JSNAPy as a module in Python, is there a way to access a field in a configuration file like this one in order to use it as a prefix for the file name? ----conf.yml----
hosts:
- device: localhost
username: root
passwd: Juniper
port: 2222
--Python code--
config_file = "conf.yml"
snapchk = js.snapcheck(config_file, <a_syntax_to_access_the_port_field>)
Thanks Regards
There is no such feature in Jsnapy, but this would be a nice feature to have. Will work on it and keep you posted.
@rahkumar651991 Can you please take a look at this ??
Hi , We have option to pass snap_file_name parameter as below.
~/ansible_release_test5/ansible-junos-stdlib/tests# jsnapy --snapcheck /root/ansible_release_test5/venv/etc/jsnapy/snapshots/test1_pre_show_system_storage.xml -f junos_jsnapy/common_config.yml -v
jsnapy.cfg file location used : /root/ansible_release_test5/venv/etc/jsnapy
Configuration file location used : /root/ansible_release_test5/venv/etc/jsnapy
Connecting to device x.x.x.x ................
Tests Included: check_storage
Taking snapshot of COMMAND: show system storage
**************************** Device: x.x.x.x ****************************
Tests Included: check_storage
************************ Command: show system storage ************************
-----------------------Performing is-lt Test Operation-----------------------
File system /.mount use less than 95%
PASS | All "used-percent" is less than 95 [ 1 value matched ]
------------------------------- Final Result!! -------------------------------
check_storage : Passed
Total No of tests passed: 1
Total No of tests failed: 0
Overall Tests passed!!!
Thanks Chidanand
Issue Type: Feature Idea Module Name: juniper_junos_jsnapy Last Master Juniper.Junos role and last Python libraries version
Using Vagrant vQFX and Ansible provisioning to simulate a network, there is an issue with juniper_junos_jsnapy module. The inventory file generated by Vagrant use a specific generated inventory_hostname for each device, but the ansible_host is the same (127.0.0.1). Difference is made with ansible_port for each device. JSNAPy use the IP address for the snap files. It's the same for each device, so we do not get the expected behavior in a simulation environment.
Is there a trick to change the way JSNAPy records the snap files names?
Thanks Regards