Fuel Library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

radosgw.pp 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. class osnailyfacter::ceph::radosgw {
  2. notice('MODULAR: ceph/radosgw.pp')
  3. $gateway_name = 'radosgw.gateway'
  4. $storage_hash = hiera('storage', {})
  5. $radosgw_key = $storage_hash['radosgw_key']
  6. $fsid = $storage_hash['fsid']
  7. $rgw_log_file = '/var/log/ceph/radosgw.log'
  8. $use_syslog = hiera('use_syslog', true)
  9. $rgw_large_pool_name = '.rgw'
  10. $rgw_large_pool_pg_nums = pick($storage_hash['per_pool_pg_nums'][$rgw_large_pool_name], '512')
  11. $keystone_hash = hiera('keystone', {})
  12. $rgw_keystone_accepted_roles = pick($storage_hash['radosgw_keystone_accepted_roles'], '_member_, Member, admin, swiftoperator')
  13. $rgw_keystone_revocation_interval = '1000000'
  14. $rgw_keystone_token_cache_size = '10'
  15. $rgw_init_timeout = pick($storage_hash['rgw_init_timeout'], '360000')
  16. $auth_s3_keystone_ceph = pick($storage_hash['auth_s3_keystone_ceph'], false)
  17. $service_endpoint = hiera('service_endpoint')
  18. $management_vip = hiera('management_vip')
  19. $ssl_hash = hiera_hash('use_ssl', {})
  20. $admin_identity_protocol = get_ssl_property($ssl_hash, {}, 'keystone', 'admin', 'protocol', 'http')
  21. $admin_identity_address = get_ssl_property($ssl_hash, {}, 'keystone', 'admin', 'hostname', [$service_endpoint, $management_vip])
  22. $admin_identity_url = "${admin_identity_protocol}://${admin_identity_address}:35357"
  23. prepare_network_config(hiera_hash('network_scheme'))
  24. $ceph_cluster_network = get_network_role_property('ceph/replication', 'network')
  25. $ceph_public_network = get_network_role_property('ceph/public', 'network')
  26. $mon_address_map = get_node_to_ipaddr_map_by_network_role(hiera_hash('ceph_monitor_nodes'), 'ceph/public')
  27. $mon_ips = join(sorted_hosts($mon_address_map, 'ip'), ',')
  28. $mon_hosts = join(sorted_hosts($mon_address_map, 'host'), ',')
  29. if $storage_hash['objects_ceph'] {
  30. if empty($fsid) {
  31. fail('Please provide fsid')
  32. }
  33. if empty($radosgw_key) {
  34. fail('Please provide radosgw_key')
  35. }
  36. ceph::key { "client.${gateway_name}":
  37. keyring_path => "/etc/ceph/client.${gateway_name}",
  38. user => 'ceph',
  39. group => 'ceph',
  40. secret => $radosgw_key,
  41. cap_mon => 'allow rw',
  42. cap_osd => 'allow rwx',
  43. inject => true,
  44. }
  45. class { 'ceph':
  46. fsid => $fsid,
  47. }
  48. include ::ceph::params
  49. #######################################
  50. # TODO (omolchanov): Remove template once we switch to systemd
  51. #######################################
  52. file { '/etc/init/radosgw.conf':
  53. ensure => present,
  54. content => template('osnailyfacter/radosgw-init.erb'),
  55. before => Ceph::Rgw[$gateway_name],
  56. }
  57. #######################################
  58. ceph::rgw { $gateway_name:
  59. frontend_type => 'civetweb',
  60. rgw_frontends => 'civetweb port=7480',
  61. rgw_print_continue => true,
  62. keyring_path => "/etc/ceph/client.${gateway_name}",
  63. rgw_data => "/var/lib/ceph/radosgw-${gateway_name}",
  64. rgw_dns_name => "*.${::domain}",
  65. log_file => undef,
  66. }
  67. ceph::rgw::keystone { $gateway_name:
  68. rgw_keystone_url => $admin_identity_url,
  69. rgw_keystone_admin_token => $keystone_hash['admin_token'],
  70. rgw_keystone_token_cache_size => $rgw_keystone_token_cache_size,
  71. rgw_keystone_accepted_roles => $rgw_keystone_accepted_roles,
  72. rgw_s3_auth_use_keystone => $auth_s3_keystone_ceph,
  73. use_pki => false,
  74. }
  75. file { "/var/lib/ceph/radosgw/ceph-${gateway_name}":
  76. ensure => directory,
  77. }
  78. if ! $use_syslog {
  79. ceph_config {
  80. "client.${gateway_name}/log_file": value => $rgw_log_file;
  81. "client.${gateway_name}/log_to_syslog": value => $use_syslog;
  82. }
  83. }
  84. ceph_config {
  85. "client.${gateway_name}/rgw_init_timeout": value => $rgw_init_timeout;
  86. }
  87. exec { "Create ${rgw_large_pool_name} pool":
  88. command => "ceph -n client.${gateway_name} osd pool create ${rgw_large_pool_name} ${rgw_large_pool_pg_nums} ${rgw_large_pool_pg_nums}",
  89. path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin',
  90. unless => "rados lspools | grep '^${rgw_large_pool_name}$'",
  91. }
  92. Ceph::Key["client.${gateway_name}"] -> Exec["Create ${rgw_large_pool_name} pool"]
  93. }
  94. }