Creating your first Linux or macOS Project
Let’s learn by example.
Throughout this tutorial, we’ll walk you through the creation and running of an automated process.
It’ll consist of three parts:
Design
Plan
Run
We’ll assume you have Attune installed already. This tutorial is written for Attune v23.7.3 targeting a Linux or macOS machine.
Note
If you’re having trouble going through this tutorial, please head over to the Getting Help section.
Part 1 - Design
Create a project
In the Attune application, navigate to the Design workspace and create a new project.
Open the Project dropdown
Select New Project at the bottom of the list
Choose Create blank project
Enter a Project Name such as:
Linux Tutorial
Select Create
Select Switch Project
This will create and select the new Project. Verify that the new project is selected in the Project dropdown.
Create parameters
Open the Parameters drawer in the Design workspace and create the parameters listed in the table below.
Type |
Name |
---|---|
Linux/Unix Node |
|
Linux/Unix Credential |
|
Basic Node |
|
Text |
|
Close the Parameters drawer when you’re finished.
Create files
Open the Files drawer in the Design workspace and create the two files as per below.
Firstly, create a version controlled file:
Select Create File Archive
Set the Type:
Version Controlled Files
Enter the Name:
Tutorial Config
Select Create
Create a file within the file you created:
Select the root folder
./
Select Create File
Enter the Name:
config.cfg
Select Create
Select the
config.cfg
you createdEnter the code below
Tutorial Host: {node.hostname}
Tutorial User: {credentials.user}
Select Save
Secondly, create a large file archive:
Select Create File Archive
Set the Type:
Version Controlled Files
Enter the Name:
Tutorial Large File
Select Create
Drag a file and drop it on the Replace Contents section.
Close the Files drawer when you’re finished.
Create a blueprint
Create a new blueprint.
Select Create Blueprint
Set the Blueprint Name:
Linux Tutorial Blueprint
Select Create
Create the steps
Execute Linux script
Select the blueprint you created. On the step select the Create Step Option.
Type |
|
---|---|
Name |
|
Target Node |
|
Credential |
|
Note
The following script will intentionally fail to later demonstrate fixing a running job.
Script:
echo "The operation failed."
exit 1
Select Save
Note
At this point you can skip to Part 2.
Execute Linux script with responses
Select the previous step you created. On the step select the Create Step Option.
Type |
|
---|---|
Name |
|
Target Node |
|
Credential |
|
Prompt Response |
|
Script:
echo "Continue?"
read response
lowercase_string=$(echo "$response" | tr '[:upper:]' '[:lower:]')
if [ "$lowercase_string" == "yes" ] || [ "$lowercase_string" == "y" ]; then
echo "You responded: {continueTutorial}!"
else
echo "You responded: {continueTutorial}! This step will stop!"
exit 1
fi
Select Save
Tcp ping
Select the previous step you created. On the step select the Create Step Option.
Type |
|
---|---|
Name |
|
Target Node |
|
Select Save
Drag the step to the beginning of the Blueprint
Group step
Select the last step in the Blueprint. On the step select the Create Step Option.
Type |
|
---|---|
Name |
|
Select Save
Push files
Select the group step in the Blueprint. On the step select the Create Step Option. Select > Under to create the step in the group step.
Type |
|
---|---|
Name |
|
Target Node |
|
Credential |
|
Files |
|
Remote Path |
|
Select Save
Push compiled files
Select the previous step you created. On the step select the Create Step Option.
Type |
|
---|---|
Name |
|
Target Node |
|
Credential |
|
Files |
|
Remote Path |
|
Check the config.cfg file.
Mako Parameter |
Type |
Attune Parameter |
---|---|---|
|
|
|
|
|
|
Select Test Dynamic File Generation and verify there are no errors in the Mako script
Select Save
Cleanup the files
Select the previous step you created. On the step select the Create Step Option.
Type |
|
---|---|
Name |
|
Target Node |
|
Credential |
|
Script:
directory="~/attuneTutorial/"
if [ -d $directory ]; then
cd $directory
echo "Listing all files in $directory:"
ls -ltrh
echo "Displaying the contents of config.cfg:"
cat config.cfg
echo "Moving out of $directory to prepare for deletion."
cd ~
echo "Removing the directory $directory and its contents."
rm -rf $directory
else
echo "$directory doesn't exist!"
fi
Select Save
Link existing step
Select the group step in the Blueprint. On the step select the Link Existing Step Option. Select V After to link a step after the group step.
Set Step:
Linux Tutorial execute linux step
Select Link
Commit your project changes
Select Commit
Set the Commit Message:
Created Linux Tutorial Blueprint
Select Commit
Congratulations, you have created your Blueprint.
Part 2 - Plan
In the Attune application, navigate to the Plan workspace.
Create values
Open the Values drawer in the Design workspace and create the three values required for the job.
Linux/Unix Node
Select Create Value
Populate the form
Type |
Linux/Unix Node |
---|---|
Name |
{name of your device} |
IP Address |
{device IP address} |
Hostname |
{hostname} |
Domain Name |
{domain name} |
Select Create
Linux/Unix Credential
Select Create Value
Populate the form
Type |
Linux/Unix Credential |
---|---|
Name |
{name of your user} |
User |
{username} |
Select Create
Find the value and update the Password
Basic Node
Select Create Value
Populate the form
Type |
Basic Node |
---|---|
Name |
|
IP Address |
|
Hostname |
|
Domain Name |
|
Select Create
Text
Select Create Value
Populate the form
Type |
Text |
---|---|
Name |
|
Variable |
|
Select Create
Close the Values drawer when you’re finished.
Create the tree
Create the tree of your environment.
Select Create Tree
Set the Name: {environment name}
Select Create
Expand the dropdown on the first node in your tree and select Create Node
Set the Name: {device hostname}
Select Create
Create the plan
Create the plan for your tutorial job.
Expand the dropdown on the device node and select Create Plan
Set the Name:
{hostname} Linux Tutorial Job
Select Create
Select the plan you created
Add Blueprint
Select Save
Populate the Values
Parameter |
Value |
---|---|
Tutorial Node |
select the device |
Tutorial User |
select the credentials |
Tcp Ping Node |
select the ping node |
Continue Tutorial |
select |
Select Save
Congratulations, you have created your Plan.
Part 3 - Run
In the Attune application, navigate to the Run workspace.
Search for and select you Job
Select Reset Job
Select play
Fix the error
Fix the script on the failed step and resume the job.
Select the failed step Linux Tutorial execute linux step
Select Edit Step
Replace the Script with the following
echo "This step works!"
Select Save
Select Run only this step
Verify the step run successfully
Select Run job from select step
Reset the Job and archive the current logs
Review the logs for each steps then archive.
Inspect each step
Select Reset the job and archive the current logs
Select the History tab
Inspect the most recent log
Tutorial completed
Congratulations, you have completed the tutorial.