fuel-library/deployment/puppet/ceph/manifests/mon.pp
Michael Polenchuk e06b469285 Fix ceph mon/radosgw execs
Add checks to ceph mon/radosgw execs
to prevent trigger them each run.

Change-Id: I4fafcd3ecd0c74c0ca7a30f0699014d93b060c1d
Closes-Bug: #1526867
2016-01-25 17:54:16 +03:00

58 lines
1.8 KiB
Puppet

# setup Ceph monitors
class ceph::mon (
$mon_hosts = $::ceph::mon_hosts,
$mon_ip_addresses = $::ceph::mon_ip_addresses,
$mon_addr = $::ceph::mon_addr,
$node_hostname = $::ceph::node_hostname,
) {
firewall {'010 ceph-mon allow':
chain => 'INPUT',
dport => 6789,
proto => 'tcp',
action => accept,
}
exec {'ceph-deploy mon create':
command => "ceph-deploy mon create ${node_hostname}:${mon_addr}",
logoutput => true,
unless => "ceph mon dump | grep -qE '^[0-9]+: +${mon_addr}:.* mon\\.${node_hostname}\$'",
}
exec {'Wait for Ceph quorum':
command => "ceph mon stat | grep -q 'quorum.*${node_hostname}'",
tries => 12, # This is necessary to prevent a race: mon must establish
# a quorum before it can generate keys, observed this takes upto 15 seconds
# Keys must exist prior to other commands running
try_sleep => 5,
refreshonly => true,
}
exec {'ceph-deploy gatherkeys':
command => "ceph-deploy gatherkeys ${node_hostname}",
creates => ['/root/ceph.bootstrap-mds.keyring',
'/root/ceph.bootstrap-osd.keyring',
'/root/ceph.client.admin.keyring',
],
}
Firewall['010 ceph-mon allow'] ->
Exec['ceph-deploy mon create'] ~>
Exec['Wait for Ceph quorum'] ->
Exec['ceph-deploy gatherkeys']
if $node_hostname == $::ceph::primary_mon {
# After the primary monitor has established a quorum, it is safe to
# add other monitors to ceph.conf. All other Ceph nodes will get
# these settings via 'ceph-deploy config pull' in ceph::conf.
ceph_conf {
'global/mon_host': value => join($mon_ip_addresses, ' ');
'global/mon_initial_members': value => join($mon_hosts, ' ');
}
Ceph_conf[['global/mon_host', 'global/mon_initial_members']] ->
Exec['Wait for Ceph quorum']
}
}