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.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 ::tweaks::apache_wrappers
  49. include ::ceph::params
  50. #######################################
  51. # TODO (omolchanov): Remove template once we switch to systemd
  52. #######################################
  53. file { '/etc/init/radosgw.conf':
  54. ensure => present,
  55. content => template('osnailyfacter/radosgw-init.erb'),
  56. before => Ceph::Rgw[$gateway_name],
  57. }
  58. #######################################
  59. ceph::rgw { $gateway_name:
  60. frontend_type => 'apache-proxy-fcgi',
  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. ceph::rgw::apache_proxy_fcgi { $gateway_name:
  79. docroot => '/var/www/radosgw',
  80. rgw_port => '6780',
  81. apache_purge_configs => false,
  82. apache_purge_vhost => false,
  83. custom_apache_ports => hiera_array('apache_ports', ['0.0.0.0:80']),
  84. }
  85. if ! $use_syslog {
  86. ceph_config {
  87. "client.${gateway_name}/log_file": value => $rgw_log_file;
  88. "client.${gateway_name}/log_to_syslog": value => $use_syslog;
  89. }
  90. }
  91. ceph_config {
  92. "client.${gateway_name}/rgw_init_timeout": value => $rgw_init_timeout;
  93. }
  94. exec { "Create ${rgw_large_pool_name} pool":
  95. command => "ceph -n client.${gateway_name} osd pool create ${rgw_large_pool_name} ${rgw_large_pool_pg_nums} ${rgw_large_pool_pg_nums}",
  96. path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin',
  97. unless => "rados lspools | grep '^${rgw_large_pool_name}$'",
  98. }
  99. Ceph::Key["client.${gateway_name}"] -> Exec["Create ${rgw_large_pool_name} pool"]
  100. }
  101. }