Ascender network quick start
This quick start walks through the minimum steps needed to run Ansible automation against network hardware from a fresh Ascender install. Greg Sowell uses a Cisco Nexus switch in his lab as the target and builds up each required piece in order: an inventory, a host group, a machine credential, a project, an execution environment and finally a job template that he launches and reviews.
Much of the value is in the explanation of why network devices need different handling. Ascender assumes a host is Linux unless told otherwise, so the video shows how to put the switch in a group whose variables set the connection to network_cli and the network OS to Cisco NX-OS, forcing local execution over SSH instead of copying scripts to the device. It also covers the ansible_host variable for hosts without resolvable names and the idea of dynamic inventory sources such as a CMDB or network monitoring system.
Because the default execution environment ships with few networking collections, Sowell adds a container registry credential and a custom execution environment, choosing to pull the image only when it is not already present. The finished job output shows the exact commands pushed to the switch and a detailed change record that would be lost with command-line Ansible.
Key takeaways
- An inventory is a list of hosts to operate against; the ansible_host variable supplies an IP when a hostname does not resolve.
- Ascender assumes hosts are Linux, so network devices need ansible_connection set to network_cli and ansible_network_os set to the device type.
- Putting devices in a group lets them inherit connection variables and lets playbooks target the group instead of listing hosts.
- Network automation uses local execution over SSH rather than copying Python scripts to the device as with Linux servers.
- Execution environments are containers holding Python dependencies and collections; a custom one adds the networking collections the default lacks.
- Job output in Ascender records every command sent to the switch and lets you click into changes for detailed history.
Questions this video answers
How do you connect Ascender or Ansible to a Cisco Nexus switch?
Add the switch to an inventory, then place it in a group with variables that set ansible_connection to network_cli and ansible_network_os to the Cisco NX-OS type. Add a machine credential with the login, bring in playbooks through a project tied to a git repository, and combine them in a job template.
What is an execution environment in Ascender?
An execution environment is a container that spins up to run a job, holding the Python requirements, dependencies and Ansible collections the playbook needs. The default one has few networking collections, so the video adds a custom image from a container registry, with a registry credential, and sets it to pull only when not already present.
Why does the first job run take longer after adding a new execution environment?
On the first launch Ascender pauses because the execution environment image is not yet on the system. It reaches out to the container registry, pulls the image, and then runs the automation. Later runs are much faster because the image is cached.
This video is part of the Ascender Pro playlist. Browse every CIQ video by product and topic.
Transcript
hey everybody I'm Greg Sowell and I'm here with another ciq demo so today I'm going to be doing a quick start guide showing you how to use the Ascender automation platform to operate against Network hosts so today I've got a Nexus switch in my lab and I'm going to be adding a VLAN to the VLAN database and then adding that VLAN to the trunk port and I'm going to show you all the steps required as quick as possible right just the necessary so I'm going to come into inventories and the last quick start guide I actually use the default inventory this time I'm going
to add one so click add add inventory most everything in here if you want to add something you just click add and go from there so I'm going to make it Network lab as the name I'm going to click save and again an inventory is just a big list of all the hosts I could potentially operate against so here I'm going to click on the host section Now You See Me manually adding these in here Nexus 9k1 which is the item's name but I could also be using something called Dynamic inventory sources or dynamic inventory scripts and that's where they reach out to something and
they pull that information in that could be your cmdb like servicenow your configuration management database or it could be like your network monitoring system that you already have right that's doing the discovery in the collection of all that information you can pull all that stuff in so I will add a special magic variable here it's ansible underscore host now if Nexus 9k was fully qualified domain name like if ansible are the Ascender automation platform whenever it's running that ansible Playbook I should say if it can resolve the name it will and it'll connect to that host and everybody's happy in my lab that isn't
fully qualified so I can add this magic variable which is variable known to ansible and it will be 10 0 50.27 and this ansible host really just says Hey whenever you're connected to this host use this IP address click save and I'm technically done right that's all I really need to do except for a caveat uh Ascender in ansible itself whatever it wants to connect to a host by default it's going to assume it's a Linux host right so it's going to try and connect to it in that capacity so I have to tell it hey you're not a Linux host I have to change
View full transcriptHide full transcript
the way it's actually connecting just slightly now I could have added some special variables to the host itself but instead I'm going to be using a group and this is a really good utilization for groups I'll name it Nexus right here in the group and then I'll paste in those additional variables so groups allow you to put a whole lot of hosts inside of a group and instead of adding them all in my playbook one after another you know comma separated I can just put the group name so it makes it really easy to operate against a chunk of host so imagine you have an
application and you're moving host in and out of that group all the time I don't to keep track of what the hosts are I just hit the group name but groups also allow me to add special variableized information just for those hosts right they're going to inherit this so first I have to tell it ansible connection is ansible net common Network CLI so I'm telling you it's Network CLI right so interface with this device as if it was you know like you on the terminal like SSH again is something and and smacking away at the keyboard so if you will imagine for a second most
Linux servers what it's going to do is Ascender will call an execution environment it'll spin up it'll connect to say the Linux server it'll copy over files that will get executed over there right that's called remote execution we're doing local execution here because it's a network device it doesn't necessarily run python we can copy scripts over so we're going to be SSH again so this line right there tells it to do that next I need to tell it what flavor of network device it is and here it is Cisco nxos and xos right so you're really you're telling it one hey this is a
network device and then two what language to speak right is it French Portuguese English Mandarin right and so here it's Nexus iOS junos you know Arista OS you know it's you're really just telling it how to communicate with that device now that I've belabored that point I'll click save and then I will go to the host section and I will add an existing host I'll put my Nexus 9k1 in there so now whenever I connect to it it's in this group and it will automatically inherit those variables and we're able to connect that's one of the biggest stumbling blocks I think people kind of run
into when they are first trying to operate against networking devices next we need credentials so how are we actually going to log into this device and we'll call it uh Network lab credential and it's going to be type machine so most networking devices as well as your servers whether windows or Linux are going to use a machine credential to connect into it and mine is very secure password admin and lab and I will click save there now we've got a credentials so we've got the inventory list of all the hosts we can operate against we've got a credential now we actually need to bring our
playbooks in and we're going to do that via the project section so project really just ties Ascender into a get repository right so that it can pull all those playbooks all those template files right all the source material you need to operate your automation so this one is going to be uh we'll call it Nexus ACL I would encourage you to use descriptions be as verbose as you can on all this stuff with good descriptions anybody who comes in after you is going to kind of better understand what's going on so be a good admin don't be like me I'm trying to go as fast
as possible so I'm skipping those but Source URL I'm going to put in my public git repository I'm going to paste that right in there if you actually did have it in a private repo you could use the source credential right there it'll pull all that good stuff in I'm going to click save on this and as soon as I save it's going to go into this waiting State and then it will move over to a synchronizing State what that's really doing is it means it's oh I'm connecting to that repository and I'm pulling all those files down so next thing I'm going to do
is add an execution environment into the system so let's start by answering what is an execution environment so really it's just a container that gets spun up that has your python requirements all the dependencies in there as well as the collections you need and so by default the execution environment that comes with here doesn't have a whole lot of networking collections baked in so I've created one that's got a whole bunch of different stuff if you don't see one up and available from us I would look for it but I'm willing to bet you'll see one soon if it's not already there but let's walk
through the process of adding one in so first I'm going to add a credential and I need to add a credential for my execution environment it's really what it's going to do is it's going to connect to the container repository so EES really just being containers have to be stored in a container repository I'm going to set mine up really quick it's more or less um you give it a name you tell it the type container registry I'm going to fill all my information in here but I'm going to hide it from you and we'll be back in just a second all right now that
I have my credential for my container registry setup I'm going to actually add the execution environment in and that's done by going down here to Administration and execution environments so I'm going to click add I'm going to give it a name I'm going to name it Network ee for execution environment next I'm going to paste in the image but before I do that I'm going to say only pull the image if not present before running right so there's three options here always pull container before running that's going to slow things down because it's always going to be yanking that new container this one says never
pull so it's only going to pull when you manually refresh this thing and I want to say only pull the image if not present before running which will say if I update the image name in here with a new revision number if it doesn't already exist in here then it'll go ahead and pull right to me that's kind of the the best of all those worlds next I'm going to choose registry credential I've got my network ee right here and I'm going to put my image in again I'm going to hide this from you folks but I'll be back in just a moment now that
I have the execution environment created you can see network ee right here I'm going to bring it all home by creating a template so let's go to template section I'm going to click add and add job template next I'm going to give it a meaningful name and we are doing Nexus 9k1 ACL right because that's pretty much what we're doing next I'm going to specify my inventory Network lab that's what we're operating against project remember our git repository we're pulling everything in Nexus ACL next I'm choosing my execution environment it is the network EE inside of that project normally I would have to choose which
Playbook I want to run but as it so happens this this project or this git repository only has one playbook in there so we'll choose that one next credentials how we're going to log into this device Network lab select save and guess what I get to do now is Click launch now again on my very first launch because this is a brand new execution environment it's going to take a little bit longer because what it does is it pauses and says oh I can't execute this automation because the ee is not here yet so it's going to reach out to my container registry it's going
to pull it in it will uh then kick up my Automation and process everything so through the wonders of editing I'm not going to make you wait on that we'll come back when it's complete all right now the job has run and subsequent runs will be again much faster because it's got that ee cached but you could see everything that happened in here so I can see changed on this event and I've got a debug statement here when a debug really is just spitting stuff out the screen and it says if there was a change before show me all the commands you actually used you
know on this device this switch this router would happen to be to make that adjustment it's really cool so if you're accustomed to seeing command line ansible right you're normally seeing this information but you get it once and you never get to do anything else with it right it's very ephemeral whereas here I can actually click on change right there and it shows me very detailed output of everything that it happened inside of here right so the very first thing did I broke it into a data model and then I took that data model and I push it in Via these commands right here so
you can see that we got up and moving with a network device pretty quick if you have any ideas of how you would use this environment you would change it you would tweak it you would tune it please reach out to us we love comments if you can think of some playbooks that you would have baked in we as you saw maybe when we went to the job template section we already have a big chunk baked in there we're always looking to add new ones so let us know what that would look like if you are interested in the product itself and maybe purchasing please
contact us if nothing else happy ascending happy networking happy adjusting your ACLS and we'll see you next time bye
Built for scale. Chosen by the world’s best.
2.75M+
Rocky Linux instances
Being used world wide
90%
Of fortune 100 companies
Use CIQ supported technologies
250k
Avg. monthly downloads
Rocky Linux
9
Enterprise products
Spanning the kernel to the orchestrator
Have questions about your infrastructure?
Talk to a CIQ engineer about Rocky Linux, HPC, and AI infrastructure.
