Skip to content
Snippets Groups Projects
storage.pp 5.06 KiB
Newer Older
  • Learn to ignore specific revisions
  • Quentin Machu's avatar
    Quentin Machu committed
    class iaas::role::storage (
    
    
    ##CEPH Secrets
    $secret_client_admin            = 'AQDgL/hUSC2kLBAAnWJaSiqJG+YMk+XV9sapnw==',
    $secret_client_bootstraposd     = 'AQDlL/hUUCpdFBAAZeo6mKj4yeKPmVKfUY5awA==',
    $secret_client_glance           = 'AQBgGdJUCPwjLRAARZ0KEaxewYcYHT3j5Gl5Cg==',
    $secret_client_cinder           = 'AQAvxQpVKJ03KxAADFv78tedrAWZx1SoRdsQUA==',
    $secret_client_cinderbackup     = 'AQBKvuVUMHvaGhAADT6nvBv9LFs7dqpB8Kis0Q==',
    $bootstrap_mds_key		= 'AQBxkvVU4F+VDBAArxUf+8s0LbxIxNrbyEC1kw==',
    $mon_key			= 'AQApksZUIJhXJxAAEHVW/dbL1OeLA7Om++zdVw==',
    
    ##CEPH 
    $fsid = 'f65809d3-7961-4cd7-b731-a9bc94bc6e9c',
    # Uncomment if auth_type is different from 'cephx'
    #authentication_type = 'cephx',
    $mon_initial_members = 'ocp-05,ocp-06,ocp-07',
    $mon_host = '10.10.98.43,10.10.98.44,10.10.98.45',
    $osd_pool_default_size = '3', 
    $osd_pool_default_min_size = '2',
    $cluster_network = '10.10.98.0/24',
    $public_network = '10.10.98.0/24',
    $osd_journal_size = '2048',
    
    
    ##Old implementation (pseudo hash)
    #$ceph_osd1 = ['/dev/vdb,/osd1','/dev/vdc,/osd2'],
    #$ceph_pool1 = ['images,128', 'volumes,128', 'vms,128', 'backups,128'],
    ##New implementation (hash array)
    #$ceph_pool2 = [{"pool" => "images", "pg_num" => "128"}, 
    #               {"pool" => "volumes", "pg_num" => "128"},
    #               {"pool" => "vms", "pg_num" => "128"},
    #               {"pool" => "backups", "pg_num" => "128"}],
    #$ceph_osd2  = [{"partition" => "/dev/vdb", "journal" => "/osd1"}, 
    #               {"partition" => "/dev/vdc", "journal" => "/osd2"}],
    ##New implementation (hash)
    #$ceph_pool3 =  {'images'  => { pg_num => '128'},
    #                'volumes' => { pg_num => '128'},
    #                'vms'     => { pg_num => '128'},
    #                'backups' => { pg_num => '128'}},
    #$ceph_osd3  =  {'/dev/vdb'=> { journal => '/osd1'},  
    #                '/dev/vdc'=> { journal => '/osd2'}},
    
    $ceph_pool =  {'images'  => { pg_num => '128'},
                   'volumes' => { pg_num => '128'},
                   'vms'     => { pg_num => '128'},
                   'backups' => { pg_num => '128'}},
    $ceph_osd  =  {'/dev/vdb'=> { journal => '/osd1'},                       
                   '/dev/vdc'=> { journal => '/osd2'}},
    
    
    Quentin Machu's avatar
    Quentin Machu committed
    
    
    #foo::map {$ceph_osd1:}
    #define foo::map () { notify {$name["title"]: } }
    
    
    # Ceph
    ##OSD
    
      create_resources( ceph::osd, $ceph_osd )
    #  iaas::resources::ceph::cephosd { $ceph_osd2: }
    #  ceph::osd {$ceph_osd2: }
    
    
    ##POOL
      create_resources( ceph::pool, $ceph_pool )
    #  iaas::resources::ceph::cephpool { $ceph_pool2: }
    #  ceph::pool { 
    #                'images':
    #                  pg_num => 128;
    #                'volumes':
    #                  pg_num => 128;
    #                'vms':
    #                  pg_num => 128;
    #                'backups':
    #                  pg_num => 128,
    #  } 
    
    ##KEY
    
      ceph::key {
       'client.admin':
         secret => $secret_client_admin,
         cap_mon => 'allow *',
         cap_osd => 'allow *',
         cap_mds => 'allow',
         inject => 'true',
         inject_as_id => 'mon.',
         inject_keyring => "/var/lib/ceph/mon/ceph-$::hostname/keyring";
    
       'client.bootstrap-osd':
         secret => $secret_client_bootstraposd,
         cap_mon => 'allow profile bootstrap-osd',
         keyring_path => '/var/lib/ceph/bootstrap-osd/ceph.keyring',
         inject => 'true',
         inject_as_id => 'mon.',
         inject_keyring => "/var/lib/ceph/mon/ceph-$::hostname/keyring";
    
       'client.glance':
         secret => $secret_client_glance,
         cap_mon => 'allow r',
         cap_osd => 'allow class-read object_prefix rbd_children, allow rwx pool=images',
         inject => 'true',
         inject_as_id => 'mon.',
         inject_keyring => "/var/lib/ceph/mon/ceph-$::hostname/keyring";
    
       'client.cinder':
         secret => $secret_client_cinder,
         cap_mon => 'allow r',
         cap_osd => 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images',
         inject => 'true',
         inject_as_id => 'mon.',
         inject_keyring => "/var/lib/ceph/mon/ceph-$::hostname/keyring";
     
       'client.cinder-backup':
         secret => $secret_client_cinderbackup,
         cap_mon => 'allow r',
         cap_osd => 'allow class-read object_prefix rbd_children, allow rwx pool=backups',
         inject => 'true',
         inject_as_id => 'mon.',
         inject_keyring => "/var/lib/ceph/mon/ceph-$::hostname/keyring",
      } 
    
    
     # Base
      class { 'iaas::profile::base': } ->
    
      # CEPH
      class {'ceph::profile::params':
         fsid => $fsid,
    # Uncomment if auth_type is different from 'cephx'
         #authentication_type => 'cephx',
         mon_initial_members => $mon_initial_members,
         mon_host => $mon_host,
         osd_pool_default_pg_num => '100',
         osd_pool_default_pgp_num => '100',
         osd_pool_default_size => $osd_pool_default_size,
         osd_pool_default_min_size => $osd_pool_default_min_size,
         cluster_network => $cluster_network,
         public_network => $public_network,
         mon_key => $mon_key,
         osd_journal_size => $osd_journal_size,
      } ->
    
    Quentin Machu's avatar
    Quentin Machu committed
      class { 'ceph::profile::base': } ->
      class { 'ceph::profile::mon': } ->
      class { 'ceph::keys': } ->
    
      class { 'ceph::osds': }
    
    Quentin Machu's avatar
    Quentin Machu committed
    }