Update the postgresql cookbook
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
# This file was automatically generated and dropped off by Chef!
|
||||
|
||||
# PostgreSQL Client Authentication Configuration File
|
||||
# ===================================================
|
||||
#
|
||||
# Refer to the "Client Authentication" section in the PostgreSQL
|
||||
# documentation for a complete description of this file.
|
||||
|
||||
<% if node['postgresql']['version'].to_f < 9.1 -%>
|
||||
# TYPE DATABASE USER CIDR-ADDRESS METHOD
|
||||
<% elsif node['postgresql']['version'].to_f >= 9.1 -%>
|
||||
# TYPE DATABASE USER ADDRESS METHOD
|
||||
<% end -%>
|
||||
|
||||
###########
|
||||
# Other authentication configurations taken from chef node defaults:
|
||||
###########
|
||||
<% node['postgresql']['pg_hba'].each do |auth| -%>
|
||||
|
||||
<% if auth[:comment] %>
|
||||
# <%= auth[:comment] %>
|
||||
<% end %>
|
||||
<% if auth[:addr] %>
|
||||
<%= auth[:type].ljust(7) %> <%= auth[:db].ljust(15) %> <%= auth[:user].ljust(15) %> <%= auth[:addr].ljust(23) %> <%= auth[:method] %>
|
||||
<% else %>
|
||||
<%= auth[:type].ljust(7) %> <%= auth[:db].ljust(15) %> <%= auth[:user].ljust(15) %> <%= auth[:method] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
# "local" is for Unix domain socket connections only
|
||||
<% if node['postgresql']['version'].to_f < 9.1 -%>
|
||||
local all all ident
|
||||
<% elsif node['postgresql']['version'].to_f >= 9.1 -%>
|
||||
local all all peer
|
||||
<% end -%>
|
||||
@@ -1,4 +0,0 @@
|
||||
PGDATA=<%= node['postgresql']['dir'] %>
|
||||
<% if node['postgresql']['config'].attribute?("port") -%>
|
||||
PGPORT=<%= node['postgresql']['config']['port'] %>
|
||||
<% end -%>
|
||||
@@ -1,10 +0,0 @@
|
||||
[Service]
|
||||
<% if node['postgresql']['use_pgdg_packages'] %>
|
||||
.include /usr/lib/systemd/system/postgresql-<%= node['postgresql']['version'] %>.service
|
||||
<% else %>
|
||||
.include /usr/lib/systemd/system/postgresql.service
|
||||
<% end %>
|
||||
|
||||
Environment=
|
||||
Environment=PGPORT=<%= node['postgresql']['config']['port'] %>
|
||||
Environment=PGDATA=<%= node['postgresql']['config']['data_directory'] %>
|
||||
33
cookbooks/postgresql/templates/pg_hba.conf.erb
Normal file
33
cookbooks/postgresql/templates/pg_hba.conf.erb
Normal file
@@ -0,0 +1,33 @@
|
||||
# This file was automatically generated and dropped off by Chef!
|
||||
|
||||
# PostgreSQL Client Authentication Configuration File
|
||||
# ===================================================
|
||||
#
|
||||
# Refer to the "Client Authentication" section in the PostgreSQL
|
||||
# documentation for a complete description of this file.
|
||||
|
||||
local all postgres peer
|
||||
|
||||
# TYPE DATABASE USER ADDRESS METHOD
|
||||
|
||||
# "local" is for Unix domain socket connections only
|
||||
local all all peer
|
||||
# IPv4 local connections:
|
||||
host all all 127.0.0.1/32 md5
|
||||
# IPv6 local connections:
|
||||
host all all ::1/128 md5
|
||||
|
||||
###########
|
||||
# From the postgresql_access resources
|
||||
###########
|
||||
<% @pg_hba.each do |k,v| -%>
|
||||
# <%= k %>
|
||||
<% if v[:comment] -%>
|
||||
# <%= v[:comment] %>
|
||||
<% end -%>
|
||||
<% if v[:addr] %>
|
||||
<%= v[:type].ljust(7) %> <%= v[:db].ljust(15) %> <%= v[:user].ljust(15) %> <%= v[:addr].ljust(23) %> <%= v[:method] %>
|
||||
<% else %>
|
||||
<%= v[:type].ljust(7) %> <%= v[:db].ljust(15) %> <%= v[:user].ljust(15) %> <%= v[:method] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
49
cookbooks/postgresql/templates/pg_ident.conf.erb
Normal file
49
cookbooks/postgresql/templates/pg_ident.conf.erb
Normal file
@@ -0,0 +1,49 @@
|
||||
# PostgreSQL User Name Maps
|
||||
# =========================
|
||||
#
|
||||
# Refer to the PostgreSQL documentation, chapter "Client
|
||||
# Authentication" for a complete description. A short synopsis
|
||||
# follows.
|
||||
#
|
||||
# This file controls PostgreSQL user name mapping. It maps external
|
||||
# user names to their corresponding PostgreSQL user names. Records
|
||||
# are of the form:
|
||||
#
|
||||
# MAPNAME SYSTEM-USERNAME PG-USERNAME
|
||||
#
|
||||
# (The uppercase quantities must be replaced by actual values.)
|
||||
#
|
||||
# MAPNAME is the (otherwise freely chosen) map name that was used in
|
||||
# pg_hba.conf. SYSTEM-USERNAME is the detected user name of the
|
||||
# client. PG-USERNAME is the requested PostgreSQL user name. The
|
||||
# existence of a record specifies that SYSTEM-USERNAME may connect as
|
||||
# PG-USERNAME.
|
||||
#
|
||||
# If SYSTEM-USERNAME starts with a slash (/), it will be treated as a
|
||||
# regular expression. Optionally this can contain a capture (a
|
||||
# parenthesized subexpression). The substring matching the capture
|
||||
# will be substituted for \1 (backslash-one) if present in
|
||||
# PG-USERNAME.
|
||||
#
|
||||
# Multiple maps may be specified in this file and used by pg_hba.conf.
|
||||
#
|
||||
# No map names are defined in the default configuration. If all
|
||||
# system user names and PostgreSQL user names are the same, you don't
|
||||
# need anything in this file.
|
||||
#
|
||||
# This file is read on server startup and when the postmaster receives
|
||||
# a SIGHUP signal. If you edit the file on a running system, you have
|
||||
# to SIGHUP the postmaster for the changes to take effect. You can
|
||||
# use "pg_ctl reload" to do that.
|
||||
|
||||
# Put your actual configuration here
|
||||
# ----------------------------------
|
||||
|
||||
# MAPNAME SYSTEM-USERNAME PG-USERNAME
|
||||
<% @pg_ident.each do |k,v| -%>
|
||||
<% if v[:comment] -%>
|
||||
|
||||
# <%= v[:comment] %>
|
||||
<% end -%>
|
||||
<%= v[:mapname].ljust(15) %> <%= v[:system_user].ljust(23) %> <%= v[:pg_user].ljust(15) %>
|
||||
<% end %>
|
||||
2
cookbooks/postgresql/templates/pgsql.sysconfig.erb
Normal file
2
cookbooks/postgresql/templates/pgsql.sysconfig.erb
Normal file
@@ -0,0 +1,2 @@
|
||||
PGDATA=<%= @postgresql_dir %>
|
||||
PGPORT=<%= @port %>
|
||||
@@ -3,9 +3,14 @@
|
||||
# Please refer to the PostgreSQL documentation for details on
|
||||
# configuration settings.
|
||||
|
||||
<% node['postgresql']['config'].sort.each do |key, value| %>
|
||||
data_directory = '<%= @data_dir %>'
|
||||
hba_file = '<%= @hba_file %>'
|
||||
ident_file = '<%= @ident_file %>'
|
||||
external_pid_file = '<%= @external_pid_file %>'
|
||||
stats_temp_directory = '<%= @stats_temp_directory %>'
|
||||
port = <%= @port %>
|
||||
<% @additional_config.sort.each do |key, value| %>
|
||||
<% next if value.nil? -%>
|
||||
<% next if node['postgresql']['version'].to_f < 9.2 && /ssl_.*._file/.match(key) -%>
|
||||
<%= key %> = <%=
|
||||
case value
|
||||
when String
|
||||
6
cookbooks/postgresql/templates/postgresql.service.erb
Normal file
6
cookbooks/postgresql/templates/postgresql.service.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
[Service]
|
||||
.include /usr/lib/systemd/system/<%= @svc_name %>.service
|
||||
|
||||
Environment=
|
||||
Environment=PGPORT=<%= @port %>
|
||||
Environment=PGDATA=<%= @data_dir %>
|
||||
Reference in New Issue
Block a user