Skip to content

Commit ffadfd2

Browse files
author
Jean B.
committed
Merge pull request #65 from cyberious/FM2110-readme
FM-2110 README Predocs for sqlserver_tsql provider
2 parents ce95060 + d3b8730 commit ffadfd2

File tree

1 file changed

+67
-32
lines changed

1 file changed

+67
-32
lines changed

README.md

+67-32
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@
1515

1616
##Overview
1717

18-
The sqlserver module installs and manages Microsoft SQL Server 2012 and 2014 on Windows systems.
18+
The sqlserver module installs and manages Microsoft SQL Server 2012 and 2014 on Windows systems.
1919

2020
##Module Description
21-
22-
The sqlserver module adds defined types to install and manage Microsoft SQL Server 2012 and 2014 on Windows Server 2012. The module can install SQL Server clients, multiple instances, and SQL features, as well as create and manage new databases and logins.
21+
22+
The sqlserver module adds defined types to install and manage Microsoft SQL Server 2012 and 2014 on Windows Server 2012. The module can install SQL Server clients, multiple instances, and SQL features, as well as create and manage new databases and logins.
2323

2424
##Setup
2525

2626
###What sqlserver affects
2727

2828
This module requires .NET 3.5 and installs it if it's not already on your system. This might require an internet connection.
2929

30-
###Setup Requirements
30+
###Setup Requirements
3131

3232
The sqlserver module requires the following:
3333

@@ -36,10 +36,10 @@ The sqlserver module requires the following:
3636
* .NET 3.5
3737
* ISO, mounted or expanded either locally or on a network share
3838
* Windows Server 2012 or 2012R2
39-
39+
4040
###Beginning with sqlserver
4141

42-
To get started with the sqlserver module, include these settings in your manifest:
42+
To get started with the sqlserver module, include these settings in your manifest:
4343

4444
```
4545
sqlserver_instance{'MSSQLSERVER':
@@ -79,7 +79,7 @@ sqlserver::database{ 'minviable':
7979
}
8080
```
8181

82-
###To set up a new login:
82+
###To set up a new login:
8383

8484
```
8585
SQL Login
@@ -88,13 +88,43 @@ sqlserver::login{'vagrant':
8888
password => 'Pupp3t1@',
8989
}
9090
91-
Windows Login
91+
Windows Login
9292
sqlserver::login{'WIN-D95P1A3V103\localAccount':
9393
instance => 'MSSQLSERVER',
9494
login_type => 'WINDOWS_LOGIN',
9595
}
9696
```
9797

98+
###To run custom TSQL statements
99+
100+
To use `sqlserver_tsql` as a trigger to other defined types in order to trigger other workflows
101+
```
102+
sqlserver_tsql{ 'Query Logging DB Status':
103+
instance => 'MSSQLSERVER',
104+
onlyif => "IF (SELECT count(*) FROM myDb.dbo.logging_table WHERE
105+
message like 'FATAL%') > 1000 THROW 50000, 'Fatal Exceptions in Logging', 10",
106+
notify => Exec['To Many Fatal Errors']
107+
}
108+
```
109+
110+
It can also be used to help clean up regular logs with conditional checks
111+
```
112+
sqlserver_tsql{ 'Cleanup Old Logs':
113+
instance => 'MSSQLSERVER',
114+
command => "DELETE FROM myDb.dbo.logging_table WHERE log_date < '${log_max_date}'",
115+
onlyif => "IF exists(SELECT * FROM myDb.dbo.logging_table WHERE log_date < '${log_max_date}')
116+
THROW 50000, 'need log cleanup', 10",
117+
}
118+
```
119+
120+
In the event you want something to always execute you can also leave the `onlyif` parameter out and have it execute every time
121+
```
122+
sqlserver_tsql{ 'Always running':
123+
instance => 'MSSQLSERVER',
124+
command => 'EXEC notified_executor()',
125+
}
126+
```
127+
98128
#### Windows SQL Server Terms
99129

100130
Terminology differs somewhat between various database systems; please refer to this list of terms for clarification.
@@ -114,10 +144,10 @@ Terminology differs somewhat between various database systems; please refer to t
114144
* `ensure`: Ensures that the resource is present. Valid values are 'present', 'absent'.
115145
* `features`: Specifies features to install or uninstall. The list of top-level features include IS, MDS, and Tools. The Tools feature will install Management Tools, SQL Server Data Tools, and other shared components. Valid values are 'Tools', 'BC', 'Conn', 'SSMS', 'ADV_SSMS', 'SDK', 'IS', 'MDS'.
116146
* `is_svc_account`: Either domain user name or system account. Defaults to 'NT AUTHORITY\NETWORK SERVICE'.
117-
* `is_svc_password`: Password for domain user.
147+
* `is_svc_password`: Password for domain user.
118148
* `pid`: Specify the SQL Server product key to configure which edition you would like to use. Can be left empty for evaluation versions.
119149
* `provider`: The specific backend to use for this `sqlserver_features` resource. You seldom need to specify this---Puppet will usually discover the appropriate provider for your platform. Available providers are: `mssql`, `source`.
120-
150+
121151
#### sqlserver_instance
122152

123153
* `agt_svc_account`: Either domain user name or system account.
@@ -139,22 +169,27 @@ Terminology differs somewhat between various database systems; please refer to t
139169
* `sql_svc_password`: The SQL Server service password; required only for a domain account.
140170
* `sql_sysadmin_accounts`: The Windows or SQL account(s) to provision as SQL Server system administrators.
141171

172+
####sqlserver_tsql
173+
* `command`: TSQL to execute on a potentially conditional basis
174+
* `onlyif`: TSQL to execute as a check to see if we should proceed and run the command parameter, should encounter a throw or error to trigger
175+
* `instance`: SQL Server instance that we should execute against
176+
142177
### Defined Types
143178

144179
#### `sqlserver::config`
145180

146-
Stores the config file that allows Puppet to access and modify the instance.
181+
Stores the config file that allows Puppet to access and modify the instance.
147182

148183
* `instance_name`: The instance name you want to manage. Defaults to the name of the define.
149-
* `admin_user`: The SQL login with sysadmin rights on the server, can only be login of SQL_Login type.
184+
* `admin_user`: The SQL login with sysadmin rights on the server, can only be login of SQL_Login type.
150185
* `admin_pass`: The password to access the server to be managed.
151186

152187
```
153188
sqlserver::config{'MSSQLSERVER':
154189
admin_user => 'sa',
155190
admin_pass => 'PuppetP@ssword1',
156191
}
157-
```
192+
```
158193

159194
#### `sqlserver::database`
160195

@@ -165,23 +200,23 @@ Creates, destroys, or updates databases, but does not move or modify files. Requ
165200
* `ensure`: Ensures that the resource is present. Valid values are 'present', 'absent'. Defaults to 'present'.
166201
* `compatibility`: Numeric representation of the SQL Server version with which the database should be compatible. For example, 100 = SQL Server 2008 through SQL Server 2012. For a complete list of values, refer to [http://msdn.microsoft.com/en-us/library/bb510680.aspx](http://msdn.microsoft.com/en-us/library/bb510680.aspx).
167202
* `collation_name`: Modifies dictionary default sort rules for the datatbase. Defaults to 'Latin1_General'. To find out what other values your system supports, run the query `SELECT * FROM sys.fn_helpcollations() WHERE name LIKE 'SQL%'`.
168-
* `filestream_non_transacted_access`: Specifies the level of non-transactional FILESTREAM access to the database. This parameter is affected only at creation; updates will not change this setting. Valid values are 'OFF', 'READ_ONLY', 'FULL'. Requires defined type `sqlserver::sp_configure`.
169-
* `filestream_directory_name`: Accepts a Windows-compatible directory name. This name should be unique among all the Database_Directory names in the SQL Server instance. Uniqueness comparison is case-insensitive, regardless of SQL Server collation settings. This option should be set before creating a FileTable in this database. This parameter is affected only at creation; updates will not change this setting. Requires defined type `sqlserver::sp_configure`.
170-
* `filespec_name`: Specifies the logical name for the file. NAME is required when FILENAME is specified, except when specifying one of the FOR ATTACH clauses. A FILESTREAM filegroup cannot be named PRIMARY. This parameter is affected only at creation; updates will not change this setting.
171-
* `filespec_filename`: Specifies the operating system (physical) file name. This parameter is affected only at creation; updates will not change this setting.
172-
* `filespec_size`: Specifies the size of the file. The kilobyte (KB), megabyte (MB), gigabyte (GB), or terabyte (TB) suffixes can be used. The default is MB. Values can not be greater than 2147483647. This parameter is affected only at creation; updates will not change this setting.
173-
* `filespec maxsize`: Specifies the maximum size to which the file can grow. MAXSIZE cannot be specified when the os_file_name is specified as a UNC path. This parameter is affected only at creation; updates will not change this setting.
174-
* `filespec_filegrowth`: Specifies the automatic growth increment of the file. The FILEGROWTH setting for a file cannot exceed the MAXSIZE setting. FILEGROWTH cannot be specified when the os_file_name is specified as a UNC path. FILEGROWTH does not apply to a FILESTREAM filegroup. This parameter is affected only at creation; updates will not change this setting.
175-
* `log_name`: Specifies the logical name for the file. NAME is required when FILENAME is specified, except when specifying one of the FOR ATTACH clauses. A FILESTREAM filegroup cannot be named PRIMARY. This parameter is affected only at creation; updates will not change this setting.
176-
* `log_filename`: Specifies the operating system (physical) file name. This parameter is affected only at creation; updates will not change this setting.
177-
* `log_size`: Specifies the size of the file. The kilobyte (KB), megabyte (MB), gigabyte (GB), or terabyte (TB) suffixes can be used. The default is MB. Values can not be greater than 2147483647. This parameter is affected only at creation; updates will not change this setting.
178-
* `log_maxsize`: Specifies the maximum size to which the file can grow. MAXSIZE cannot be specified when the os_file_name is specified as a UNC path. This parameter is affected only at creation; updates will not change this setting.
179-
* `log_filegrowth`: Specifies the automatic growth increment of the file. The FILEGROWTH setting for a file cannot exceed the MAXSIZE setting. FILEGROWTH cannot be specified when the os_file_name is specified as a UNC path. FILEGROWTH does not apply to a FILESTREAM filegroup. This parameter is affected only at creation; updates will not change this setting.
203+
* `filestream_non_transacted_access`: Specifies the level of non-transactional FILESTREAM access to the database. This parameter is affected only at creation; updates will not change this setting. Valid values are 'OFF', 'READ_ONLY', 'FULL'. Requires defined type `sqlserver::sp_configure`.
204+
* `filestream_directory_name`: Accepts a Windows-compatible directory name. This name should be unique among all the Database_Directory names in the SQL Server instance. Uniqueness comparison is case-insensitive, regardless of SQL Server collation settings. This option should be set before creating a FileTable in this database. This parameter is affected only at creation; updates will not change this setting. Requires defined type `sqlserver::sp_configure`.
205+
* `filespec_name`: Specifies the logical name for the file. NAME is required when FILENAME is specified, except when specifying one of the FOR ATTACH clauses. A FILESTREAM filegroup cannot be named PRIMARY. This parameter is affected only at creation; updates will not change this setting.
206+
* `filespec_filename`: Specifies the operating system (physical) file name. This parameter is affected only at creation; updates will not change this setting.
207+
* `filespec_size`: Specifies the size of the file. The kilobyte (KB), megabyte (MB), gigabyte (GB), or terabyte (TB) suffixes can be used. The default is MB. Values can not be greater than 2147483647. This parameter is affected only at creation; updates will not change this setting.
208+
* `filespec maxsize`: Specifies the maximum size to which the file can grow. MAXSIZE cannot be specified when the os_file_name is specified as a UNC path. This parameter is affected only at creation; updates will not change this setting.
209+
* `filespec_filegrowth`: Specifies the automatic growth increment of the file. The FILEGROWTH setting for a file cannot exceed the MAXSIZE setting. FILEGROWTH cannot be specified when the os_file_name is specified as a UNC path. FILEGROWTH does not apply to a FILESTREAM filegroup. This parameter is affected only at creation; updates will not change this setting.
210+
* `log_name`: Specifies the logical name for the file. NAME is required when FILENAME is specified, except when specifying one of the FOR ATTACH clauses. A FILESTREAM filegroup cannot be named PRIMARY. This parameter is affected only at creation; updates will not change this setting.
211+
* `log_filename`: Specifies the operating system (physical) file name. This parameter is affected only at creation; updates will not change this setting.
212+
* `log_size`: Specifies the size of the file. The kilobyte (KB), megabyte (MB), gigabyte (GB), or terabyte (TB) suffixes can be used. The default is MB. Values can not be greater than 2147483647. This parameter is affected only at creation; updates will not change this setting.
213+
* `log_maxsize`: Specifies the maximum size to which the file can grow. MAXSIZE cannot be specified when the os_file_name is specified as a UNC path. This parameter is affected only at creation; updates will not change this setting.
214+
* `log_filegrowth`: Specifies the automatic growth increment of the file. The FILEGROWTH setting for a file cannot exceed the MAXSIZE setting. FILEGROWTH cannot be specified when the os_file_name is specified as a UNC path. FILEGROWTH does not apply to a FILESTREAM filegroup. This parameter is affected only at creation; updates will not change this setting.
180215
* `containment`: Defaults to 'NONE'.Other possible values are 'PARTIAL'. Setting `containment` =>'PARTIAL' requires defined type `sqlserver::sp_configure`. See [http://msdn.microsoft.com/en-us/library/ff929071.aspx](http://msdn.microsoft.com/en-us/library/ff929071.aspx) for complete documentation about containment.
181216
* `default_fulltext_language`: Sets default fulltext language. Only applicable if `containment` => ‘PARTIAL’. Valid values are documented at [http://msdn.microsoft.com/en-us/library/ms190303.aspx](http://msdn.microsoft.com/en-us/library/ms190303.aspx). Defaults to 'us_english'.
182217
* `default_language`: Sets default language. Only applicable if `containment` => ‘PARTIAL’. Valid values are documented at http://msdn.microsoft.com/en-us/library/ms190303.aspx. Defaults to 'us_english'.
183218
* `nested_triggers`: Enables cascading triggers. Only applicable if `containment` => ‘PARTIAL’. Valid values are 'ON', 'OFF'. See [http://msdn.microsoft.com/en-us/library/ms178101.aspx](http://msdn.microsoft.com/en-us/library/ms178101.aspx) for complete documentation.
184-
* `transform_noise_words`: Removes noise or stop words, such as “is”, “the”, “this”. Only applicable if `containment` => ‘PARTIAL’. Valid values are 'ON', 'OFF'.
219+
* `transform_noise_words`: Removes noise or stop words, such as “is”, “the”, “this”. Only applicable if `containment` => ‘PARTIAL’. Valid values are 'ON', 'OFF'.
185220
* `two_digit_year_cutoff`: The year at which the system will treat the year as four digits instead of two. For example, if set to '1999', 1998 would be abbreviated to '98', while 2014 would be '2014'. Only applicable if `containment` => ‘PARTIAL’. Valid values are any year between 1753 and 9999. Defaults to 2049.
186221
* `db_chaining`: Whether the database can be the source or target of a cross-database ownership chain. Only applicable if `containment` => ‘PARTIAL’. Valid values are 'ON', 'OFF'. Defaults to 'OFF'.
187222
* `trustworthy`: Whether database modules (such as views, user-defined functions, or stored procedures) that use an impersonation context can access resources outside the database. Only applicable if `containment` => ‘PARTIAL’. Valid values are 'ON', 'OFF'. Defaults to 'OFF'.
@@ -208,13 +243,13 @@ Requires defined type `sqlserver::config`.
208243
* `default_database`: Sets the database the login should default to when connecting. Defaults to 'master'.
209244
* `default_language`: Sets default language. Valid values are documented at http://msdn.microsoft.com/en-us/library/ms190303.aspx. Defaults to 'us_english'.
210245
* `check_expiration`: For SQL logins, checks to see if password has expired and user should be forced to change the password. Only applicable when Login_Type = 'SQL_LOGIN'. Valid values are 'true', 'false'. Default value is 'false'.
211-
* `check_policy`: Checks the password policy. Only applicable when Login_Type = 'SQL_LOGIN'. Valid values are 'true', 'false'. Defaults to 'true'.
212-
* `disabled`: Valid values are 'true', 'false'. Defaults to 'false'.
246+
* `check_policy`: Checks the password policy. Only applicable when Login_Type = 'SQL_LOGIN'. Valid values are 'true', 'false'. Defaults to 'true'.
247+
* `disabled`: Valid values are 'true', 'false'. Defaults to 'false'.
213248

214249
**For more information about these settings and configuration in Microsoft SQL Server, please see:**
215250

216251
* [Server Role Members](http://msdn.microsoft.com/en-us/library/ms186320.aspx)
217-
* [Create Login](http://technet.microsoft.com/en-us/library/ms189751.aspx)
252+
* [Create Login](http://technet.microsoft.com/en-us/library/ms189751.aspx)
218253
* [Alter Login](http://technet.microsoft.com/en-us/library/ms189828.aspx)
219254

220255
#### sqlserver::sp_configure
@@ -230,13 +265,13 @@ This defined type configures the instance to allow usage of filestream parameter
230265

231266
**For more information about these settings and configuration in Microsoft SQL Server, please see:**
232267

233-
* [Reconfigure](http://msdn.microsoft.com/en-us/library/ms176069.aspx)
268+
* [Reconfigure](http://msdn.microsoft.com/en-us/library/ms176069.aspx)
234269
* [Server Configuration Options](http://msdn.microsoft.com/en-us/library/ms189631.aspx)
235270

236271
##Limitations
237272

238-
This module is available only for Puppet Enterprise 3.7 and later.
273+
This module is available only for Puppet Enterprise 3.7 and later.
239274

240275
## Development
241276

242-
This is a proprietary module only available to Puppet Enterprise users. As such, we have no formal way for users to contribute toward development. However, we know our users are a charming collection of brilliant people, so if you have a bug you've fixed or a contribution to this module, please generate a diff and throw it into a ticket to support---they'll ensure that we get it.
277+
This is a proprietary module only available to Puppet Enterprise users. As such, we have no formal way for users to contribute toward development. However, we know our users are a charming collection of brilliant people, so if you have a bug you've fixed or a contribution to this module, please generate a diff and throw it into a ticket to support---they'll ensure that we get it.

0 commit comments

Comments
 (0)