Last active
August 29, 2015 14:09
-
-
Save haukurk/bb4e1c2f76962a147faa to your computer and use it in GitHub Desktop.
PostgreSQL with PostGIS2 extension - Puppet Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install PostgreSQL 9.3 server from the PGDG repository | |
class {'postgresql::globals': | |
version => '9.3', | |
manage_package_repo => true, | |
encoding => 'UTF8', | |
locale => 'it_IT.utf8', | |
}-> | |
class { 'postgresql::server': | |
ensure => 'present', | |
listen_addresses => '*', | |
ip_mask_allow_all_users => '0.0.0.0/0', | |
postgres_password => 'PASSWORD', | |
} | |
class { 'postgresql::server::postgis': | |
} | |
# Install contrib modules | |
class { 'postgresql::server::contrib': | |
package_ensure => 'present', | |
} | |
postgresql::server::db { 'FARlive': | |
user => 'FARLIVE', | |
password => postgresql_password('FARLIVE', 'PASSWORD'), | |
} | |
postgresql::server::db { 'FARtest': | |
user => 'FARTEST', | |
password => postgresql_password('FARTEST', 'PASSWORD'), | |
} | |
exec { "/usr/bin/psql -d FARtest -c 'CREATE EXTENSION postgis;'": | |
user => "postgres", | |
unless => "/usr/bin/psql -d FARtest -c '\\dx' | grep postgis | grep -v postgis_topology", | |
} | |
exec { "/usr/bin/psql -d FARlive -c 'CREATE EXTENSION postgis;'": | |
user => "postgres", | |
unless => "/usr/bin/psql -d FARlive -c '\\dx' | grep postgis | grep -v postgis_topology", | |
} | |
exec { "/usr/bin/psql -d FARtest -c 'CREATE EXTENSION postgis_topology;'": | |
user => "postgres", | |
unless => "/usr/bin/psql -d FARtest -c '\\dx' | grep postgis_topology", | |
} | |
exec { "/usr/bin/psql -d FARlive -c 'CREATE EXTENSION postgis_topology;'": | |
user => "postgres", | |
unless => "/usr/bin/psql -d FARlive -c '\\dx' | grep postgis_topology", | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment