liquibase.sdk.vagrant.supplier.postgresql.postgresql-windows.puppet.vm Maven / Gradle / Ivy
exec { "vcredist_x64_2010.exe":
cwd => 'c:\vagrant-install-files\windows',
command => 'c:\vagrant-install-files\windows\vcredist_x64.exe /q',
returns => [0,5100],
} ->
exec { 'unzip postgresql':
creates => '${supplier.installDir}',
command => '"C:\Program Files\7-Zip\7z.exe" x "c:\vagrant-install-files\postgresql\postgresql-${supplier.version}-windows-x64-binaries.zip" -o"${supplier.installDir}" -y -aos',
require => Package["7zip"],
} ->
file {'postgresql-password.txt':
path => 'c:/vagrant/modules/conf/postgresql/postgresql-password.txt',
ensure => present,
content => "${supplier.adminPassword}",
} ->
exec { 'initdb':
command => '"${supplier.installDir}\pgsql\bin\initdb.exe" -U ${supplier.adminUsername} -A password --auth-host=password --pwfile=c:\vagrant\modules\conf\postgresql\postgresql-password.txt -E utf8 -D "${supplier.installDir}\data"',
creates => '${supplier.installDir}\data',
} ->
exec { 'copy postgresql.conf':
command => 'c:\windows\system32\cmd.exe /c copy c:\vagrant\modules\conf\postgresql\postgresql.conf ${supplier.installDir}\data\postgresql.conf'
} ->
exec { 'copy pg_hba.conf':
command => 'c:\windows\system32\cmd.exe /c copy c:\vagrant\modules\conf\postgresql\pg_hba.conf ${supplier.installDir}\data\pg_hba.conf'
} ->
exec { 'register postgresql service':
command => '"${supplier.installDir}\pgsql\bin\pg_ctl.exe" register -N postgresql -D "${supplier.installDir}\data"',
returns => [0,1] #returns 1 if already registered
} ->
exec { 'start postgresql':
command => 'c:\windows\system32\net.exe start postgresql',
returns => [0,2] #returns 2 if already started
} ->
exec { 'postgresql init sql':
environment => 'PGPASSWORD=${supplier.adminPassword}',
command => 'c:\windows\system32\cmd.exe /c ${supplier.installDir}\pgsql\bin\psql.exe -w -f c:\vagrant\modules\conf\postgresql\postgresql.init.sql -U ${supplier.adminUsername}',
}