diff --git a/data/defaults.yaml b/data/defaults.yaml new file mode 100644 index 00000000..60ae32fb --- /dev/null +++ b/data/defaults.yaml @@ -0,0 +1,5 @@ +gitlab::pgpass_file_attrs: + ensure: 'absent' + path: '/home/gitlab-consul/.pgpass' + owner: 'gitlab-consul' + group: 'gitlab-consul' diff --git a/manifests/host_config.pp b/manifests/host_config.pp index 92b7d651..7a076469 100644 --- a/manifests/host_config.pp +++ b/manifests/host_config.pp @@ -12,6 +12,8 @@ $skip_auto_migrations = $gitlab::skip_auto_migrations, $skip_auto_reconfigure = $gitlab::skip_auto_reconfigure, $store_git_keys_in_db = $gitlab::store_git_keys_in_db, + $pgpass_file_attrs = $gitlab::pgpass_file_attrs, + $pgbouncer_password = $gitlab::pgbouncer_password, ) { file { $config_dir: @@ -77,5 +79,14 @@ } } + unless ($pgpass_file_attrs[ensure] == 'present' and empty($pgbouncer_password)){ + file { "pgpass": + * => $pgpass_file_attrs, + content => template('gitlab/.pgpass.erb'), + } + } else { + fail('A password must be provided to $pgbouncer_password if $pgpass_file_attrs[ensure] = "present"') + } + include gitlab::backup } diff --git a/manifests/init.pp b/manifests/init.pp index f5f3162d..e2d5fefb 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -316,6 +316,7 @@ # artifacts, lfs, registry, pages # class gitlab ( + Hash $pgpass_file_attrs, # package configuration String $package_ensure = 'installed', Optional[String] $edition = undef, @@ -361,6 +362,7 @@ Optional[Hash] $nginx = undef, Optional[Hash] $node_exporter = undef, Optional[Hash] $redis_exporter = undef, + Optional[String] $pgbouncer_password = undef, Optional[Hash] $postgres_exporter = undef, Optional[Hash] $gitlab_monitor = undef, Optional[String] $pages_external_url = undef, diff --git a/templates/.pgpass.erb b/templates/.pgpass.erb new file mode 100644 index 00000000..47163b6e --- /dev/null +++ b/templates/.pgpass.erb @@ -0,0 +1 @@ +127.0.0.1:*:pgbouncer:pgbouncer:<%= @pgbouncer_password -%>