lowlydba.sqlserver.agent_job_step module – Configures a SQL Agent job step
Note
This module is part of the lowlydba.sqlserver collection (version 2.2.2).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install lowlydba.sqlserver
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: lowlydba.sqlserver.agent_job_step
.
New in lowlydba.sqlserver 0.1.0
Synopsis
Configures a step for an agent job.
Requirements
The below requirements are needed on the host that executes this module.
dbatools PowerShell module
Parameters
Parameter |
Comments |
---|---|
The commands to be executed by SQLServerAgent service through subsystem. |
|
The name of the database in which to execute a Transact-SQL step. Default: |
|
The name of the job to which to add the step. |
|
The action to perform if the step fails. Choices:
|
|
The ID of the step in this job to execute if the step fails and on_fail_action=GoToStep. Default: |
|
The action to perform if the step succeeds. Choices:
|
|
The ID of the step in this job to execute if the step succeeds and on_success_action=GoToStep. Default: |
|
The number of retry attempts to use if this step fails. The default is Default: |
|
The amount of time in minutes between retry attempts. Default: |
|
The SQL Server instance to modify. |
|
Password for SQL Authentication. |
|
Username for SQL Authentication. |
|
Whether or not the object should be Choices:
|
|
The sequence identification number for the job step. Step identification numbers start at Required if state=present. |
|
The name of the step. Required if state=present. |
|
The subsystem used by the SQL Server Agent service to execute command. Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in check_mode and return changed status prediction without modifying target. |
|
Platforms: all |
Target OS/families that can be operated against. |
Examples
- name: Create a job
lowlydba.sqlserver.agent_job:
sql_instance: sql-01.myco.io
job: MyJob
force: true
- name: Create a job step
lowlydba.sqlserver.agent_job_step:
sql_instance: sql-01.myco.io
job: MyJob
step_name: Step1
step_id: 1
command: "TRUNCATE TABLE dbo.TestData;"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Output from the Returned: success, but not in check_mode. |