Make sure rabbitmq is fully up before creating any rabbitmq resources

Right now after creating the rabbitmq pacemaker resource, we have no
guarantee that rabbit will be up. Let's add the same mechanism we use
today with the galera-ready exec resource. This gives us the guarantee
that once the resource has been created it is up and we can actually
create rabbitmq users (some 3rd party plugins do that, not stock
TripleO).

Specifically, we probe that the '{rabbit,' app shows up in the status,
so we can guarantee that rabbit is running before invoking any other
rabbitmqctl commands.

Change-Id: Ib37eb2e591f97de54ee6449817ae8d70c6541753
Co-Authored-By: Damien Ciabrini <dciabrin@redhat.com>
This commit is contained in:
Michele Baldessari 2017-11-15 16:39:57 +01:00
parent 6de807951f
commit b2dc580a3f
2 changed files with 35 additions and 0 deletions

View File

@ -111,7 +111,24 @@ class tripleo::profile::pacemaker::rabbitmq (
},
require => [Class['::rabbitmq'],
Pacemaker::Property['rabbitmq-role-node-property']],
notify => Exec['rabbitmq-ready'],
}
# This grep makes sure the rabbit app in erlang is up and running
# which is enough to guarantee that the user will eventually get
# replicated around the cluster
exec { 'rabbitmq-ready':
path => '/usr/sbin:/usr/bin:/sbin:/bin',
command => 'rabbitmqctl status | grep -F "{rabbit,"',
timeout => 30,
tries => 180,
try_sleep => 10,
refreshonly => true,
tag => 'rabbitmq_ready',
}
# Make sure that if we create rabbitmq users at the same step it happens
# after the cluster is up
Exec['rabbitmq-ready'] -> Rabbitmq_user<||>
Exec['rabbitmq-ready'] -> Rabbitmq_policy<||>
}
}
}

View File

@ -217,7 +217,25 @@ class tripleo::profile::pacemaker::rabbitmq_bundle (
bundle => 'rabbitmq-bundle',
require => [Class['::rabbitmq'],
Pacemaker::Resource::Bundle['rabbitmq-bundle']],
notify => Exec['rabbitmq-ready'],
}
# This grep makes sure the rabbit app in erlang is up and running
# which is enough to guarantee that the user will eventually get
# replicated around the cluster
exec { 'rabbitmq-ready':
path => '/usr/sbin:/usr/bin:/sbin:/bin',
command => 'rabbitmqctl status | grep -F "{rabbit,"',
timeout => 30,
tries => 180,
try_sleep => 10,
refreshonly => true,
tag => 'rabbitmq_ready',
}
# Make sure that if we create rabbitmq users at the same step it happens
# after the cluster is up
Exec['rabbitmq-ready'] -> Rabbitmq_user<||>
Exec['rabbitmq-ready'] -> Rabbitmq_policy<||>
}
}
}