From 9fd7a026ad55283208341abe4ca501f97baf8212 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Thu, 11 Jun 2020 19:25:26 -0700 Subject: [PATCH] puppet: Pull postgres data directory into postgres_appdb_base. The `pg_datadir` variable was only used, and accurate, for CentOS. Pull it out into `postgres_app_base`, broaden it to being accurate on Debian-based systems as well, and use it consistently in the templates. --- puppet/zulip/manifests/postgres_appdb_base.pp | 2 ++ puppet/zulip/manifests/postgres_appdb_tuned.pp | 2 -- .../templates/postgresql/10/postgresql.conf.centos.template.erb | 2 +- .../zulip/templates/postgresql/10/postgresql.conf.template.erb | 2 +- .../zulip/templates/postgresql/11/postgresql.conf.template.erb | 2 +- .../zulip/templates/postgresql/12/postgresql.conf.template.erb | 2 +- .../zulip/templates/postgresql/9.3/postgresql.conf.template.erb | 2 +- .../zulip/templates/postgresql/9.5/postgresql.conf.template.erb | 2 +- .../zulip/templates/postgresql/9.6/postgresql.conf.template.erb | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/puppet/zulip/manifests/postgres_appdb_base.pp b/puppet/zulip/manifests/postgres_appdb_base.pp index 2a0b95d11e..5186168dfa 100644 --- a/puppet/zulip/manifests/postgres_appdb_base.pp +++ b/puppet/zulip/manifests/postgres_appdb_base.pp @@ -10,6 +10,7 @@ class zulip::postgres_appdb_base { $postgresql = "postgresql-${zulip::base::postgres_version}" $postgres_sharedir = "/usr/share/postgresql/${zulip::base::postgres_version}" $postgres_confdir = "/etc/postgresql/${zulip::base::postgres_version}/main" + $postgres_datadir = "/var/lib/postgresql/${zulip::base::postgres_version}/main" $tsearch_datadir = "${postgres_sharedir}/tsearch_data" $pgroonga_setup_sql_path = "${postgres_sharedir}/pgroonga_setup.sql" $setup_system_deps = 'setup_apt_repo' @@ -20,6 +21,7 @@ class zulip::postgres_appdb_base { $postgresql = "postgresql${zulip::base::postgres_version}" $postgres_sharedir = "/usr/pgsql-${zulip::base::postgres_version}/share" $postgres_confdir = "/var/lib/pgsql/${zulip::base::postgres_version}/data" + $postgres_datadir = "/var/lib/pgsql/${zulip::base::postgres_version}/data" $tsearch_datadir = "${postgres_sharedir}/tsearch_data/" $pgroonga_setup_sql_path = "${postgres_sharedir}/pgroonga_setup.sql" $setup_system_deps = 'setup_yum_repo' diff --git a/puppet/zulip/manifests/postgres_appdb_tuned.pp b/puppet/zulip/manifests/postgres_appdb_tuned.pp index aa50f86434..d85ae50cfa 100644 --- a/puppet/zulip/manifests/postgres_appdb_tuned.pp +++ b/puppet/zulip/manifests/postgres_appdb_tuned.pp @@ -17,8 +17,6 @@ class zulip::postgres_appdb_tuned { $ssl_key_file = zulipconf('postgresql', 'ssl_key_file', undef) $ssl_ca_file = zulipconf('postgresql', 'ssl_ca_file', undef) - # Only used in CentOS for now - $pg_datadir = "/var/lib/pgsql/${zulip::base::postgres_version}/data" $postgres_conf_file = "${zulip::postgres_appdb_base::postgres_confdir}/postgresql.conf" file { $postgres_conf_file: diff --git a/puppet/zulip/templates/postgresql/10/postgresql.conf.centos.template.erb b/puppet/zulip/templates/postgresql/10/postgresql.conf.centos.template.erb index cfe5420e54..8256245091 100644 --- a/puppet/zulip/templates/postgresql/10/postgresql.conf.centos.template.erb +++ b/puppet/zulip/templates/postgresql/10/postgresql.conf.centos.template.erb @@ -38,7 +38,7 @@ # The default values of these variables are driven from the -D command-line # option or PGDATA environment variable, represented here as ConfigDir. -data_directory = '<%= scope["zulip::postgres_appdb_tuned::pg_datadir"] %>' # use data in another directory +data_directory = '<%= scope["zulip::postgres_appdb_base::postgres_datadir"] %>' # use data in another directory # (change requires restart) hba_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_hba.conf' # host-based authentication file # (change requires restart) diff --git a/puppet/zulip/templates/postgresql/10/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/10/postgresql.conf.template.erb index 50775ca7f3..2c71081a6d 100644 --- a/puppet/zulip/templates/postgresql/10/postgresql.conf.template.erb +++ b/puppet/zulip/templates/postgresql/10/postgresql.conf.template.erb @@ -38,7 +38,7 @@ # The default values of these variables are driven from the -D command-line # option or PGDATA environment variable, represented here as ConfigDir. -data_directory = '/var/lib/postgresql/<%= scope["zulip::base::postgres_version"] %>/main' # use data in another directory +data_directory = '<%= scope["zulip::postgres_appdb_base::postgres_datadir"] %>' # use data in another directory # (change requires restart) hba_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_hba.conf' # host-based authentication file # (change requires restart) diff --git a/puppet/zulip/templates/postgresql/11/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/11/postgresql.conf.template.erb index 50775ca7f3..2c71081a6d 100644 --- a/puppet/zulip/templates/postgresql/11/postgresql.conf.template.erb +++ b/puppet/zulip/templates/postgresql/11/postgresql.conf.template.erb @@ -38,7 +38,7 @@ # The default values of these variables are driven from the -D command-line # option or PGDATA environment variable, represented here as ConfigDir. -data_directory = '/var/lib/postgresql/<%= scope["zulip::base::postgres_version"] %>/main' # use data in another directory +data_directory = '<%= scope["zulip::postgres_appdb_base::postgres_datadir"] %>' # use data in another directory # (change requires restart) hba_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_hba.conf' # host-based authentication file # (change requires restart) diff --git a/puppet/zulip/templates/postgresql/12/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/12/postgresql.conf.template.erb index 04708bc717..245008cf30 100644 --- a/puppet/zulip/templates/postgresql/12/postgresql.conf.template.erb +++ b/puppet/zulip/templates/postgresql/12/postgresql.conf.template.erb @@ -38,7 +38,7 @@ # The default values of these variables are driven from the -D command-line # option or PGDATA environment variable, represented here as ConfigDir. -data_directory = '/var/lib/postgresql/<%= scope["zulip::base::postgres_version"] %>/main' # use data in another directory +data_directory = '<%= scope["zulip::postgres_appdb_base::postgres_datadir"] %>' # use data in another directory # (change requires restart) hba_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_hba.conf' # host-based authentication file # (change requires restart) diff --git a/puppet/zulip/templates/postgresql/9.3/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/9.3/postgresql.conf.template.erb index 6d722e22c1..a1c48be110 100644 --- a/puppet/zulip/templates/postgresql/9.3/postgresql.conf.template.erb +++ b/puppet/zulip/templates/postgresql/9.3/postgresql.conf.template.erb @@ -38,7 +38,7 @@ # The default values of these variables are driven from the -D command-line # option or PGDATA environment variable, represented here as ConfigDir. -data_directory = '/var/lib/postgresql/<%= scope["zulip::base::postgres_version"] %>/main' # use data in another directory +data_directory = '<%= scope["zulip::postgres_appdb_base::postgres_datadir"] %>' # use data in another directory # (change requires restart) hba_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_hba.conf' # host-based authentication file # (change requires restart) diff --git a/puppet/zulip/templates/postgresql/9.5/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/9.5/postgresql.conf.template.erb index 1765cc2271..4f2419c32a 100644 --- a/puppet/zulip/templates/postgresql/9.5/postgresql.conf.template.erb +++ b/puppet/zulip/templates/postgresql/9.5/postgresql.conf.template.erb @@ -38,7 +38,7 @@ # The default values of these variables are driven from the -D command-line # option or PGDATA environment variable, represented here as ConfigDir. -data_directory = '/var/lib/postgresql/<%= scope["zulip::base::postgres_version"] %>/main' # use data in another directory +data_directory = '<%= scope["zulip::postgres_appdb_base::postgres_datadir"] %>' # use data in another directory # (change requires restart) hba_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_hba.conf' # host-based authentication file # (change requires restart) diff --git a/puppet/zulip/templates/postgresql/9.6/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/9.6/postgresql.conf.template.erb index d9be00be43..4bacaa257a 100644 --- a/puppet/zulip/templates/postgresql/9.6/postgresql.conf.template.erb +++ b/puppet/zulip/templates/postgresql/9.6/postgresql.conf.template.erb @@ -38,7 +38,7 @@ # The default values of these variables are driven from the -D command-line # option or PGDATA environment variable, represented here as ConfigDir. -data_directory = '/var/lib/postgresql/<%= scope["zulip::base::postgres_version"] %>/main' # use data in another directory +data_directory = '<%= scope["zulip::postgres_appdb_base::postgres_datadir"] %>' # use data in another directory # (change requires restart) hba_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_hba.conf' # host-based authentication file # (change requires restart)