Actions
You can manage actions on your clients in a number of different ways.
For Salt clients, you can schedule automated recurring actions to apply the highstate or an arbitrary set of custom states to clients on a specified schedule. You can apply recurring actions to individual clients, to all clients in a system group, or to an entire organization.
On both Salt and traditional clients, you can set actions to be performed in a particular order by creating action chains. Action chains can be created and edited ahead of time, and scheduled to run at a time that suits you.
You can also perform remote commands on one or more of your Salt clients. Remote commands allows you to issue commands to individual Salt clients, or to all clients that match a search term.
1. Recurring Actions
You can apply recurring actions on individual Salt clients, to a system group, or to all clients in an organization.
Currently, SUSE Manager supports the following action types as recurring actions:
-
Highstate:
Execute the highstate. -
Custom state:
Execute a set of custom states. A custom state can be either an internal state provided by SUSE Manager, or a configuration channel created by a user.
For more information about configuration channels, see Configuration Management.
-
To apply a recurring action to an individual client, navigate to
Systems
, click the client to configure schedules for, and navigate to theRecurring Actions
tab. -
To apply a recurring action to a system group, navigate to
, select the group to configure schedules for, and navigate toRecurring Actions
tab. -
Click Create.
-
Select an action type from the
Action Type
dropdown. -
Type a name for the new schedule.
-
Choose the frequency of the recurring action:
-
Hourly:
Type the minute of each hour. For example,15
runs the action at fifteen minutes past every hour. -
Daily:
Select the time of each day. For example,01:00
runs the action at 0100 every day, in the timezone of the SUSE Manager Server. -
Weekly:
Select the day of the week and the time of the day, to execute the action every week at the specified time. -
Monthly:
Select the day of the month and the time of the day, to execute the action every month at the specified time. -
Custom Quartz format:
For more detailed options, enter a custom quartz string. For example, to run a recurring action at 0215 every Saturday of every month, enter:0 15 2 ? * 7
-
-
OPTIONAL: Toggle the
Test mode
switch on to run the schedule in test mode. -
For actions of type
Custom state
, select the states from the list of available states and click Save Changes. This will only save the current state selection and not the schedule. -
In the next pane, drag and drop the selected states to put them in the execution order and click Confirm.
-
Finally, click Create Schedule to save, and see the complete list of existing schedules.
Organization Administrators can set and edit recurring actions for all clients in the organization. Navigate to
to see all recurring actions that apply to the entire organization.SUSE Manager Administrators can set and edit recurring actions for all clients in all organizations. Navigate to
, select the organization to manage, and navigate to the tab.
Recurring actions can only be used with Salt clients. Traditional clients in your group or organization are ignored. |
2. Action Chains
If you need to perform a number of sequential actions on your clients, you can create an action chain to ensure the order is respected.
By default, most clients execute an action as soon as the command is issued. In some case, actions take a long time, which could mean that actions issued afterwards fail. For example, if you instruct a client to reboot, then issue a second command, the second action could fail because the reboot is still occurring. To ensure that actions occur in the correct order, use action chains.
For transactional update systems, an action chain is executed inside a single snapshot, until there is a reboot action. This can cause some limitations. For more information, see Registering SLE Micro Clients. |
You can use action chains on both traditional and Salt clients. Action chains can include any number of these actions, in any order:
-
In the SUSE Manager Web UI, navigate to the first action you want to perform in the action chain. For example, navigate to
System Details
for a client, and click Schedule System Reboot. -
Check the
Add to
field and select the action chain you want to add to:-
If this is your first action chain, select
new action chain
. -
If the action chain already exists, select it from the list.
-
If you already have existing action chains, but you want to create a new action chain, start typing a name for the new action chain to create it.
-
-
Confirm the action. The action is not performed immediately, it creates the new action chain, and a blue bar confirming this appears at the top of the screen.
-
Continue adding actions to your action chain by checking the
Add to
field and selecting the name of the action chain to add them to. -
When you have finished adding actions, navigate to
and selecting the action chain from the list. -
Re-order actions by dragging them and dropping them into the correct position. Click the blue plus sign to see the clients an action is to be performed on. Click Save to save your changes.
-
Schedule a time for your action chain to run, and click Save and Schedule. If you leave the page without clicking either Save or Save and Schedule all unsaved changes are discarded.
If one action in an action chain fails, the action chain stops, and no further actions are executed. |
You can see scheduled actions from action chains by navigating to
.3. Remote Commands
You can configure clients to run commands remotely. This allows you to issue scripts or individual commands to a client, without having access to the client directly.
This feature is automatically enabled on Salt clients, and you do not need to perform any further configuration. For traditional clients, the feature is enabled if you have registered the client using a bootstrap script and have enabled remote commands. You can use this procedure to enable it manually, instead.
Before you begin, ensure your client is subscribed to the appropriate tools child channel for its installed operating system. For more information about subscribing to software channels, see Software Channels.
For transactional update systems, consider that a remote command is run inside a single snapshot. This can cause some limitations. For more information, see Registering SLE Micro Clients. |
-
On the client, at the command prompt, use the package manager to install the
rhncfg
,rhncfg-client
, andrhncfg-actions
packages, if not already installed. For example:zypper in rhncfg rhncfg-client rhncfg-actions
-
On the client, at the command prompt, as root, create a path in the local configuration directory:
mkdir -p /etc/sysconfig/rhn/allowed-actions/script
-
Create an empty file called
run
in the new directory. This file grants the SUSE Manager Server permission to run remote commands:touch /etc/sysconfig/rhn/allowed-actions/script/run
For Salt clients, remote commands are run from the |
All commands run from the |
-
In the SUSE Manager Web UI, navigate to
Systems
, click the client to run a remote command on, and navigate to the tab. -
In the
Run as user
field, type the user ID (UID) of the user on the client that you want to run the command. Alternatively, you can specify a group to run the command, using the group ID (GID) in theRun as group
field. -
OPTIONAL: In the
Timeout
field, type a timeout period for the command, in seconds. If the command is not executed within this period, it is not run. -
In the
Command label
field, type a name for your command. -
In the
Script
field, type the command or script to execute. -
Select a date and time to execute the command, or add the remote command to an action chain.
-
Click Schedule to schedule the remote command.
For more information about action chains, see Action Chains.
-
Navigate to
. -
In the first field, before the
@
symbol, type the command you want to issue. -
In the second field, after the
@
symbol, type the client you want to issue the command on. You can type theminion-id
of an individual client, or you can use wildcards to target a range of clients. -
Click Find targets to check which clients you have targeted, and confirm that you have used the correct details.
-
Click Run command to issue the command to the target clients.