Debian Codegraph @

ansible_collections/lowlydba/sqlserver/plugins/modules/agent_job.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # (c) 2022, John McCall (@lowlydba)
5 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7 DOCUMENTATION = r'''
8 ---
9 module: agent_job
10 short_description: Configures a SQL Agent job
11 description:
12 - Configure a SQL Agent job, including which schedules and category it belongs to.
13 version_added: 0.1.0
14 options:
15 job:
16 description:
17 - The name of the target SQL Agent job.
18 type: str
19 required: true
20 description:
21 description:
22 - Description for the SQL Agent job.
23 type: str
24 required: false
25 category:
26 description:
27 - Category for the target SQL Agent job. Must already exist.
28 type: str
29 required: false
30 enabled:
31 description:
32 - Whether the SQL Agent job should be enabled or disabled.
33 type: bool
34 required: false
35 default: true
36 version_added: '0.4.0'
37 owner_login:
38 description:
39 - The owning login for the database. Will default to the current user if
40 the database is being created and none supplied.
41 type: str
42 required: false
43 start_step_id:
44 description:
45 - What step number the job should begin with when run.
46 type: int
47 required: false
48 schedule:
49 description:
50 - The name of the schedule the job should be associated with. Only one schedule per job is supported.
51 type: str
52 required: false
53 force:
54 description:
55 - If I(force=true), any job categories will be created if they don't exist already.
56 type: bool
57 default: false
58 author: "John McCall (@lowlydba)"
59 notes:
60 - On slower hardware, stale job component data may be returned (i.e., a previous or default job category).
61 Configuring each component (schedule, step, category, etc.) individually is recommended for this reason.
62 requirements:
63 - L(dbatools,https://www.powershellgallery.com/packages/dbatools/) PowerShell module
64 extends_documentation_fragment:
65 - lowlydba.sqlserver.sql_credentials
66 - lowlydba.sqlserver.attributes.check_mode
67 - lowlydba.sqlserver.attributes.platform_all
68 - lowlydba.sqlserver.state
69 '''
70
71 EXAMPLES = r'''
72 - name: Create a job
73 lowlydba.sqlserver.agent_job:
74 sql_instance: sql-01.myco.io
75 job: MyJob
76 force: true
77 '''
78
79 RETURN = r'''
80 data:
81 description: Output from the C(New-DbaAgentJob), C(Set-DbaAgentJob), or C(Remove-DbaAgentJob) function.
82 returned: success, but not in check_mode.
83 type: dict
84 '''