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.

Procedure: Creating a New Recurring Action
  1. To apply a recurring action to an individual client, navigate to Systems, click the client to configure schedules for, and navigate to the Recurring Actions tab.

  2. To apply a recurring action to a system group, navigate to Systems  System Groups, select the group to configure schedules for, and navigate to Recurring Actions tab.

  3. Click Create.

  4. Select an action type from the Action Type dropdown.

  5. Type a name for the new schedule.

  6. 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
  7. OPTIONAL: Toggle the Test mode switch on to run the schedule in test mode.

  8. 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.

  9. In the next pane, drag and drop the selected states to put them in the execution order and click Confirm.

  10. 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 Home  My Organization  Recurring Actions 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 Admin  Organizations, select the organization to manage, and navigate to the States  Recurring Actions 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:

  • System Details  Remote Command

  • System Details  Schedule System Reboot

  • System Details  States  Highstate

  • System Details  Software  Packages  List/Remove

  • System Details  Software  Packages  Install

  • System Details  Software  Packages  Upgrade

  • System Details  Software  Patches

  • System Details  Software  Software Channels

  • System Details  Configuration

  • Images  Build

Procedure: Creating a New Action Chain
  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. When you have finished adding actions, navigate to Schedule  Action Chains and selecting the action chain from the list.

  6. 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.

  7. 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 Schedule  Pending Actions.

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.

Procedure: Configuring Traditional Clients to Accept Remote Commands
  1. On the client, at the command prompt, use the package manager to install the rhncfg, rhncfg-client, and rhncfg-actions packages, if not already installed. For example:

    zypper in rhncfg rhncfg-client rhncfg-actions
  2. 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
  3. 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 /tmp/ directory on the client. To ensure that remote commands work accurately, do not mount /tmp with the noexec option. For more information, see Troubleshooting.

All commands run from the Remote Commands page are executed as root on clients. Wildcards can be used to run commands across any number of systems. Always take extra care to check your commands before issuing them.

Procedure: Running Remote Commands on Traditional Clients
  1. In the SUSE Manager Web UI, navigate to Systems, click the client to run a remote command on, and navigate to the Details  Remote Command tab.

  2. 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 the Run as group field.

  3. 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.

  4. In the Command label field, type a name for your command.

  5. In the Script field, type the command or script to execute.

  6. Select a date and time to execute the command, or add the remote command to an action chain.

  7. Click Schedule to schedule the remote command.

For more information about action chains, see Action Chains.

Procedure: Running Remote Commands on Salt Clients
  1. Navigate to Salt  Remote Commands.

  2. In the first field, before the @ symbol, type the command you want to issue.

  3. In the second field, after the @ symbol, type the client you want to issue the command on. You can type the minion-id of an individual client, or you can use wildcards to target a range of clients.

  4. Click Find targets to check which clients you have targeted, and confirm that you have used the correct details.

  5. Click Run command to issue the command to the target clients.