- SaltStack Tutorial
- SaltStack - Home
- SaltStack - Overview
- SaltStack - Architecture
- SaltStack - Competitors
- SaltStack - Installation
- Creating a Simple Environment
- SaltStack - Access Control System
- SaltStack - Job Management
- SaltStack - Salt File Server
- SaltStack - Git as a File Server
- Using MinionFS as the File Server
- SaltStack - Using Cron with Salt
- SaltStack - Remote Execution
- Configuration Management
- SaltStack - Logging
- SaltStack - Salt through SSH
- Salt for Cloud Infrastructure
- SaltStack - Salt Proxy Minions
- SaltStack - Event system
- SaltStack - Orchestration
- SaltStack - Salt Package Manager
- SaltStack - Python API
- SaltStack - Working Example
- SaltStack Useful Resources
- SaltStack - Quick Guide
- SaltStack - Useful Resources
- SaltStack - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
SaltStack - Job Management
Salt has the capability of high-speed communication with a large number of systems. This approach helps Salt to make a powerful multitasking system. Salt can run jobs on more than one systems, so Salt uses job management technique to manage each job running on all the systems. This chapter explains about job management in detail.
What is a Job ID?
Salt has cache directory, cachedir. Inside this, a directory that minions maintain is called as the proc directory. It is located in the following directory /var/cache/salt/proc.
The proc directory is used to maintain all the files. When these files are executed, they assign with a unique job ID. This job id helps to identify the current running jobs on the minion and allow the jobs to be looked up.
Salt introduces a new module that is called as the Saltutil job management process. This module contains different functions to manage jobs. These functions are used to manage jobs at the minion level. The functions are described in brief as follows −
running − Returns all the running jobs data that are found in the proc directory.
find_job − Returns specific data about a certain job based on the job id.
signal_job − Allows a given job id(jid) to be sent a signal.
term_job − Sends a termination signal for the specified job.
kill_job − Sends a kill signal for the specified job.
The jobs runner contains functions to make viewing data easier and cleaner. It has different functions. Let us discuss each of these functions in detail.
The Active function is used to identify which jobs are still running and check what systems have completed a job and what systems are still being waited on. It is executed using the following command,
The lookup_jid runner will display the data for the current looking job. These jobs are configured via the keep_jobs option in the master configuration. It is executed using the following command.
salt-run jobs.lookup_jid <job id number>
The List_jobs function is used to list out the job data for jobs. It is expressed by the following command −
The schedule system exposes the execution of any execution function on minions or any runner on the master.
It is performed by the following methods −
Schedule − The schedule option in either the master or the minion config files.
Minion pillar data − It refreshes the minion pillar data using the saltutil.refresh_pillar command.
The schedule state or schedule module.
Salt states are executed on the minion. You can pass the positional arguments and provide a YAML dict of the named arguments in the config file as shown below.
schedule: job1: function: saltstate.sls seconds: 3600 args: - httpd kwargs: test: True
Here, job1 will execute the function saltstate.sls with the specified arguments, httpd for every hour. The test: True is the additional argument for the httpd command that is defined in saltstate.sls.