How AutoKey can make repetitive tasks, like configuring Netplan, easier

3 years ago 342

AutoKey is simply a useful GUI instrumentality that tin instrumentality the repetition retired of a batch of your regular Linux admin tasks.

linux.jpg

Image: jivacore/Shutterstock

I person a batch of repetitive tasks I bash passim the day. For example, I person to benignant retired the aforesaid agelong header for articles regularly. At 1 point, I saved a record that contained the header contents but realized utilizing it caused maine other clicks, each of which amounted to making my time a spot little efficient. There are besides the Netplan configurations I marque daily. I often deploy Ubuntu Server arsenic a virtual machine, and having to ever configure networking is conscionable 1 much measurement I don't privation to person to take.

How to go a web administrator: A cheat sheet (TechRepublic)

That's wherefore I employment a small Linux instrumentality called AutoKey, which is simply a GUI exertion for creating boilerplate substance files and much analyzable macros that tin beryllium utilized for conscionable astir anything. Once you've created a caller "phrase" you tin delegate the operation a hotkey. With the operation complete, each you person to bash is deed the hotkey and the operation is past added to the papers you are using.

AutoKey besides allows you to make "scripts," which are much precocious options that let you to bash things similar unfastened applications/files/folders, power model and rodent events, show paper entries to prime from, and different things.

I'm going to amusement you however to instal AutoKey connected a Debian-based organisation and past locomotion you done however to make a operation that volition paste the contents of Netplan into an unfastened file.

What you'll request

To marque this work, you'll request a moving lawsuit of a Debian-based Linux desktop (I'm utilizing Pop!_OS 21.04) and a idiosyncratic with sudo privileges. That's it. Let's marque immoderate desktop magic.

How to instal AutoKey

AutoKey tin beryllium recovered successful the modular repositories. There are 2 editions: A GTK and Qt variant. Which you instal volition beryllium connected the desktop situation you are using. For instance, if your desktop of prime is GNOME, you'll instal the GTK mentation of AutoKey. If, connected the different hand, you usage KDE, the Qt mentation is what you want.

To instal the GTK mentation of AutoKey, unfastened a terminal model and contented the command:

sudo apt-get instal autokey-gtk -y

To instal the Qt version, the bid is:

sudo apt-get instal autokey-qt -y

Once the installation is complete, you'll find an AutoKey introduction successful your desktop menu. Launch the exertion and past acceptable it to tally astatine footwear by clicking Edit | Preferences and past click the checkbox for Automatically commencement AutoKey astatine login (Figure A).

Figure A

autokeya.jpg

Configuring AutoKey to tally astatine start.

How to make your archetypal operation

We're present going to make our archetypal operation that volition paste the contents for a Netplan web configuration (so you don't person to ever retrieve the layout oregon benignant it retired manually). From the AutoKey window, click the New drop-down and prime Phrase. In the popup, springiness the operation a sanction (such arsenic NETPLAN) and click OK. 


With the caller operation created, you'll past adhd the contents of your Netplan record successful the precocious close pane (Figure B).

Figure B

autokeyb.jpg

Adding the contents for a Netplan configuration into AutoKey.

With the Netplan contents successful place, it's clip to delegate a hotkey. In the Phrase Settings pane, click the Set fastener associated with Hotkey. A caller model volition popular up (Figure C). Click Press to Set.

Figure C

autokeyc.jpg

Setting a hotkey operation for our caller phrase.

You volition past benignant the cardinal operation you privation to usage for the phrase. Once you've done that, property OK to adjacent the popup. Finally, click Save and your operation is acceptable to go. 

How to usage a caller operation

At this point, unfastened a transportation to a recently deployed Netplan-enabled server, unfastened the netplan configuration (or make a caller one), and past deed the recently created hotkey to person the contents of the operation pasted into the file. You'll astir apt request to change the IP code for the configuration, but you won't person to either retrieve the YAML configuration for netplan oregon benignant retired the full configuration manually.

At this point, you're astir apt asking yourself, "How did helium SSH into that virtual instrumentality if networking hasn't been already configured?" The mode I enactment this is to make a reasonably modular virtual machine, with a basal moving web configuration. I past clone the basal instrumentality (knowing the default IP code I've acceptable successful the basal configuration), SSH into that machine, and change the Netplan configuration arsenic needed. 

This is conscionable 1 of the galore ways you tin usage AutoKey. I've recovered this instrumentality to beryllium invaluable for helping marque my time a spot much efficient. Give AutoKey a effort and spot what clever usage cases you tin travel up with for the tool.

Subscribe to TechRepublic's How To Make Tech Work connected YouTube for each the latest tech proposal for concern pros from Jack Wallen.

Open Source Weekly Newsletter

You don't privation to miss our tips, tutorials, and commentary connected the Linux OS and unfastened root applications. Delivered Tuesdays

Sign up today

Also spot

Read Entire Article