begin
require 'etc'
- %w{git}.each do |user|
+ %w{git postgres}.each do |user|
Facter.add("#{user}_user_exists") do
setcode do
result = false
end
end
- Facter.add("postgresql_key") do
- setcode do
- key = nil
- keyfile = '/var/lib/postgresql/.ssh/id_rsa.pub'
- if FileTest.exist?(keyfile)
- key = File.open(keyfile).read.chomp
- end
- key
- end
- end
-
Facter.add("staticsync_key") do
setcode do
key = nil
#
define postgres::backup_server::register_backup_clienthost (
- $sshpubkey = $::postgresql_key,
+ $sshpubkey = $::postgres_key,
$ipaddrlist = join(getfromhash($site::nodeinfo, 'ldap', 'ipHostNumber'), ","),
$hostname = $::hostname,
) {
content => template('roles/postgresql_server/pg-backup-file.conf.erb'),
}
- if ! $::postgresql_key {
- exec { 'create-postgresql-key':
+ if ! $::postgres_key {
+ exec { 'create-postgres-key':
command => '/bin/su - postgres -c \'mkdir -p -m 02700 .ssh && ssh-keygen -C "`whoami`@`hostname` (`date +%Y-%m-%d`)" -P "" -f .ssh/id_rsa -q\'',
onlyif => '/usr/bin/getent passwd postgres > /dev/null && ! [ -e /var/lib/postgresql/.ssh/id_rsa ]'
}
"mptraid": false,
"aacraid": false,
"swraid": false,
- "postgresql_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1eOzsdKsfcHFyn4fimLNeT8+KhtDqtRceH71j6k3yBUzsNzdQyjx+iSNONRLB7VYGuhRI8o1uZ4kLnpVZLDBGswBKg8Ndf89l36Fsw3BtCsgGITALWKPJ3mW3YToofbQtq9NWY9bkjA4KoUmIK4c/BJzdX6TvF8H1lWvsdphONe6p8Po3USvo5VQaQcxWzPcGlzKwsaX4djn+UVVPr+CsCZqXW9SOFxOEZEDCn4hIiJnVzh1/r0aOJfFWXrXRLmGX1CJwMUCUVZc4g39mPFfEzh0gWxPmMSP5Q0vsYK7RgQH+JKdmxYiqasfY06px87Wp5Xl2+UzToHUURSOnM+s3 postgres@godard (2017-09-01)",
+ "postgres_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1eOzsdKsfcHFyn4fimLNeT8+KhtDqtRceH71j6k3yBUzsNzdQyjx+iSNONRLB7VYGuhRI8o1uZ4kLnpVZLDBGswBKg8Ndf89l36Fsw3BtCsgGITALWKPJ3mW3YToofbQtq9NWY9bkjA4KoUmIK4c/BJzdX6TvF8H1lWvsdphONe6p8Po3USvo5VQaQcxWzPcGlzKwsaX4djn+UVVPr+CsCZqXW9SOFxOEZEDCn4hIiJnVzh1/r0aOJfFWXrXRLmGX1CJwMUCUVZc4g39mPFfEzh0gWxPmMSP5Q0vsYK7RgQH+JKdmxYiqasfY06px87Wp5Xl2+UzToHUURSOnM+s3 postgres@godard (2017-09-01)",
"staticsync_user_exists": false,
"weblogsync_user_exists": false,
"buildd_user_exists": false,
"puppet_server": "puppet",
"systemproductname": "Sun Fire X4200 Server",
"hw_can_temp_sensors": false,
- "postgresql_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDH4f+v9s9qvOX028ZEiaxxvpj+VOlQ0tT5rtsJ1Q5tp9tZM1KVnM3EIgEmaDE5x4aXgdmfEpAEAl5Uq5Eyv1vh8a7VIvvlaYz6UXqp8fgljAUTKsP1RwB31PxqZ2xXXS/UPY7Ubrcxz+L/Jl0hrWh7PTC1waMZDOXeqPKUdpLOQJi+RmprrbfxGkTtASwpfRl5fCLcNFKA97flN6Sfg01m8kqHVHmoBstQcQzVEWmUSf3USFmJ0bzrOUEL4qi9Mh/7+YTlCfcwWhDHMrtg6dzB0HbE7U1DjcG70ZCVdoPhqAMm+GU011VrC1mY8Tba54CK0oUcAVvoakLYhvpEHNLb postgres@sibelius (20101213)",
+ "postgres_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDH4f+v9s9qvOX028ZEiaxxvpj+VOlQ0tT5rtsJ1Q5tp9tZM1KVnM3EIgEmaDE5x4aXgdmfEpAEAl5Uq5Eyv1vh8a7VIvvlaYz6UXqp8fgljAUTKsP1RwB31PxqZ2xXXS/UPY7Ubrcxz+L/Jl0hrWh7PTC1waMZDOXeqPKUdpLOQJi+RmprrbfxGkTtASwpfRl5fCLcNFKA97flN6Sfg01m8kqHVHmoBstQcQzVEWmUSf3USFmJ0bzrOUEL4qi9Mh/7+YTlCfcwWhDHMrtg6dzB0HbE7U1DjcG70ZCVdoPhqAMm+GU011VrC1mY8Tba54CK0oUcAVvoakLYhvpEHNLb postgres@sibelius (20101213)",
"staticsync_user_exists": false,
"weblogsync_user_exists": false,
"buildd_user_exists": false,