mysql.pp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # == Class: nova::db::mysql
  2. #
  3. # Class that configures mysql for nova
  4. #
  5. # === Parameters:
  6. #
  7. # [*password*]
  8. # Password to use for the nova user
  9. #
  10. # [*dbname*]
  11. # (optional) The name of the database
  12. # Defaults to 'nova'
  13. #
  14. # [*user*]
  15. # (optional) The mysql user to create
  16. # Defaults to 'nova'
  17. #
  18. # [*host*]
  19. # (optional) The IP address of the mysql server
  20. # Defaults to '127.0.0.1'
  21. #
  22. # [*charset*]
  23. # (optional) The charset to use for the nova database
  24. # Defaults to 'utf8'
  25. #
  26. # [*collate*]
  27. # (optional) The collate to use for the nova database
  28. # Defaults to 'utf8_general_ci'
  29. #
  30. # [*allowed_hosts*]
  31. # (optional) Additional hosts that are allowed to access this DB
  32. # Defaults to undef
  33. #
  34. # [*setup_cell0*]
  35. # (optional) Setup a cell0 for the cell_v2 functionality. This option will
  36. # be set to true by default in Ocata when the cell v2 setup is mandatory.
  37. # Defaults to false
  38. #
  39. class nova::db::mysql(
  40. $password,
  41. $dbname = 'nova',
  42. $user = 'nova',
  43. $host = '127.0.0.1',
  44. $charset = 'utf8',
  45. $collate = 'utf8_general_ci',
  46. $allowed_hosts = undef,
  47. $setup_cell0 = true,
  48. ) {
  49. include ::nova::deps
  50. $setup_cell0_real = pick($::nova::db::mysql_api::setup_cell0, $setup_cell0)
  51. ::openstacklib::db::mysql { 'nova':
  52. user => $user,
  53. password_hash => mysql_password($password),
  54. dbname => $dbname,
  55. host => $host,
  56. charset => $charset,
  57. collate => $collate,
  58. allowed_hosts => $allowed_hosts,
  59. }
  60. if $setup_cell0_real {
  61. # need for cell_v2
  62. ::openstacklib::db::mysql { 'nova_cell0':
  63. user => $user,
  64. password_hash => mysql_password($password),
  65. dbname => "${dbname}_cell0",
  66. host => $host,
  67. charset => $charset,
  68. collate => $collate,
  69. allowed_hosts => $allowed_hosts,
  70. create_user => false,
  71. }
  72. }
  73. Anchor['nova::db::begin']
  74. ~> Class['nova::db::mysql']
  75. ~> Anchor['nova::db::end']
  76. }