– A Reusable Module for Accessing Cisco Devices with Python

For one reason or another, Python seems to have been my go to scripting language of choice recently. One of the things that I’ve been working on is creating a reusable python library for accessing Cisco devices via telnet. It’s pretty basic code right now, but I’ll be expanding upon what I have soon and will be sharing via as well. For now, here is my simple library.

Usage is pretty simple. You need to specify a username, password, enable password, and host variable. To activate the module. The easiest way is to do it within the your python script.

Of course, the module also has options to specify a authentication file (credsFile(authfile)) or prompt prompt for your credentials (getCreds()). At the moment, the script only runs a ‘show arp’ on your devices. I’m still working on how I want to implement feeding commands to your devices. I’ll post an update as I get more functionality working.

Share on FacebookTweet about this on TwitterShare on LinkedInShare on RedditEmail this to someone

February 17, 2014

Posted In: Cisco Administration Python Scripting, Python Tips

Quick intro to Puppet

I’ve been using puppet for a while to automate several things within the Linux servers that I manage. It’s also one of those things that if I don’t use it in a while, I forget it. So, I’m going to do a quick run through of registering a puppet agent with a puppet master. I’ll also show some of the things that every Linux install gets pushed, aka the default settings.

Here is my default manifest that every system gets:

The first thing that I do is install puppet on the new agent (client) node.

Next, I’ll modify the /etc/hosts file and /etc/sysconfig/puppet file to specify my puppet master (puppet server).

After that, I need to generate a ssl cert from the puppet agent to the puppet master.

When the key has been generated, hop on the puppetmaster server and sign the key.

Now hop back onto the puppet agent and test the newly sign certificate. If all is good, it should push your default config to the server. For brevity, I’ll leave out the output of everything that it set up.

Finally, the last thing to do is start the puppet service, on the agent, and verify that its running.

Now you should have a fully functional puppet installation. Now you can create puppet manifests to automate your server(s) even more!

Share on FacebookTweet about this on TwitterShare on LinkedInShare on RedditEmail this to someone

February 10, 2014

Posted In: Linux, Puppet