Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-11-2019, 10:58 AM
never2spicy never2spicy is offline
Registered User
 
Join Date: Dec 2019
Posts: 16
Post Need help exporting my SecureCrt device list into ansible inventory

Trying to take my secure cry device list and import it into ansible so i can start doing playbooks. My device list is thousands long so doing this manually is not feasible. Any help on this would be greatly appreciated.
Reply With Quote
  #2  
Old 12-11-2019, 11:25 AM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,004
Quote:
Originally Posted by never2spicy View Post
Trying to take my secure cry device list and import it into ansible so i can start doing playbooks. My device list is thousands long so doing this manually is not feasible. Any help on this would be greatly appreciated.
I'm not yet familiar enough with ansible or related playbooks to know what's required...

What format does ansible allow, or what format do you need the data exported in order for it to be imported easily into ansible?

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #3  
Old 12-11-2019, 12:58 PM
never2spicy never2spicy is offline
Registered User
 
Join Date: Dec 2019
Posts: 16
Ok let me simply my request. Id like to take my xml exported of sessions and extract from that the session folder groups and hostnames. So if data center 1 and 2 that have 3 routers each Id like to dump that to something like this:

[data center 1]
hostname 1
hostname 2
hostname 3

[data center 2]
hostname 4
hostname 5
hostname 6
Reply With Quote
  #4  
Old 12-11-2019, 05:13 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,004
never2spicy,

You've already engaged by email with our associate, Brenda, so you already know that we've created a feature request for a way to limit/select what gets exported using SecureCRT's Tools > Export settings... feature.

I don't have any ETA as to when or if such functionality might become available in SecureCRT. But in the mean time, there is an example we link to in the Script Examples "Sticky" that shows how you might be able to iterate over saved sessions and create yourself either a CSV output file, or a .conf/INI file format that might help you get close to what you need for your purposes.

The examples are only provided as a starting point for you to take and run with for creating your own personal custom solution.

Good luck with your scripting efforts!

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #5  
Old 12-13-2019, 10:48 AM
never2spicy never2spicy is offline
Registered User
 
Join Date: Dec 2019
Posts: 16
First off Thank you for the input Jake. I cant stress this update is needed URGENTLY as this is a total more and more will be used with Ansible.

If I may Id like to give some specific input on what I'd like to see that i think would make this a super powerful tool that would pair what I believe is the best CLI tool for neteng with the bets automation tool for neteng. That said theres what I think would be powerful:

Following ansibles documentation here (https://docs.ansible.com/ansible/lat...inventory.html) the ability to export a format in yaml with
multiple groups so that
- all hosts are in the "all:" section for global changes
- folder structure exported with all sub folders as below
- all hosts under folders exported for hostname field (even if just ip)
- preserving the port as a host variable on the tree.

That said this is what the before an after should look like:


<key name="Sessions">
<key name="CzechRep">
<key name="CORE">
<key name="EULCR-CZH-EDLFSW02 - 10.197.212.13">
<dword name="[SSH2] Port">22</dword>
<string name="Hostname">10.197.212.13</string>
</key>
<key name="EUNCR-CZH-EDLFSW01 - 10.197.212.12">
<dword name="[SSH2] Port">22</dword>
<string name="Hostname">10.197.212.12</string>
</key>
<key name="EUNCR-CZH-SPSW01 - 10.197.212.10">
<dword name="[SSH2] Port">22</dword>
<string name="Hostname">10.197.212.10</string>
</key>
<key name="EUNCR-CZH-SPSW02 - 10.197.212.11">
<dword name="[SSH2] Port">22</dword>
<string name="Hostname">10.197.212.11</string>
</key>
</key>
<key name="OOB Stack">
<key name="10.197.212.44">
<dword name="[SSH2] Port">22</dword>
<string name="Hostname">10.197.212.44</string>
</key>
<key name="EUNCR-CZH-TS01 - 10.197.212.34">
<dword name="[SSH2] Port">22</dword>
<string name="Hostname">10.197.212.34</string>
</key>
<key name="EUNCR-CZH-TS02 - 10.197.212.35">
<dword name="[SSH2] Port">22</dword>
<string name="Hostname">10.197.212.35</string>
</key>
</key>
<key name="RACK XXX">
<key name="EUNCR-CZH-ACLFSW01 - 10.197.212.14">
<dword name="[SSH2] Port">22</dword>
<string name="Hostname">10.197.212.14</string>
</key>
<key name="EUNCR-CZH-ACLFSW02 - 10.197.212.15">
<dword name="[SSH2] Port">22</dword>
<string name="Hostname">10.197.212.15</string>
</key>
<key name="EUNCR-CZH-ACLFSW03 - 10.197.230.16">
<dword name="[SSH2] Port">22</dword>
<string name="Hostname">10.197.212.16</string>
</key>
<key name="EUNCR-CZH-ACLFSW04 - 10.197.230.17">
<dword name="[SSH2] Port">22</dword>
<string name="Hostname">10.197.212.17</string>
</key>
<key name="EUNCR-CZH-ACLFSW05 - 10.197.230.18">
<string name="Hostname">10.197.212.18</string>
</key>
<key name="EUNCR-CZH-ACLFSW06 - 10.197.230.19">
<dword name="[SSH2] Port">22</dword>
<string name="Hostname">10.197.212.19</string>
</key>
</key>

all:
hosts:
10.197.212.13: 22
10.197.212.12: 22
10.197.212.10: 22
10.197.212.11: 22
10.197.212.44: 22
10.197.212.34: 22
10.197.212.35: 22
10.197.212.14: 22
10.197.212.15: 22
10.197.212.16: 22
10.197.212.17: 22
10.197.212.18: 22
10.197.212.19: 22
CzechRep:
CORE:
hosts:
10.197.212.13: 22
10.197.212.12: 22
10.197.212.10: 22
10.197.212.11: 22
OOB Stack:
hosts:
10.197.212.44: 22
10.197.212.34: 22
10.197.212.35: 22
RACK XXX:
hosts:
10.197.212.14: 22
10.197.212.15: 22
10.197.212.16: 22
10.197.212.17: 22
10.197.212.18: 22
10.197.212.19: 22

That said thanks again. I really hope to hear this feature is ready and perhaps has even more options in the near future.
Reply With Quote
Reply

Tags
ansible , automation , export


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 07:31 PM.