Skip to content

Instantly share code, notes, and snippets.

@haukurk
Last active August 29, 2015 14:09
Show Gist options
  • Save haukurk/bb4e1c2f76962a147faa to your computer and use it in GitHub Desktop.
Save haukurk/bb4e1c2f76962a147faa to your computer and use it in GitHub Desktop.
PostgreSQL with PostGIS2 extension - Puppet Example
# 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