Skip to content

Instantly share code, notes, and snippets.

@marshyski
Created November 20, 2015 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marshyski/96c4c80815abed2bfbc9 to your computer and use it in GitHub Desktop.
Save marshyski/96c4c80815abed2bfbc9 to your computer and use it in GitHub Desktop.
Basic SQL Install with Puppet
# Class to install SQL Server, set its configuration, create an
# instance, as well as a sample DB.
class app_sqlserver (
$source = 'F:/',
$admin_user = 'Administrator',
$db_instance = 'MYINSTANCE',
$sa_pass = 'MySecretPASSWORD',
$db_name = 'sampledb',
) {
reboot { 'before install':
when => pending,
}
service { 'wuauserv':
ensure => running,
enable => true,
before => Windowsfeature['Net-Framework-Core'],
}
windowsfeature { 'Net-Framework-Core':
before => Sqlserver::Database[$db_name],
}
sqlserver_instance{ $db_instance:
ensure => present,
features => ['SQL'],
source => $source,
security_mode => 'SQL',
sa_pwd => $sa_pass,
sql_sysadmin_accounts => [$admin_user],
}
sqlserver_features { 'Management_Studio':
source => $source,
features => ['SSMS'],
}
sqlserver::config{ $db_instance:
admin_user => 'sa',
admin_pass => $sa_pass,
}
sqlserver::database{ $db_name:
ensure => present,
db_name => $db_name,
instance => $db_instance,
}
}
@molixrawdi
Copy link

molixrawdi commented Jan 9, 2019

Hi,
Thanks for this, I'm new to puppet so please forgive my questions if their answers appear obvious:) will this require an SQL class (for Puppet Enterprise to work!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment