Guest User

Puppet Openstack

a guest
Aug 16th, 2016
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Puppet 3.69 KB | None | 0 0
  1. # Configure the Keystone service
  2. #
  3. # [*default_domain*]
  4. #   (optional) Define the default domain id.
  5. #   Set to 'undef' for 'Default' domain.
  6. #   Default to undef.
  7. #
  8. # [*using_domain_config*]
  9. #   (optional) Eases the use of the keystone_domain_config resource type.
  10. #   It ensures that a directory for holding the domain configuration is present
  11. #   and the associated configuration in keystone.conf is set up right.
  12. #   Defaults to false
  13. #
  14. # [*token_provider*]
  15. #   (optional) Define the token provider to use.
  16. #   Default to 'uuid'.
  17. #
  18. class camara_openstack::keystone (
  19.   $default_domain      = 'Default',
  20.   $using_domain_config = true,
  21.   $token_provider      = 'uuid',
  22. ) {
  23.  
  24.   include ::camara_openstack::config
  25.   include ::camara_openstack::params
  26.  
  27.   # NOTE: for the all examples above to work you have to define:
  28.   keystone_domain { 'Default2':
  29.     ensure => present
  30.   }
  31.  
  32.   if $::camara_openstack::config::ssl {
  33.     openstack_integration::ssl_key { 'keystone':
  34.       notify  => Service['httpd'],
  35.       require => Package['keystone'],
  36.     }
  37.     Exec['update-ca-certificates'] ~> Service['httpd']
  38.   }
  39.  
  40.   if $token_provider == 'fernet' {
  41.     $enable_fernet_setup = true
  42.   } else {
  43.     $enable_fernet_setup = false
  44.   }
  45.  
  46.   class { '::keystone::client': }
  47.   class { '::keystone::cron::token_flush': }
  48.   class { '::keystone::db::mysql':
  49.     password => 'keystone',
  50.   }
  51.   class { '::keystone':
  52.     debug               => true,
  53.     database_connection => 'mysql+pymysql://keystone:[email protected]/keystone',
  54.     admin_token         => 'a_big_secret',
  55.     enabled             => true,
  56.     service_name        => 'httpd',
  57.     default_domain      => $default_domain,
  58.     enable_ssl          => $::camara_openstack::config::ssl,
  59.     public_bind_host    => $::camara_openstack::config::host,
  60.     admin_bind_host     => $::camara_openstack::config::host,
  61.     token_provider      => $token_provider,
  62.     enable_fernet_setup => $enable_fernet_setup,
  63.   }
  64.   include ::apache
  65.   class { '::keystone::wsgi::apache':
  66.     bind_host       => $::camara_openstack::config::ip_for_url,
  67.     ssl             => $::camara_openstack::config::ssl,
  68.     ssl_key         => "/etc/keystone/ssl/private/${::fqdn}.pem",
  69.     ssl_cert        => $::camara_openstack::params::cert_path,
  70.     workers         => 2,
  71.   }
  72.   # Workaround to purge Keystone vhost that is provided & activated by default with running
  73.   # Canonical packaging (called 'keystone').
  74.   if ($::operatingsystem == 'Ubuntu') and (versioncmp($::operatingsystemmajrelease, '16') >= 0) {
  75.     ensure_resource('file', '/etc/apache2/sites-available/keystone.conf', {
  76.       'ensure'  => 'absent',
  77.     })
  78.     ensure_resource('file', '/etc/apache2/sites-enabled/keystone.conf', {
  79.       'ensure'  => 'absent',
  80.     })
  81.  
  82.     Package['keystone'] -> File['/etc/apache2/sites-available/keystone.conf']
  83.     -> File['/etc/apache2/sites-enabled/keystone.conf'] ~> Anchor['keystone::install::end']
  84.   }
  85.   class { '::keystone::roles::admin':
  86.     email    => '[email protected]',
  87.     password => 'a_big_secret',
  88.   }
  89.  # class { '::keystone::endpoint':
  90.  #   default_domain => $default_domain,
  91.  #   public_url     => $::camara_openstack::config::keystone_auth_uri,
  92.  #   admin_url      => $::camara_openstack::config::keystone_admin_uri,
  93.  # }
  94.   # Installs the service user endpoint.
  95.   class { 'keystone::endpoint':
  96.     public_url   => 'http://127.0.0.1:5000/v2.0',
  97.     admin_url    => 'http://127.0.0.1:35357/v2.0',
  98.     internal_url => 'http://127.0.0.1:5000/v2.0',
  99.     region       => 'example-1',
  100.   }
  101.  
  102.  
  103.   class { '::openstack_extras::auth_file':
  104.     password       => 'a_big_secret',
  105.     auth_url       => "${::camara_openstack::config::keystone_auth_uri}/v3/",
  106.   }
  107.  
  108. }
Advertisement
Add Comment
Please, Sign In to add comment