1 #Copyright 2015 Open Platform for NFV Project, Inc. and its contributors
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 #Class installs and configures a ceph cluster
16 #Creates a single OSD per host and configures host as a monitor
17 #Inserts authentication keyrings for volumes and images users
18 #Creates OSD pools for volumes and images (needed by OpenStack)
19 #Depends on puppet module: https://github.com/stackforge/puppet-ceph/
21 class opnfv::ceph_deploy (
22 $fsid = '904c8491-5c16-4dae-9cc3-6ce633a7f4cc',
23 $osd_pool_default_pg_num = '128',
24 $osd_pool_default_size = '1',
25 $osd_pool_default_min_size = '1',
26 $mon_initial_members = '',
28 $cluster_network = "10.4.8.0/21",
29 $public_network = "10.4.8.0/21",
30 $osd_journal_size = '1000',
32 $mon_key = 'AQDcvhVV+H08DBAA5/0GGcfBQxz+/eKAdbJdTQ==',
33 $admin_key = 'AQDcvhVV+H08DBAA5/0GGcfBQxz+/eKAdbJdTQ==',
34 $images_key = 'AQAfHBdUKLnUFxAAtO7WPKQZ8QfEoGqH0CLd7A==',
35 $volumes_key = 'AQAfHBdUsFPTHhAAfqVqPq31FFCvyyO7oaOQXw==',
36 $boostrap_key = 'AQDcvhVV+H08DBAA5/0GGcfBQxz+/eKAdbJdTQ==',
41 osd_pool_default_pg_num => $osd_pool_default_pg_num,
42 osd_pool_default_size => $osd_pool_default_size,
43 osd_pool_default_min_size => $osd_pool_default_min_size,
44 mon_initial_members => $mon_initial_members,
45 mon_host => $mon_host,
46 cluster_network => $cluster_network,
47 public_network => $public_network,
51 'global/osd_journal_size': value => $osd_journal_size;
54 ceph::mon { $::hostname:
55 public_addr => $osd_ip,
61 inject_as_id => 'mon.',
62 inject_keyring => "/var/lib/ceph/mon/ceph-${::hostname}/keyring",
65 ceph::key { 'client.admin':
72 ceph::key { 'client.images':
73 secret => $images_key,
75 cap_osd => 'allow class-read object_prefix rbd_children, allow rwx pool=images',
80 ceph::key { 'client.volumes':
81 secret => $volumes_key,
83 cap_osd => 'allow class-read object_prefix rbd_children, allow rwx pool=volumes',
87 ceph::key { 'client.bootstrap-osd':
88 secret => $boostrap_key,
89 cap_mon => 'allow profile bootstrap-osd',
90 keyring_path => '/var/lib/ceph/bootstrap-osd/ceph.keyring',
93 ceph::osd { '/osd0': }
95 exec { 'create volumes pool':
96 command => "/usr/bin/ceph osd pool create volumes $osd_pool_default_pg_num",
99 exec { 'create images pool':
100 command => "/usr/bin/ceph osd pool create images $osd_pool_default_pg_num",