SUSE Manager can group a number of operations in a sequence, called an Action Chain, so that they are all scheduled at once and performed in a particular order. Using Action Chains can be useful when dealing with some administrative tasks, for example rebooting a systems after deploying a patch.
Currently SUSE Manager supports Action Chaining on:
- package installation;
- package update;
- package removal;
- package verification;
- patch application;
- execution of a remote command;
- configuration file deployment;
An Action is one of the supported operations above, applied to one or more systems.
An Action Chain is an ordered sequence of Actions.
The execution of an Action is the execution of the corresponding operation to all the systems it applies to.
The execution of an Action Chain is the execution of all its Actions, provided that:
- if more than one Action applies to a same system, corresponding supported operations will be executed sequentially in Action Chain order.
- if a supported operation fails on a system, no further supported operations will be executed on that system.
Note: SUSE Manager does not enforce ordering across different systems.
- a fully patched SUSE Manager 2.1 server (see above for migration instructions from SUSE Manager 1.7);
- at least one registered client.
Adding Actions to a Chain
First, create the first Action of the Chain following instructions specific to that Action, for example installing a package on a single system or running a remote command through the System Set Manager.
Instead of scheduling the Action for a certain date, select the "Add To Action Chain" radio button. Use the combo-box on the right to enter a new Action Chain label name.
After clicking on "Schedule", you should get a confirmation message and the Action Chain is created.
You can add more Actions to the Chain by repeating the process and selecting the same label from the Action Chain combobox.
Editing a Chain
Action Chains can be edited by clicking on their labels from the Schedule -> Action Chains page.
From this page you can:
- change the Actions ordering by drag-and-drop;
- delete Actions from the Chain by clicking on "delete action" links;
- inspect the list of systems on which an Action is run by clicking on the "+" sign;
- delete a single system from an Action by clicking on "delete system" links;
- delete the whole Chain with the "delete action chain" link on the top-left corner;
- change the Action Chain label by clicking on it;
- schedule the Action Chain for execution not before a certain date by clicking on the "Save and Schedule" button.
Note that leaving the page without clicking on either "Save" or "Save and Schedule" will destroy any unsaved changes - a confirmation dialog will appear in that case.
After scheduling an Chain
Once a Chain is scheduled, the actions it contains will be displayed in the Schedule -> Pending Actions, Failed Actions and Completed Actions pages depending on their statuses. In particular, if an Action fails on a system no other Actions from the same Chain will be executed on that systems.
The application programming interface for the Action Chain feature is available over the XML-RPC protocol and are accessible from any programming language that supports such protocol.
In order to access the API from Python code, one must create remote XML-RPC connection, login to obtain session token and use Action Chain API. As an example:
import xmlrpclib # Prepare the connection conn = xmlrpclib.Server("http://your.manager.com/rpc/api", verbose = 0) token = conn.auth.login("myusername", "mypassword") # Collect required data from appropriate API calls server_id = 10000010000 chain_name = "Server Maintenance" packages = [111, 222, 333] # Schedule Action Chains conn.actionchain.addPackageInstall(token, server_id, packages) conn.actionchain.addSystemReboot(token, server_id, chain_name)
To find your host ID (server_id), you should use corresponding methods from other sections in the set of SUSE Manager APIs, for example search the systems by name. The same applies is about the "packages" variable, which is a list of package IDs.
In order to know full list of currently supported XML-RPC APIs, please refer to the documentation, available on your installed SUSE Manager.
- Due to technical limitations it is not possible to reuse Action Chains;
- Currently you cannot add an Action to an Action Chain from the Edit page.
Developer information is also available on this Wiki.