lowlydba.sqlserver.agent_job_step (2.3.2) — module

Configures a SQL Agent job step

| "added in version" 0.1.0 of lowlydba.sqlserver"

Authors: John McCall (@lowlydba)

Install collection

Install with ansible-galaxy collection install lowlydba.sqlserver:==2.3.2


Add to requirements.yml

  collections:
    - name: lowlydba.sqlserver
      version: 2.3.2

Description

Configures a step for an agent job.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a job
  lowlydba.sqlserver.agent_job:
    sql_instance: sql-01.myco.io
    job: MyJob
    force: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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;"

Inputs

    
job:
    description:
    - The name of the job to which to add the step.
    required: true
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Whether or not the object should be C(present) or C(absent).
    required: false
    type: str

command:
    description:
    - The commands to be executed by SQLServerAgent service through subsystem.
    required: false
    type: str

step_id:
    description:
    - The sequence identification number for the job step. Step identification numbers
      start at C(1) and increment without gaps.
    - Required if I(state=present).
    required: false
    type: int

database:
    default: master
    description:
    - The name of the database in which to execute a Transact-SQL step.
    required: false
    type: str

step_name:
    description:
    - The name of the step. Required if I(state=present).
    required: false
    type: str

subsystem:
    choices:
    - CmdExec
    - Distribution
    - LogReader
    - Merge
    - PowerShell
    - QueueReader
    - Snapshot
    - Ssis
    - TransactSql
    default: TransactSql
    description:
    - The subsystem used by the SQL Server Agent service to execute command.
    required: false
    type: str

sql_instance:
    description:
    - The SQL Server instance to modify.
    required: true
    type: str

sql_password:
    description:
    - Password for SQL Authentication.
    required: false
    type: str

sql_username:
    description:
    - Username for SQL Authentication.
    required: false
    type: str

on_fail_action:
    choices:
    - QuitWithSuccess
    - QuitWithFailure
    - GoToNextStep
    - GoToStep
    default: QuitWithFailure
    description:
    - The action to perform if the step fails.
    required: false
    type: str

retry_attempts:
    default: 0
    description:
    - The number of retry attempts to use if this step fails. The default is C(0).
    required: false
    type: int

retry_interval:
    default: 0
    description:
    - The amount of time in minutes between retry attempts.
    required: false
    type: int

on_fail_step_id:
    default: 0
    description:
    - The ID of the step in this job to execute if the step fails and I(on_fail_action=GoToStep).
    required: false
    type: int

on_success_action:
    choices:
    - QuitWithSuccess
    - QuitWithFailure
    - GoToNextStep
    - GoToStep
    default: QuitWithSuccess
    description:
    - The action to perform if the step succeeds.
    required: false
    type: str

on_success_step_id:
    default: 0
    description:
    - The ID of the step in this job to execute if the step succeeds and I(on_success_action=GoToStep).
    required: false
    type: int

Outputs

data:
  description: Output from the C(New-DbaAgentJobStep), C(Set-DbaAgentJobStep), or
    C(Remove-DbaAgentJobStep) function.
  returned: success, but not in check_mode.
  type: dict