Debian Codegraph @

ansible_collections/lowlydba/sqlserver/plugins/modules/maintenance_solution.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: maintenance_solution
10 short_description: Install/update Maintenance Solution by Ola Hallengren
11 description:
12 - A wrapper for C(Install-DbaMaintenanceSolution) to fetch the latest version of the Ola Hallengren's Maintenance Solution,
13 or install from a local cached version.
14 version_added: 0.1.0
15 options:
16 backup_location:
17 description:
18 - Location of the backup root directory. If this is not supplied, the default backup directory will be used.
19 type: str
20 required: false
21 cleanup_time:
22 description:
23 - Time in hours, after which backup files are deleted.
24 type: int
25 required: false
26 default: 0
27 output_file_dir:
28 description:
29 - Specify the output file directory where the Maintenance Solution will write to.
30 type: str
31 required: false
32 replace_existing:
33 description:
34 - If this switch is enabled, objects already present in the target database will be dropped and recreated.
35 type: bool
36 required: false
37 log_to_table:
38 description:
39 - If this switch is enabled, the Maintenance Solution will be configured to log commands to a table.
40 type: bool
41 required: false
42 default: false
43 solution:
44 description:
45 - Specifies which portion of the Maintenance Solution to install.
46 type: str
47 required: false
48 default: 'All'
49 choices: ['All', 'Backup', 'IntegrityCheck', 'IndexOptimize']
50 install_jobs:
51 description:
52 - If this switch is enabled, the corresponding SQL Agent Jobs will be created.
53 type: bool
54 required: false
55 default: false
56 install_parallel:
57 description:
58 - If this switch is enabled, the C(Queue) and C(QueueDatabase) tables are created, for use when C(@DatabasesInParallel = 'Y') are set in the jobs.
59 type: bool
60 required: false
61 default: false
62 local_file:
63 description:
64 - Specifies the path to a local file to install Ola's solution from. This should be the zip file as distributed by the maintainers.
65 - If this option is not specified, the latest version will be downloaded and installed
66 from the L(Maintenance Solution Github,https://github.com/olahallengren/sql-server-maintenance-solution).
67 type: str
68 required: false
69 database:
70 description:
71 - Name of the target database.
72 type: str
73 required: true
74 force:
75 description:
76 - If this switch is enabled, the Maintenance Solution will be downloaded from the internet even if previously cached.
77 type: bool
78 default: false
79 author: "John McCall (@lowlydba)"
80 requirements:
81 - L(dbatools,https://www.powershellgallery.com/packages/dbatools/) PowerShell module
82 extends_documentation_fragment:
83 - lowlydba.sqlserver.sql_credentials
84 - lowlydba.sqlserver.attributes.check_mode
85 - lowlydba.sqlserver.attributes.platform_all
86 '''
87
88 EXAMPLES = r'''
89 - name: Install/Update Maintenance Solution
90 lowlydba.sqlserver.multitool:
91 sql_instance: sql-01.myco.io
92 database: main
93 replace_existing: true
94 '''
95
96 RETURN = r'''
97 data:
98 description: Output from the C(Install-MaintenanceSolution) function.
99 returned: success, but not in check_mode.
100 type: dict
101 '''