Skip to content
This repository has been archived by the owner on Dec 27, 2021. It is now read-only.

Configure pg_hba.conf and postgresql.conf using PostgreSQLRole #130

Open
geovanisouza92 opened this issue Nov 2, 2013 · 0 comments
Open

Comments

@geovanisouza92
Copy link
Contributor

Hi everyone!

I'm tested provisioning a pg server with provy rather than chef_solo (of vagrant) and all worked very well!

But, after some tries, I noted that pg_hba.conf and postgresql.conf aren't configured automatically.

So, I do it with ensure_line and execute (to restart server). It works.

So, I suggest to make a way to do these configs using the role, what appears much less monkey patch...

Here is my config:

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "precise64"
  config.vm.network :private_network, ip: "10.11.12.13"
end

provyfile.py

#!/usr/bin/env python
# coding: utf-8

from provy.core import Role
from provy.more.debian.database.postgresql import PostgreSQLRole


class DatabaseRole(Role):

    def provision(self):
        self.provision_role(PostgreSQLRole)
        self.ensure_line('host  all  all  10.11.12.0/24  trust',
            '/etc/postgresql/9.1/main/pg_hba.conf', sudo=True)
        self.ensure_line("listen_addresses = '10.11.12.13'",
            '/etc/postgresql/9.1/main/postgresql.conf', sudo=True)
        self.execute('service postgresql restart', sudo=True)


servers = {
    'db': {
        'address': '10.11.12.13',
        'user': 'vagrant',
        'roles': [
            DatabaseRole,
        ]
    }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant