Skip to content

Manage Workflows

What are Workflows?

A workflow in n2x.io is a sequence of automated tasks executed on a specific node. You define these tasks in a YAML file, specifying what you want to automate, when it should run, and where it should run. This allows you to manage your infrastructure efficiently and consistently.

Benefits of Workflow Automation

  • Reduced Manual Work: Eliminate repetitive tasks and free yourself for more strategic initiatives.

  • Increased Consistency: Ensure the same steps are followed every time for reliable results.

  • Improved Efficiency: Automate tasks to save time and effort.

Defining Workflows in YAML

In n2x.io, you configure automation workflows by applying a configuration from a YAML file.

Here's a breakdown of a basic workflow configuration file:

Field Description
apiVersion Defines the version of the API to use (e.g., v1).
kind Specifies the type of object. For workflows, use Workflow.
projectID The unique identifier of the project to which this workflow belongs. Replace with your actual ID. View project details
description A brief explanation of the workflow’s purpose. Helps with documentation and maintenance.
name A unique and descriptive name for your workflow.
enabled Set to true to activate the workflow; false to disable it.
triggers Defines the conditions that start the workflow. For example, a cron expression can run the workflow every 5 minutes.
tasks A list of tasks to execute. Each task should include a name, description, and a command to run.
targets Specifies where the workflow will run. Include tenantID and nodeID. Replace these with your actual values. View tenant details Β· View node details

Example

This example demonstrates a workflow running the uptime command every 5 minutes:

# n2x.io workflow
apiVersion: v1
kind: Workflow

projectID: <Replace with your ProjectID>

name: workflow
description: Workflow sample.

enabled: true

triggers:
  schedule:
    enabled: true
    crontab: "*/5 * * * *"

tasks:
  - name: uptime
    description: uptime command
    command:
      cmd: /usr/bin/uptime

targets:
  - tenantID: <Replace with your TenantID>
    nodeID: <Replace with your NodeID>

GitHub Integration for GitOps

Enable GitOps by integrating n2x.io with GitHub for managing workflows through version control.

Workflow Configuration Reference

Provides detailed information about all available configuration parameters for workflows.

Create a Workflow

Warning

Only Account Administrators or Admin Users can manage workflows.

You only can create a workflow in your project using CLI (n2xctl):

To create a new workflow, you'll need a YAML configuration file (see Defining Workflows in YAML). Once you have your configuration file ready, use the following command:

n2xctl ops workflow create -f <yamlFile>

Note

Replace <yamlFile> with the path to your YAML configuration file.

$ n2xctl ops workflow create -f workflow.yml
n2xctl v0.0.3-20240725171430+88c4863--go1.22.5

n2xctl is a CLI to control the n2x SASE platform.

Find more information at https://n2x.io/docs

Β» Tenant: [demo] Demo tenant
Β» Project: demo
                                                 ───── Ops: Workflow Details ≑
════════════════════
Workflow Information
════════════════════

Tenant ID           xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Project ID          xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Workflow ID         xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx    
Name        workflow                                
Description Workflow sample.                        
Enabled     [yes]                                   
Reviewed    [yes]                                   
Approved    [yes]                                   

Triggers
────────

Workflow Webhook    [disabled]  

Workflow Crontab    [enabled]   */5 * * * * 

Tasks
─────

Task Name   Command         Args    UID GID 
---------   -------         ----    --- --- 
uptime      /usr/bin/uptime         0   0   

Targets
───────

Tenant  Node                                
------  ----                                
demo    client-b                            

Activity
────────

Successful Events   0000000                         
Failed Events       0000000                         
First Activity      1970-01-01 01:00:00 +0100 CET   
Last Activity       1970-01-01 01:00:00 +0100 CET   
Activity Index      0.0000                          
Failure Probability 0.00%                           
Score               0.00                            
Resource Rating     [n/a]  

Update a Workflow

Warning

Only Account Administrators or Admin Users can manage workflows.

You only can update a workflow in your project using CLI (n2xctl):

To update a workflow, you'll need:

  1. Determine the workflowID of the workflow you want to modify (See Show the Workflow Details)
  2. Update your workflow's YAML file as needed (refer to Defining Workflows in YAML in YAML for details).
  3. Add workflowID field in your workflow's YAML file.

    ...
    projectID: <Replace with your ProjectID>
    workflowID: <Replace with your WorkflowID>
    ...
    
    4. Execute the following command:

    n2xctl ops workflow update -f <yamlFile>
    

    Note

    Replace <yamlFile> with the path to your YAML configuration file.

$ n2xctl ops workflow update -f workflow.yml 
n2xctl v0.0.3-20240725171430+88c4863--go1.22.5

n2xctl is a CLI to control the n2x SASE platform.

Find more information at https://n2x.io/docs

Β» Tenant: [demo] Demo Tenant
Β» Project: demo
Β» Workflow: workflow
                                                 ───── Ops: Workflow Details ≑
════════════════════
Workflow Information
════════════════════

Tenant ID   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Project ID  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Workflow ID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Name        workflow                            
Description Workflow sample.                
Enabled     [yes]                                   
Reviewed    [yes]                                   
Approved    [yes]                                   

Triggers
────────

Workflow Webhook    [disabled]  

Workflow Crontab    [enabled]   */5 * * * * 

Tasks
─────

Task Name       Command             Args    UID GID 
---------       -------             ----    --- --- 
kernel-version  /usr/bin/uname    -r      0     0   

Targets
───────

Tenant  Node                                
------  ----                                
demo    client-b                            

Activity
────────

Successful Events   0000006                             
Failed Events       0000000                             
First Activity      2024-07-30 17:50:00.546 +0200 CEST  
Last Activity       2024-07-30 18:15:00.457 +0200 CEST  
Activity Index      0.0040                              
Failure Probability 0.00%                               
Score               6.00                                
Resource Rating     [A]                                 
Last Event Result   [SUCCESS]                                               

List the Workflows

Warning

Only Account Administrators or Admin Users can manage workflows.

You can list the workflows in your project either using the n2x.io webUI or CLI (n2xctl):

To view your workflows, follow these steps:

  1. Navigate to the left-hand menu and click on Workflows.
  2. Select the desired Tenant and Project.

A list of your workflows will be displayed.

View Workflows List

Use the following command to list the workflows:

n2xctl ops workflow list
The n2xctl tool will prompt you for the following information:

  1. Tenant: Select the tenant to which the project will belong.
  2. Project: Select the project to which the workflows will belong.
$ n2xctl ops workflow list
n2xctl v0.0.3-20240725171430+88c4863--go1.22.5

n2xctl is a CLI to control the n2x SASE platform.

Find more information at https://n2x.io/docs

Β» Tenant: [demo] Demo Tenant
Β» Project: demo
                                                        ───── Ops: Workflows ≑
═════════════
Workflow List
═════════════

WORKFLOW NAME                                       FAILURE RATE   
--------------------------------------------------------------------
workflow                                            0.00%        

Show the Workflow Details

Warning

Only Account Administrators or Admin Users can manage workflows.

You can show the workflow details of your project either using the n2x.io webUI or CLI (n2xctl):

In the navigation menu on the left, click Workflows and follow these steps:

Show Workflow Details

  1. Select the Tenant.
  2. Click on the icon of workflow.

To view the tasks included in a workflow, click on the Tasks tab.

Workflow show tasks

Use the following command to show the workflow details of your project:

n2xctl ops workflow show

The n2xctl tool will prompt you for the following information:

  • Tenant: Select the tenant that contains the project where the workflow is located.
  • Project: Select the project that contains the workflow you want to view.
  • Workflow: Select the workflow you want to view the details of.
$ n2xctl ops workflow show
2xctl v0.0.3-20240725171430+88c4863--go1.22.5

n2xctl is a CLI to control the n2x SASE platform.

Find more information at https://n2x.io/docs

Β» Tenant: [demo] Demo Tenant
Β» Project: demo
Β» Workflow: workflow
                                                 ───── Ops: Workflow Details ≑
════════════════════
Workflow Information
════════════════════

Tenant ID   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx    
Project ID  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx    
Workflow ID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Name        workflow                                
Description Workflow sample.                        
Enabled     [yes]                                   
Reviewed    [yes]                                   
Approved    [yes]                                   

Triggers
────────

Workflow Webhook    [disabled]  

Workflow Crontab    [enabled]   */5 * * * * 

Tasks
─────

Task Name       Command         Args    UID GID 
---------       -------         ----    --- --- 
kernel-verion   /usr/bin/uname  -r      0   0   

Targets
───────

Tenant  Node                                
------  ----                                
demo    client-b                            

Activity
────────

Successful Events   0000021                             
Failed Events       0000002                             
First Activity      2024-07-30 17:50:00.546 +0200 CEST  
Last Activity       2024-07-30 19:40:00.492 +0200 CEST  
Activity Index      0.0035                              
Failure Probability 0.09%                               
Score               17.00                               
Resource Rating     [A]                                 
Last Event Result   [SUCCESS]                           

Enable a Workflow

Warning

Only Account Administrators or Admin Users can manage workflows.

You only can enable a workflow in your project using CLI (n2xctl):

Use the following command to enable a workflow in your project:

n2xctl ops workflow enable

The n2xctl tool will prompt you for the following information:

  • Tenant: Select the tenant that contains the project where the workflow is located.
  • Project: Select the project that contains the workflow you want to activate.
  • Workflow: Select the workflow you want to activate.
$ n2xctl ops workflow enable
n2xctl v0.0.3-20240725171430+88c4863--go1.22.5

n2xctl is a CLI to control the n2x SASE platform.

Find more information at https://n2x.io/docs

Β» Tenant: [demo] Demo Tenant
Β» Project: demo
Β» Workflow: workflow
                                                 ───── Ops: Workflow Details ≑
════════════════════
Workflow Information
════════════════════

Tenant ID   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Project ID  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Workflow ID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Name        workflow                                
Description Workflow sample.                        
Enabled     [yes]                                   
Reviewed    [yes]                                   
Approved    [yes]                                   

Triggers
────────

Workflow Webhook    [disabled]  

Workflow Crontab    [enabled]   */5 * * * * 

Tasks
─────

Task Name       Command         Args    UID GID 
---------       -------         ----    --- --- 
kernel-verion   /usr/bin/uname  -r      0   0   

Targets
───────

Tenant  Node                                
------  ----                                
demo    client-b                            

Activity
────────

Successful Events   0000022                             
Failed Events       0000002                             
First Activity      2024-07-30 17:50:00.546 +0200 CEST  
Last Activity       2024-07-30 19:45:00.475 +0200 CEST  
Activity Index      0.0035                              
Failure Probability 0.08%                               
Score               18.00                               
Resource Rating     [A]                                 
Last Event Result   [SUCCESS]                           

Disable a Workflow

Warning

Only Account Administrators or Admin Users can manage workflows.

You only can disable a workflow in your project using CLI (n2xctl):

Use the following command to disable a workflow in your project:

n2xctl ops workflow disable

The n2xctl tool will prompt you for the following information:

  • Tenant: Select the tenant that contains the project where the workflow is located.
  • Project: Select the project that contains the workflow you want to inactivate.
  • Workflow: Select the workflow you want to inactivate.
$ n2xctl ops workflow disable               
n2xctl v0.0.3-20240725171430+88c4863--go1.22.5

n2xctl is a CLI to control the n2x SASE platform.

Find more information at https://n2x.io/docs

Β» Tenant: [demo] Demo Tenant
Β» Project: demo
Β» Workflow: workflow
                                                 ───── Ops: Workflow Details ≑
════════════════════
Workflow Information
════════════════════

Tenant ID   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Project ID  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Workflow ID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Name        workflow                                
Description Workflow sample.                        
Enabled     [no]                                    
Reviewed    [yes]                                   
Approved    [yes]                                   

Triggers
────────

Workflow Webhook    [disabled]  

Workflow Crontab    [enabled]   */5 * * * * 

Tasks
─────

Task Name       Command         Args    UID GID 
---------       -------         ----    --- --- 
kernel-verion   /usr/bin/uname  -r      0   0   

Targets
───────

Tenant  Node                                
------  ----                                
demo    client-b                            

Activity
────────

Successful Events   0000023                             
Failed Events       0000002                             
First Activity      2024-07-30 17:50:00.546 +0200 CEST  
Last Activity       2024-07-30 19:50:00.493 +0200 CEST  
Activity Index      0.0035                              
Failure Probability 0.08%                               
Score               19.00                               
Resource Rating     [A]                                 
Last Event Result   [SUCCESS]                           

Delete a Workflow

Warning

Only Account Administrators or Admin Users can manage workflows.

Danger

Deleting a workflow is a permanent action. The workflow information will be erased from your n2x.io account and cannot be recovered.

You can delete a workflow from your project either using the n2x.io webUI or CLI (n2xctl):

In the navigation menu on the left, click Workflows and follow these steps:

Workflow delete

  1. Select the Tenant.
  2. Select the Project.
  3. Select the Workflow to delete.
  4. Click on the icon.
  5. Click on the Delete workflow... button.

Info

To permanently delete the workflow, a confirmation prompt will appear for verification.

Use the following command to delete a workflow from your project:

n2xctl ops workflow delete

The n2xctl tool will prompt you for the following information:

  • Tenant: Select the tenant that contains the project where the workflow is located.
  • Project: Select the project that contains the workflow you want to delete.
  • Workflow: Select the workflow you want to delete.
  • Confirm deletion?: Type yes to confirm and proceed with deleting the selected workflow.
$ n2xctl ops workflow delete
n2xctl v0.0.3-20240725171430+88c4863--go1.22.5

n2xctl is a CLI to control the n2x SASE platform.

Find more information at https://n2x.io/docs

Β» Tenant: [demo] Demo Tenant
Β» Project: demo
Β» Workflow: workflow

Β» Confirm deletion? Yes

  Done