它正在尝试通过p将“副本”用户添加到我的postgres服务器中,以便我可以在我的主从群集中使用它。
当我手动执行操作(“创建角色副本加密密码'123';”)时,它确实可以工作,但是由于某些原因,它无法从人偶中起作用。
从人偶中我得到了错误:
错误:/ Stage [main] / Role :: Ofir_testing / Postgresql :: Server :: Role [replica] / Postgresql_psql [CREATE ROLE副本ENCRYPTED PASSWORD ****]:无法评估:错误评估'unless'子句,返回pid 2064出口1:“
通知:/ Stage [main] /角色:: Ofir_testing / Postgresql :: Server ::角色[replica] / Postgresql_psql [ALTER ROLE“ replica” NOSUPERUSER]:依赖Postgresql_psql [CREATE ROLE副本加密的密码****]失败:是
这是我的pp文件:
class { 'postgresql::globals':
manage_package_repo => true,
version => $pg_version,
}
class { 'postgresql::server':
ip_mask_deny_postgres_user => '0.0.0.0/32',
ip_mask_allow_all_users => '0.0.0.0/0',
listen_addresses => "localhost,${master_IP_address}",
}
postgresql::server::config_entry { 'archive_mode':
value => 'on',
}
postgresql::server::config_entry { 'archive_command':
value => "cp %p /var/lib/postgresql/${pg_version}/main/archive/%f",
}
postgresql::server::config_entry { 'wal_level':
value => 'hot_standby',
}
postgresql::server::config_entry { 'synchronous_commit':
value => 'local',
}
postgresql::server::config_entry { 'max_wal_senders':
value => '2',
}
postgresql::server::config_entry { 'wal_keep_segments':
value => '10',
}
file { "/var/lib/postgresql/${pg_version}/main/archive/":
ensure => 'directory',
owner => 'postgres',
group => 'postgres',
mode => '700',
recurse => true,
}
postgresql::server::pg_hba_rule { "Allow ${user} a replication connection from Localhost":
description => 'Open up access from 127.0.0.1/32',
type => 'host',
database => 'replication',
user => 'replica',
address => '127.0.0.1/32',
auth_method => 'md5',
}
postgresql::server::pg_hba_rule { "Allow ${user} replication connection from Master":
description => 'Open up access from master',
type => 'host',
database => 'replication',
user => 'replica',
address => "${master_IP_address}/32",
auth_method => 'md5',
}
postgresql::server::pg_hba_rule { "Allow ${user} replication connection from Slave":
description => 'Open up access from slave',
type => 'host',
database => 'replication',
user => 'replica',
address => "${slave_IP_address}/32",
auth_method => 'md5',
}
postgresql::server::role { "${user}":
password_hash => postgresql_password("${user}", "${password}"),
replication => true,
connection_limit => 1,
}
错误在“角色”中。 我试图添加
user => 'postgres',
group => 'postgres',
到“ postgresql :: server”,但没有帮助。
唯一有用的是删除“ manage_package_repo => true” 来自'postgresql :: globals',但尝试安装非默认版本的postgres时出现问题。
答案 0 :(得分:0)
我已修复它,这是由于在创建服务器之前应用了postgresql :: server :: role而导致的。 这是解决方案,多亏了Eimhin https://tickets.puppetlabs.com/browse/MODULES-8824