DSCResources/PostgreSQL/PostgreSQL.schema.psm1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
Configuration PostgreSQL { param ( [int] $Port = 4432, [string] $ServiceName = "QlikSenseRepositoryDatabase", [string] $Path = "$($env:ProgramData)\Qlik\Sense\Repository\PostgreSQL\9.3", [string[]] $HostAccess, [string] $ListenAddresses ) Import-DSCResource -ModuleName xPSDesiredStateConfiguration,xNetworking xFirewall QRD-postgresql { Name = "QRD-Postgresql" DisplayName = "Qlik Sense Repository Database" Group = "Qlik Sense" Ensure = "Present" Action = "Allow" Enabled = "True" Profile = ("Domain", "Private", "Public") Direction = "InBound" LocalPort = ($Port) Protocol = "TCP" } foreach ($address in $HostAccess) { LineInFile "pg_hba_$address" { Ensure = "Present" Path = "$Path\pg_hba.conf" Line = "host all all $address md5" } } if ($ListenAddresses) { LineInFile postgresql { Ensure = "Present" Path = "$Path\postgresql.conf" Line = "listen_addresses = '$ListenAddresses'" InsertBefore = "#listen_addresses = 'localhost'" } } xService QRD { Name = $ServiceName State = "Running" } } |