Contidos dentroLocalizar Mais DocumentaçãoDestaques de Recursos de Suporte | Fazer download desta apostila em PDF (1943 KB)
Chapter 11 Complex JobsThis chapter explains how to manage hosts in the most consistent and efficient manner. Complex jobs are not difficult to create or use; they are complex because they combine several objects into one command from the user interface to the system dependency server. Complex jobs maintain consistency throughout the environment and to make sure that even the most complicated lifecycle management missions are orderly and error-free. Complex jobs allow you to include multiple tasks, each task combining a set of objects and operation options. This chapter covers the following topics: TermsThis chapter uses the following terms:
Complex Job ProcessesYou create a single job to be run on one or multiple hosts. Each agent that receives the job runs it individually, optimizing on the software configuration of the host. To fulfill a job, an agent uses rules and components from the knowledge base. The agent runs the dependency resolver, which takes into account installed inventory, selected policy, and selected profile. The dependency resolver is a set of algorithms that describes the best possible solution for an agent to complete a job. The best possible solution includes:
When you create a job, the agent of each selected managed host picks up the job and runs the following processes. Each agent performs these actions only for the components of its distribution-architecture; irrelevant components are ignored. Therefore, you can safely create a multiple distribution job and send it to a mixed group of hosts. The job process of each agent, for each task, is as follows:
Post-Fix ActionsA post-fix action is a binary that performs an action on hosts when a specific package has been installed. Sun Update Connection – Enterprise runs post-fixes without user intervention. Post-fixes ensure machine functionality after changes. Example 11–1 Using Post-Fix ActionsYou create a job that upgrades the kernel. Before the job ends, a post-fix action is triggered, which updates the boot-loader file for the new kernel version. Agent QueuingWhile an agent is running a job, it cannot perform other Sun Update Connection – Enterprise actions:
Complex Job ObjectsA complex job is made up of one or more tasks, a schedule, and a set of performance options. At the time that you create the job, you set the schedule (see To Set Job Schedules) and the options (see To Set Job Options). On the other hand, you may create the objects of the tasks either on the fly, as you create the tasks, or before you begin to create the job. A task needs a profile:
A task needs a policy:
A task needs a hostlist:
Creating Complex JobsIn the following procedures, you will select the objects and options of a job and then run the job on selected hosts. Before you begin a job on a Solaris machine, make sure the PKG deployment preferences are appropriate for your local needs. See Host Preferences – PKGs on Host Preferences – PKGs. This procedure is broken up into the following parts:
|
|
Option |
Selected Function |
Deselected Function |
|---|---|---|
|
Notify of changes |
If the owner of the profiles or policies changes them, you will get an email notification. Select if using profiles/policies that other users created. |
You are not notified of changes. Deselect if you own the selected profiles or policies and do not want the reminder emails. |
|
Accept changes before next run |
Use updated profiles or policies. Select for consistency and automation. |
Use the profiles or policies as they were when you created the job. Deselect for predictability. |
Specify how you want the task to run in relation to other tasks and how to handle failures.
|
Option |
Selected Function |
Deselected Function |
|---|---|---|
|
Parallel |
Run the job simultaneously with other jobs. Do not run jobs that depend on the results of other jobs in parallel. Run such jobs in sequential mode only. |
Run the job after the previous job completed. By default, a job is run sequentially. |
|
Sequential |
Run the job after other jobs have completed. |
Run the job in parallel mode. |
|
Continue on failure |
Continue to run a job even if one of the steps or tasks experienced a failure. This option is only available for jobs that run in sequential mode. |
Terminate a job if a step or task experiences a failure. |
|
Priority |
Select or change a priority for ajob. Values are Low, Medium, and High. |
By default, the priority is set to Medium. |
The CLI command to submit a job runs one task on a single selected host or group. See Submit Job (-sj) Command.
#! /bin/bash echo -n “Enter your user name:” read user echo -n “Enter your password:” read password echo -n “Type a name for this job:” read jobname echo -n “Do you want to run this job on a host or a group? (h|g):” read hostgroup if [ $hostgroup = “h” ];then echo “Hosts are:” uce_cli -lah -u “$user” -p “$password” else echo “Groups are:” uce_cli -lg -u “$user” -p “$password” fi echo -n “Copy host or group name to receive job:” read selected echo “Profiles are:” uce_cli -lp -u “$user” -p “$password” echo -n “Copy profile to use:” read profile echo “Policies are:” uce_cli -lc -u “$user” -p “$password” echo -n “Copy policy to use:” read policy echo “Simulating $jobname” uce_cli -sj -j “$jobname” -P “$profile” -C “$policy” -$hostgroup “$selected” -us -sm -u “$user” -p “$password” echo -n “Do you want to deploy $jobname? (y|n)” read yes if [ $yes = “y” ]; then uce_cli -sj -j “$jobname Deployed” -P “$profile” -C “$policy” -$hostgroup “$selected” -us -dp -u “$user” -p “$password” fi |
After you have set up the objects of a job, you can save it as a template. Using a job template, you can run the job, with or without edits, whenever you want. Use this procedure if you have the job requirements, but are unsure of when it should be run, or if the hosts are not yet online.
Open the New Job window and create tasks.
If you want, you can set a schedule and select options.
With any tab of the New Job window open, click Save Template.
Sun Update Connection – Enterprise saves the job without running it, and sends you a message when the save is complete.
The template name appears in the Jobs list, with an icon to indicate that it is not a running job.
To create a job from the template, select the template and then right-click and select Rerun. Select Deploy or Simulate and then click OK.
You can use a job to be the base of another job. Use this procedure if you have a complex job that would fulfill new requirements with a few changes, rather than creating a new job.
In the Jobs list, select a job to use as the source and then right-click and select Copy.
The New Job window opens with the objects and settings of the selected job.
The profile is listed as Based on <source profile> from <date time>. This is to notify you that the job will be based on the profile as it was at the date and time that the source job was created. If the profile has been changed since then, this new job will not reflect those changes.
If the profile is listed as Task’s Profile, the job was not a complex job. It was created by applying job settings to inventory components. You can make a copy of this job, but you cannot view its ToDo basket.
Make any changes to the job that you want and then click OK.
The job is added to the Jobs list and begins according to its schedule settings.
If you do make changes to the copied job, there is no indication in the Job list. See the Job Log for details of how the changes were translated into actions.
This procedure is a specific example of executing Complex Jobs. This example is of a very simple job. You could follow it even if you have not yet created profiles, policies, and groups.
Make sure the Jobs panel of the main window is open by choosing Jobs from the View menu.
From the tool bar, click the New Job button.
The New Job window opens.
Name the job CheckAllHosts. In the description, type This job checks all hosts for missing dependencies.
Select Simulate.
This job will find any missing dependencies on any of the hosts and give you an idea of how long the actual job would take.
In the Tasks tab, click Add Task and a task with:
Click OK in the Tasks tab.
The SingleCheck task is added to the job.
Click OK in the New Job window.
The job is sent to all managed hosts. Each host will be checked to see whether it has any missing or conflicting dependencies.
Check the progress of the hosts as they run the job, and the job log of each host when it is done.
If the results of the simulation are satisfactory, rerun the job in Deploy mode. See To Rerun a Job.
The DR finds a solution to fix any missing or conflicting dependencies. You will be asked to confirm the fixes before they are deployed. See To Confirm Tasks). On confirmation, the actions are carried out and all dependencies are fixed on all hosts.
This procedure is a specific example of using the Complex Job feature. This example is of a more feature-rich job.
This example assumes the following:
You have a profile with your requirements of an NFS server (NfsServer) and a profile for an NFS client (NfsClient).
You have created a policy to automatically apply fixes (AutoFix).
You have created a group of machines destined to be NFS servers (nfs servers) and a group for NFS clients (nfs clients). The machines may be of differing distributions and architectures. You would have aligned the profile requirements for the different active distributions before creating this job. See To Align Component Settings for Multiple Distributions.
Make sure the Jobs panel of the main window is open by choosing Jobs from the View menu.
Click the New Job button.
The New Job window opens.
Name the job: NFS Environment.
In the description, type This job provisions NFS servers and NFS clients.
Select Deploy.
As the profiles are your own or the predefined profiles for system management, you have a good idea of what will be done on the hosts; you do not need to simulate the job before deploying it.
Before anything is changed on any host, Sun Update Connection – Enterprise saves its inventory. If you do not like the results of the job, you can easily restore it to its previous inventory. See Restoring Managed Hosts.
In the Tasks tab, click Add Task and a task with:
Click OK.
The IntegrityCheck task is added to the job.
Add another task:
Click OK.
The ProvisionNfsServer task is added to the job.
Add another task:
Click OK.
The ProvisionNfsClients task is added to the job.
Now you have a job with three tasks: check hosts for missing dependencies, provision the NFS server profile on the nfs servers group, and then provision the NFS client on the nfs clients group.
Let’s set a schedule for this job. If the job is run on a recurring basis, it will make sure that the hosts in the web servers group always comply with the web server profile. If they do comply, nothing is changed and the job finishes on success. If there has been an error in change management, the recurring run will find it.
Open the Schedule tab.
Select Recurring.
Select Every Month.
Select Day in week, and then select Monday.
Set Earliest to 7:00.
The job will now run every Monday, early in the morning. Let’s look at the job options now.
Open the Options tab.
Select Use secure components only.
If you are the owner of the profiles and of the AutoFix policy, you can leave the Notify of changes option deselected. They cannot be changed by any other user.
Select Accept changes before next run.
If the requirements of an NFS server change, you need only change the profile once. This option ensures that the job will automatically use any changes you make to the profile.
You now have a re-usable job, with multiple tasks to be run on multiple hosts in a specific order, according to what is relevant to the inventory, distribution, and hardware architecture of each managed host. The job has a schedule. You will be notified by email if there are any tasks to do or if a host goes down. The job options have been set to optimize this specific set of tasks. To execute the job, click OK in the New Job window.