OpenStack Manila Puppet Module
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.

146 lines
5.4KB

  1. # ==define manila::service_instance
  2. #
  3. # ===Parameters
  4. #
  5. # [*create_service_image*]
  6. # (optional) Upload the service image to glance.
  7. # Defaults to: true
  8. #
  9. # [*service_image_name*]
  10. # (optional) Name of image in glance, that will be used to create
  11. # service instance.
  12. # Defaults to: 'manila-service-image'
  13. #
  14. # [*service_image_location*]
  15. # (required) URL or pathname to the service image. This will be
  16. # loaded into Glance.
  17. #
  18. # [*service_instance_name_template*]
  19. # (optional) Name of service instance.
  20. # Defaults to: 'manila_service_instance_%s'
  21. #
  22. # [*service_instance_user*]
  23. # (required) User in service instance.
  24. #
  25. # [*service_instance_password*]
  26. # (required) Password to service instance user.
  27. #
  28. # [*manila_service_keypair_name*]
  29. # (optional) Name of keypair that will be created and used
  30. # for service instance.
  31. # Defaults to: 'manila-service'
  32. #
  33. # [*path_to_public_key*]
  34. # (optional) Path to hosts public key.
  35. # Defaults to: '~/.ssh/id_rsa.pub'
  36. #
  37. # [*path_to_private_key*]
  38. # (optional) Path to hosts private key.
  39. # Defaults to: '~/.ssh/id_rsa'
  40. #
  41. # [*max_time_to_build_instance*]
  42. # (optional) Maximum time to wait for creating service instance.
  43. # Defaults to: 300
  44. #
  45. # [*service_instance_security_group*]
  46. # (optional) Name of security group, that will be used for
  47. # service instance creation.
  48. # Defaults to: 'manila-service'
  49. #
  50. # [*service_instance_flavor_id*]
  51. # (optional) ID of flavor, that will be used for service instance
  52. # creation.
  53. # Defaults to: 1
  54. #
  55. # [*service_network_name*]
  56. # (optional) Name of manila service network.
  57. # Defaults to: 'manila_service_network'
  58. #
  59. # [*service_network_cidr*]
  60. # (optional) CIDR of manila service network.
  61. # Defaults to: '10.254.0.0/16'
  62. #
  63. # [*service_network_division_mask*]
  64. # (optional) This mask is used for dividing service network into
  65. # subnets, IP capacity of subnet with this mask directly
  66. # defines possible amount of created service VMs
  67. # per tenant's subnet.
  68. # Defaults to: 28
  69. #
  70. # [*interface_driver*]
  71. # (optional) Vif driver.
  72. # Defaults to: 'manila.network.linux.interface.OVSInterfaceDriver'
  73. #
  74. # [*connect_share_server_to_tenant_network*]
  75. # (optional) Attach share server directly to share network.
  76. # Defaults to: false
  77. #
  78. # DEPRECATED PARAMETERS
  79. #
  80. # [*service_instance_network_helper_type*]
  81. # Allowed values are nova, neutron
  82. # Defaults to: undef
  83. define manila::service_instance (
  84. $create_service_image = true,
  85. $service_image_name = 'manila-service-image',
  86. $service_image_location = undef,
  87. $service_instance_name_template = 'manila_service_instance_%s',
  88. $service_instance_user = undef,
  89. $service_instance_password = undef,
  90. $manila_service_keypair_name = 'manila-service',
  91. $path_to_public_key = '~/.ssh/id_rsa.pub',
  92. $path_to_private_key = '~/.ssh/id_rsa',
  93. $max_time_to_build_instance = 300,
  94. $service_instance_security_group = 'manila-service',
  95. $service_instance_flavor_id = 1,
  96. $service_network_name = 'manila_service_network',
  97. $service_network_cidr = '10.254.0.0/16',
  98. $service_network_division_mask = 28,
  99. $interface_driver = 'manila.network.linux.interface.OVSInterfaceDriver',
  100. $connect_share_server_to_tenant_network = false,
  101. # DEPRECATED PARAMETERS
  102. $service_instance_network_helper_type = undef,
  103. ) {
  104. include ::manila::deps
  105. if $service_instance_network_helper_type {
  106. warning('service_instance_network_helper_type is deprecated, has no effect, and will be removed in the future.')
  107. }
  108. if $create_service_image {
  109. if $service_image_location {
  110. glance_image { $service_image_name:
  111. ensure => present,
  112. is_public => 'yes',
  113. container_format => 'bare',
  114. disk_format => 'qcow2',
  115. source => $service_image_location,
  116. }
  117. }
  118. else {
  119. fail('Missing required parameter service_image_location')
  120. }
  121. }
  122. manila_config {
  123. "${name}/service_image_name": value => $service_image_name;
  124. "${name}/service_instance_name_template": value => $service_instance_name_template;
  125. "${name}/service_instance_user": value => $service_instance_user;
  126. "${name}/service_instance_password": value => $service_instance_password, secret => true;
  127. "${name}/manila_service_keypair_name": value => $manila_service_keypair_name;
  128. "${name}/path_to_public_key": value => $path_to_public_key;
  129. "${name}/path_to_private_key": value => $path_to_private_key;
  130. "${name}/max_time_to_build_instance": value => $max_time_to_build_instance;
  131. "${name}/service_instance_security_group": value => $service_instance_security_group;
  132. "${name}/service_instance_flavor_id": value => $service_instance_flavor_id;
  133. "${name}/service_network_name": value => $service_network_name;
  134. "${name}/service_network_cidr": value => $service_network_cidr;
  135. "${name}/service_network_division_mask": value => $service_network_division_mask;
  136. "${name}/interface_driver": value => $interface_driver;
  137. "${name}/connect_share_server_to_tenant_network": value => $connect_share_server_to_tenant_network;
  138. }
  139. }