Hi Vyacheslav,
I have been toying around with Device Templates, CLI configlets and commit/local scripts in Space quite often. I have found that CLI configlets just aren't there yet for doing a lot of configuration.
For what you are specifically looking at doing (configuring devices based on information already there), then there is a way that CLI configlets could help. You'd have to go about it over a couple of steps:
- Create an Xpath (or Regex) search context which would basically look for the information in each device that you are trying to make the changes around.
- You can then reference that search context by creating a parameter for the values you want once you create your CLI configlet.
I would recommend though that you take a look at using a commit or "local script," if you will, within Junos Space. I use this method for when I need to make a lot of on-the-fly changes to multiple devices (we have ~500 SRX's within our Space implementation). See for example the attached script.
I searched through the config to grab the host name and the IP address of the loopback interface (lo0.0). I tweaked the host name to my liking, and then set my loopback address to be the source for my logging.
You have to make sure that you set the /* ISLOCAL = "true" */ parameter at the top of your script, just like in mine in order to be able to run it from Junos Space. I found the best way was then to create an "Operation" which uses said script to then run against multiple devices.
There is some good documentation on Juniper's TechWiki site about this as well. I strongly advise taking a look at it 🙂
Feel free to send me a private message, email me, or hit me up on Twitter if you would like any more help!