First Automation
There are basically 4 steps to start automating with sysopswork:
Create a Master Key (done just once, after sysopswork installation)
Register Object(s) (done once per object)
Persist Encrypted Object Credentials (done once per object)
Run Automation Script (as many times you need without repeating steps 1 through 3)
Before we start, let me briefly explain some key aspects of sysopswork automation:
The Master Key is the one password used to lock and unlock credentials when your automation script is running. ( more details @ Objects )
Object is any infrastructure component you connect to implement commands, such a Linux OS, a network device, etc. ( more details @ Objects )
The Automation Script is the set of instructions you provide to sysopswork to automate implementations. Once the script is provided, sysopswork takes care of the rest. ( more details @ Automation Script )
Preparation
For this automation, we will implement a web server (using nginx) in an instance of Ubuntu Linux. If you don’t have a Linux machine (either physical or virtual) ready to use, below you can find easy step-by-step instructions to quickly spin up one in Microsoft Azure free of charge (considering you don’t have an account yet past trial period or ran out of credits).
Notice that you can choose any other cloud provider, if you prefer. Or have the Ubuntu machine running on a virtual machine or a bare metal physical box.
To create a free account on Microsoft Azure, follow the steps below:
After you click on sign up, Microsoft will let you know once your account is ready to be used.
If you got a page with the message “You’re ready to start with Azure”, click on “Go to the Azure portal”.
Now, we will create an Ubuntu VM on Microsoft Azure with the following steps (the options used below consider you are using a new account. If that is not the case, adjust accordingly):
Azure will take some time to create the Linux VM. Wait until you receive a confirmation that the deployment succeeded and is complete.
Before we proceed with sysopswork, it is a good practice to test reachability to the object (in this case the Ubuntu machine) that we are going to automate.
At Step 8, a key file (with extension .pem) has been downloaded to your computer. Locate this file (likely to be at your user’s Downloads directory), and move it to sysopswork directory. Rename it to “key.pem” to follow the examples. Open your Command Prompt (on Windows) or Terminal (on macOS or Linux), and navigate to sysopswork directory. If you computer is running macOS or Linux, enter the following command (not applicable to Windows):
chmod 400 key.pem
Now, try to connect to the Ubuntu machine by running the following command (replace a.b.c.d by the Public IP address you took note from Step 10):
ssh -i key.pem -l azureuser a.b.c.d
Once connected to the Linux VM shell prompt, just leave the SSH session it with:
exit
After you run the automation, we provide instructions to delete this virtual machine at the very bottom of the page. Don’t do it, until you complete with the tests.
Running the First Automation
Assuming you already downloaded sysopswork and unzipped the file, and that you also have your Ubuntu Linux ready to be used (as explained on previous section). You need to have the IP address of the Ubuntu Linux in hand when registering the object.
Step 4. From Windows Command Prompt, to create a Master Key, run:
sysopswork -K
Or from macOS/Linux Terminal, to create a Master Key, run:
./sysopswork -K
Step 5. From Windows Command Prompt, register the Ubuntu Linux as an object by using:
sysopswork -o ubuntu
Or from macOS/Linux Terminal, register the Ubuntu Linux as an object by using:
./sysopswork -o ubuntu
key
and hit Enter. If you are using username and password, you can hit Enter, as this is the default login mode.Step 6. From Windows Command Prompt, persist Ubuntu Linux credentials with the command:
sysopswork -c ubuntu
Or from macOS/Linux Terminal, persist Ubuntu Linux credentials with the command:
./sysopswork -c ubuntu
azureuser
, and when asked to enter the key file path, simple enter the key filename key.pem
, considering the file is located at sysopswork main directory.Step 7. From Windows Command Prompt, run the sysopswork command and indicate which automation script to use:
sysopswork first_script.txt
Or from macOS/Linux Terminal, run the sysopswork command and indicate which automation script to use:
./sysopswork first_script.txt
That’s it! You ran your first sysopswork automation! Now you can explore what sysopswork can do for you throughout the next pages.
Post Automation
If you provisioned an Ubuntu VM using the Microsoft Azure example we provided, below are the steps to delete it once you are done experimenting with it:
Once the VM is deleted, it will no longer show at the Virtual machines page.