Ascender Pro videos

5 automation tips from Greg Sowell

Greg Sowell opens a new series in which automation practitioners share five favorite tips, and he starts by offering his own. The advice ranges from general working habits to specifics of writing Ansible playbooks for Ascender, so it suits newcomers as well as seasoned automators looking for a quick sanity check on how they work.

His first two tips are about process. Writing the steps of a task down as pseudocode before automating it keeps the work on track, surfaces new things worth automating, and helps team collaboration. Reviewing the ticket queue or project board once a month, then picking the single most time-consuming item to automate next, gives a steady cadence for adding automations.

The remaining tips are hands-on. He declares all variables in a vars section at the top of each playbook as a form of built-in documentation, sets gather_facts to false by default to avoid breaking network hosts and to save processing time, and urges viewers to sanitize and publish their playbooks so the wider community benefits. The video closes with an invitation for others to contribute their own five tips.

Key takeaways

  • Write out the steps of a task as pseudocode before automating it; it keeps you on track and reveals new automation candidates.
  • Once a month, review your ticket system or project board and pick the most time-consuming task to automate next.
  • Declare every variable with a default in a vars section at the top of a playbook so it doubles as documentation.
  • Set gather_facts to false by default; fact gathering breaks playbooks on network hosts and adds time when the data is unused.
  • Sanitize internal playbooks and publish them to a public git repository; sharing also makes it easier to ask others for help.

Questions this video answers

Why should you turn off gather_facts in Ansible playbooks?

Fact gathering connects to each host and collects variableized information, which is useful but not always needed. Running it against a networking host will generally break the playbook, and on Linux hosts it adds processing time for every connection when the data goes unused. Setting gather_facts to false by default makes playbooks more efficient.

How do you find new tasks worth automating?

Sowell recommends a monthly review of whatever tracks your work, such as a ticket system or Jira board. Look at what consumed the most time, pick one recurring task from that list, and pseudocode it as the next automation, then repeat the cycle each month.

This video is part of the Ascender Pro playlist. Browse every CIQ video by product and topic.

Transcript

hey everybody I'm Greg Sol and I'm here with something new so I am going to be asking a bunch of experts in automation to give me some tips and tricks well I say some I'm going to be asking for five now this could be something from newbie to maybe a little bit more seasoned maybe to an expert so it should be different from every individual and I'm just going to start with myself so the uh the the top five that I have here and this is in no particular order but right now number one I'm saying write down your process often referred to as

like pseudocoding right so the idea being there's something I want to automate I'm hopefully in a subject that are expert in that thing but often to to kind of figure out all the steps to keep me on track what I'll do is I'll just open up you know a document like a like a Google doc or maybe uh uh notepad plus plus or whatever it happens to be if I'm in vs code Studio I can open that up and I'll really just write down line by line kind of all the steps required to do this thing and I like doing it uh kind of like

Loosely like that as opposed to trying kind of to write my automation just as I go very slowly because oftentimes when I'm doing that I get a little bit too mired down in the minutia and I'll kind of skip steps and so it's a little bit easier for me to to kind of see what's going on now it's also really good for kind of discovering new processes to automate like if there is something that we do that we wouldn't traditionally think about automating it maybe just kind of writing down the little pseudo code steps actually we can say oh you know what we could automate

that and that and this and maybe we could automate you know it's good for like team collaboration as well so that's that's kind of my number one all right that leads us to number two so I'm gonna be looking at how do I add some new automations kind of at a regular Cadence and so what I recommend people doing is once a month right you don't have to spend a ton of time on it maybe just the the first of every month take uh take a little bit of time maybe you yourself or maybe your team together look at your ticket system or your jira

View full transcriptHide full transcript

board or whatever it is that you guys are using to like run through projects and then just look at what consumed the most time right like so if it is a ticket system what were the most tickets you process like what did they kind of relate to and then start reviewing is this something we can automate right like pick one thing from that list usually something that's occupying most of your time and see if you can automate that task right and then kind of loop that back to step one and and pseudocode that thing right it's a really good way to discover and add new

automations to your environment number three I'm gonna say is to in your playbooks so I'm an ansible guy I've been using ansible for a long time right and so a lot of my tips around ansible or Ascender right kind of the automation platform to to execute those things on but I like putting my variables at the top of my playbook so oftentimes in your tasks in your playbook you're going to have variableized information kind of all over the place and most often those variables are going to be coming from you from when you execute you're sending in extra variables and it's going to override those

things what I like to do is at the very top I like to create a vars section and I like to add all the variables uh in there that you know and I'll set a default value even if it's not the one I'm going to use I like to have them all up there that way they're kind of it's sort of like documentation piece right I can see everything that's in there so I know what's available to me so when I'm gonna reuse this Playbook say I haven't touched it in six months I'm going to reuse this Playbook I can easily right at the top

I can see all the very variables I've defined and have them ready for replacement right so I can easily know in my playbook all right well I'm going to replace this variable this variable this variable I don't actually have to kind of dig around right keep it all in one place number four is again very ansible specific and for me I uh by default at the top of my playbook I guess under the host section I put gather facts colon false and so by default your playbook is designed to gather facts which is to connect to your Linux server infrastructure and gather a bunch of

information that's already variableized and it's really cool and you can use in your automations and it's really neat the only problem is say you're running on um well for example a networking host generally if you're going to run gather facts on a networking host it's going to break your playbook so you want those off by default there I tend to do a lot of network automations which is is really how I got used to doing that but also learned if you're not using the gather fax information right like so I am operating against Linux hosts in this example right if I'm not using any of

that variabilized information it adds a little bit of processing time for every host I'm going to connect to right so if I go ahead and turn that off knowing I'm not using it if I turn that off it'll make my playbooks just a little bit more efficient number five is kind of a big one for me and it's something I've done for the vast majority of my career not just in automation but in kind of other aspects and that is share your work right I'm a big proponent of sharing your work open source put those things out there even if you're not writing code remember

open source is more than just code right it's it's sharing examples it's education it's documentation it's all of those pieces right so if you're writing playbooks and they are say internal to your company if you do find a novel an interesting way of writing those playbooks if you could make them a little bit more generic sanitize them a bit and then put them up in a public git Repository that's amazing right it's going to help the community it's going to help other people and also I've learned that like for me it's hard to ask other people for help I think that's a very human thing

but also I've learned that if I start sharing my work it makes it a little bit easier for me to ask others for help because you know what I'm already I'm already helping others I'm already trying to to reciprocate right and trying to trying to do that kind of pay it forward sort of thing so not just sharing your work but also offer to help if you have the time and inclination and uh keep in mind you don't have to know everything right you have to remember that there are some people that are beginners right it may have been so long that you forget it

maybe you feel like you don't have anything to contribute but you do so be sure to offer to help well I'll tell you what those are my five quick tips told you it was gonna take very long if you have any questions uh for me or comments or anything associated with that or you know you would actually like to be a guest and do a quick five uh five automation tips we'd love to hear from you if you have any questions about Ascender or automation obviously we'd love to talk to you about that as well so feel free to reach out if nothing else happy

uh automating 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.

Talk to an Expert