Puppet Resource Ordering无法正常工作

时间:2016-10-29 05:22:14

标签: puppet openstack puppet-enterprise

我有一个大型清单,用于设置一个OpenStack Controller节点,该节点还将HAProxy,Galera和RabbitMQ共同位于同一主机上。我遇到了问题,因为HAProxy服务似乎总是最开始的。这会产生问题,因为我想通过HAProxies VIP连接到Galera数据库集群。因此,各种OpenStack服务的所有尝试都无法设置其关系数据库表。如果HAProxy服务首先启动,这不会是一个问题。我已经尝试了各种各样的东西来让我的木偶清单强制应用我的HAProxy配置文件。这是我尝试过的几件事:

    #Service <|name=='haproxy' or name=='keepalived'|> -> Exec <| |>
    #Exec<| title == 'nova-db-sync' |> ~> Service<| title == $nova_title |>
    #Service<| title == 'haproxy' |> ~> Exec<| title == 'nova-db-sync' |>
    #Service<| title == 'haproxy' |> ~> Exec<| title == 'Exec[apic-ml2-db-manage --config-file /etc/neutron/neutron.conf upgrade head]' |>

     Service['haproxy'] -> Exec['keystone-manage db_sync']
    #Class ['wraphaproxy'] -> Class ['wrapgalera'] -> Class['wraprabbitmq'] -> Class['keystone']
# -> Class['wraprabbitmq'] -> Class['keystone']
#
#   setup HAproxy
notify { "This host ${ipaddress} is in ${haproxy_ipaddress}":}
    if ( $ipaddress in $haproxy_ipaddress ) {
notify { "This host is an haproxy host ${ipaddress} is in ${haproxy_ipaddress}":}
       require wraphaproxy
#       class { 'wraphaproxy':
#           before => [
#              Class['wrapgalera'],
#              Class['wraprabbitmq'],
#              Class['keystone'],
#              Class['glance'],
#              Class['cinder'],
#              Class['neutron'],
#              Class['nova'],
#              Class['ceilometer'],
#              Class['horizon'],
#              Class['heat'],
#           ]
#       }
    }

class wraphaproxy是配置和启动HAProxy服务的类。似乎无论我做什么,OpenStack Puppet模块都会在HAProxy服务准备好之前尝试进行“db sync”。

1 个答案:

答案 0 :(得分:0)

行。事实证明,我需要使用HAProxy::Service['haproxy']而不是Service['haproxy']。所以我在我的代码中有这个:

 Haproxy::Service['haproxy'] -> Exec['keystone-manage db_sync']
 Haproxy::Service['haproxy'] -> Exec['glance-manage db_sync']
 Haproxy::Service['haproxy'] -> Exec['nova-db-sync']
 Haproxy::Service['haproxy'] -> Exec['glance-manage db_sync']
 Haproxy::Service['haproxy'] -> Exec['neutron-db-sync']
 Haproxy::Service['haproxy'] -> Exec['heat-dbsync']
 Haproxy::Service['haproxy'] -> Exec['ceilometer-dbsync']
 Haproxy::Service['haproxy'] -> Exec['cinder-manage db_sync']

如果有人知道通过使用锚点或资源收集者更好的方式,请回复。