ansible-junos-stdlib
ansible-junos-stdlib copied to clipboard
juniper_junos_jsnapy issue with Vagrant vQFX
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
@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 ??