lowlydba.sqlserver.agent_job_schedule (2.3.2) — module

Configures a SQL Agent job schedule

| "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 settings for an agent schedule that can be applied to one or more agent jobs.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a job schedule
  lowlydba.sqlserver.agent_job_schedule:
    sql_instance: sql-01.myco.io
    schedule: DailySchedule
    force: true
    enabled: true
    start_date: 2020-05-25  # May 25, 2020
    end_date: 2099-05-25    # May 25, 2099
    start_time: 010500      # 01:05:00 AM
    end_time: 140030        # 02:00:30 PM
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a job with schedule
  lowlydba.sqlserver.agent_job:
    sql_instance: sql-01.myco.io
    job: MyJob
    force: true
    schedule: DailySchedule

Inputs

    
job:
    description:
    - The name of the job that has the schedule.
    - Schedules and jobs can also be associated via M(lowlydba.sqlserver.agent_job).
    - See U(https://docs.dbatools.io/New-DbaAgentSchedule) for more detailed usage.
    required: true
    type: str

force:
    description:
    - The force option will ignore some errors in the options and assume defaults.
    - It will also remove the any present schedules with the same name for the specific
      job.
    type: bool

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

enabled:
    description:
    - Whether the schedule is enabled or disabled.
    required: false
    type: bool

end_date:
    description:
    - The date on which execution of a job can stop.
    - If I(force=true) the end date will be C(99991231), via dbatools.
    - Format is C(yyyyMMdd).
    required: false
    type: str

end_time:
    description:
    - The time on any day to end execution of a job. Format C(HHMMSS) (24 hour clock).
    - If (force=true) the start time will be C(23:59:59).
    required: false
    type: str

schedule:
    description:
    - The name of the schedule.
    required: true
    type: str

start_date:
    description:
    - The date on which execution of a job can begin.
    - If I(force=true) the start date will be the current day.
    - Format is C(yyyyMMdd).
    required: false
    type: str

start_time:
    description:
    - The time on any day to begin execution of a job. Format C(HHMMSS) (24 hour clock).
    - If I(force=true) the start time will be C(00:00:00).
    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

frequency_type:
    choices:
    - Once
    - OneTime
    - Daily
    - Weekly
    - Monthly
    - MonthlyRelative
    - AgentStart
    - AutoStart
    - IdleComputer
    - OnIdle
    description:
    - A value indicating when a job is to be executed.
    - If I(force=true) the default will be C(Once).
    required: false
    type: str

frequency_interval:
    description:
    - The days that a job is executed.
    - Allowed values for I(frequency_type=Daily) - C(EveryDay) or a number between C(1)
      and C(365) inclusive.
    - Allowed values for I(frequency_type=Weekly) - C(Sunday), C(Monday), C(Tuesday),
      C(Wednesday), C(Thursday), C(Friday), C(Saturday), C(Weekdays), C(Weekend) or C(EveryDay).
    - Allowed values for I(frequency_type=Monthly) - Numbers C(1) through C(31) for each
      day of the month.
    - If C(Weekdays), C(Weekend) or C(EveryDay) is used it overwrites any other value
      that has been passed before.
    - If I(force=true) the default will be C(1).
    required: false
    type: str

frequency_subday_type:
    choices:
    - Time
    - Seconds
    - Minutes
    - Hours
    description:
    - Specifies the units for the subday I(frequency_interval).
    required: false
    type: str

frequency_subday_interval:
    description:
    - The number of subday type periods to occur between each execution of a job.
    required: false
    type: int

frequency_recurrence_factor:
    description:
    - The number of weeks or months between the scheduled execution of a job.
    - Required if I(frequency_type=Weekly), I(frequency_type=Monthly) or I(frequency_type=MonthlyRelative).
    required: false
    type: int

frequency_relative_interval:
    choices:
    - Unused
    - First
    - Second
    - Third
    - Fourth
    - Last
    description:
    - A job's occurrence of I(frequency_interval) in each month. If I(frequency_interval=32)
      (C(MonthlyRelative)).
    required: false
    type: str

Outputs

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