Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.68 KB | None | 0 0
  1. #mot web frontend profile
  2. class profile::frontend  {
  3.   include ::profile::global
  4.   include ::profile::php
  5.   include ::stdlib
  6.  
  7.   $external_url                        = hiera('environment::external_url')
  8.   $api_url                             = hiera('profile::frontend::api_url')
  9.   $openam_hostname                     = hiera('environment::openam::server::hostname')
  10.   $openam_port                         = hiera('environment::openam::server::port')
  11.   $openam_server                       = "${openam_hostname}:${openam_port}"
  12.   $amadmin_pw                          = hiera('environment::openam::amadmin_pw')
  13.   $mysql_server                        = hiera('environment::mysql::servername')
  14.   $motdbuser_password                  = hiera('environment::mysql::user::motdbuser::password')
  15.   $openam_url                          = hiera('openam::site_url', 'http://openam/sso')
  16.   $openam_cookie_domain                = hiera('profile::frontend::openam_cookie_domain')
  17.   $google_analytics_id                 = hiera('profile::frontend::google_analytics_id')
  18.   $memcached_save_path                 = hiera('profile::frontend::elasticache::server')
  19.   $feature_toggle_jasper_async         = hiera('profile::feature_toggles::jasper_async')
  20.   $feature_toggle_password_expiry      = hiera('profile::feature_toggles::password_expiry')
  21.   $feature_toggle_vts_risk_score       = hiera('profile::feature_toggles::vts_risk_score')
  22.   $feature_toggle_2fa_method_visible   = hiera('profile::feature_toggles::2fa_method_visible', false)
  23.   $feature_toggle_infinity_contingency = hiera('profile::feature_toggles::infinity_contingency', true)
  24.   $feature_toggle_new_person_profile   = hiera('profile::feature_toggles::new_person_profile', false)
  25.   $password_expiry_grace_period        = hiera('profile::password_expiry_grace_period')
  26.   $memcache_type                       = hiera('profile::frontend::memcache_type', 'elasicache')
  27.   $new_person_profile                  = hiera('profile::frontend::new_person_profile', false)
  28.   $opchache_validate_timestamps        = hiera('profile::php::opcache_validate_timestamps', '0')
  29.  
  30.  
  31.   file { '/var/log/dvsa':
  32.     ensure => directory,
  33.     owner  => 'apache',
  34.     group  => 'apache',
  35.   }
  36.  
  37.   file { [ '/etc/dvsa', '/etc/dvsa/mot-web-frontend' ]:
  38.     ensure => directory,
  39.     owner  => 'apache',
  40.     group  => 'apache',
  41.     mode   => '0700',
  42.   }
  43.  
  44.   file { '/opt/rh/php55/root/etc/php.ini':
  45.     ensure  => present,
  46.     owner   => 'root',
  47.     group   => 'root',
  48.     mode    => '0644',
  49.     content => template('profile/frontend/php.ini.erb'),
  50.     require => Package['php55'],
  51.     notify  => Exec['remove web-frontend cache'],
  52.   }
  53.  
  54.   file { '/opt/rh/php55/root/etc/php.d/opcache.ini':
  55.     ensure  => present,
  56.     owner   => 'root',
  57.     group   => 'root',
  58.     mode    => '0644',
  59.     content => template('profile/php/opcache.ini.erb'),
  60.     require => Package['php55-php-opcache'],
  61.     notify  => Exec['remove web-frontend cache'],
  62.   }
  63.  
  64.   file { '/opt/rh/php55/root/etc/php.d/z-memcached.ini':
  65.     ensure => absent,
  66.     notify => Exec['remove web-frontend cache'],
  67.   }
  68.  
  69.   file { '/opt/rh/php55/root/etc/php.d/memcached.ini':
  70.     ensure  => file,
  71.     owner   => 'root',
  72.     group   => 'root',
  73.     mode    => '0644',
  74.     content => template('profile/frontend/php.d/memcached.ini.erb'),
  75.     require => Package['php55'],
  76.     notify  => Exec['remove web-frontend cache'],
  77.   }
  78.  
  79.   # Web frontend configuration files
  80.     file { '/etc/dvsa/mot-web-frontend/global.php':
  81.       ensure  => file,
  82.       owner   => 'apache',
  83.       group   => 'apache',
  84.       mode    => '0400',
  85.       content => template('profile/frontend/mot-web-frontend/global.php.erb'),
  86.       notify  => Exec['remove web-frontend cache'],
  87.       require => File['/etc/dvsa/mot-web-frontend'],
  88.     }
  89.  
  90.     file { '/etc/dvsa/mot-web-frontend/production.php':
  91.       ensure  => absent,
  92.       notify  => Exec['remove web-frontend cache'],
  93.       require => File['/etc/dvsa/mot-web-frontend'],
  94.     }
  95.  
  96.   file { '/etc/dvsa/mot-web-frontend/testing.php':
  97.     ensure  => absent,
  98.     notify  => Exec['remove web-frontend cache'],
  99.     require => File['/etc/dvsa/mot-web-frontend'],
  100.   }
  101.  
  102.   file { '/etc/dvsa/mot-web-frontend/development.php':
  103.     ensure  => absent,
  104.     notify  => Exec['remove web-frontend cache'],
  105.     require => File['/etc/dvsa/mot-web-frontend'],
  106.   }
  107.  
  108.   file { '/etc/dvsa/mot-web-frontend/features.local.php':
  109.     ensure  => absent,
  110.     notify  => Exec['remove web-frontend cache'],
  111.     require => File['/etc/dvsa/mot-web-frontend'],
  112.   }
  113.  
  114.   file { '/etc/dvsa/mot-web-frontend/z.dvsalogger.development.php.dist.opt':
  115.     ensure  => absent,
  116.     notify  => Exec['remove web-frontend cache'],
  117.     require => File['/etc/dvsa/mot-web-frontend'],
  118.   }
  119.  
  120.   file { '/etc/dvsa/mot-web-frontend/zenddevelopertools.development.php':
  121.     ensure  => absent,
  122.     notify  => Exec['remove web-frontend cache'],
  123.     require => File['/etc/dvsa/mot-web-frontend'],
  124.   }
  125.  
  126.   ensure_resource('selboolean', 'httpd_can_network_connect', { 'value' => 'on', 'persistent' => true })
  127.   ensure_resource('selboolean', 'httpd_can_network_relay', { 'value' => 'on', 'persistent' => true })
  128.  
  129.   selboolean { 'httpd_execmem':
  130.     value      => on,
  131.     persistent => true,
  132.   }
  133.  
  134.   case $memcache_type {
  135.     'memcached': {
  136.       package { 'memcached':
  137.         ensure => present,
  138.       }
  139.       ->
  140.       service { 'memcached':
  141.         ensure => running,
  142.         enable => true,
  143.       }
  144.     }
  145.     default: {
  146.       package { 'memcached':
  147.         ensure => absent,
  148.       }
  149.     }
  150.   }
  151.  
  152.   exec { 'remove web-frontend cache':
  153.     command     => 'rm -rf /tmp/*.php',
  154.     path        => '/usr/local/bin/:/bin/',
  155.     notify      => Service['httpd'],
  156.     refreshonly => true,
  157.   }
  158.  
  159.   package { 'mot-common-web-module':
  160.     ensure => hiera('profile::frontend::mot-common-web-module::ensure', 'latest'),
  161.     before => Service['httpd'],
  162.     notify => Exec['remove web-frontend cache'],
  163.   }
  164.  
  165.   package { 'wkhtmltox':
  166.     ensure => present,
  167.   }
  168.  
  169.   package { 'mot-web-frontend':
  170.     ensure => hiera('profile::frontend::mot-web-frontend::ensure', 'latest'),
  171.     before => Service['httpd'],
  172.     notify => Exec['remove web-frontend cache'],
  173.   }
  174.  
  175.   package { 'amazon-elasticache':
  176.     ensure => hiera('profile::frontend::amazon-elasticache::ensure', 'latest'),
  177.     before => Service['httpd'],
  178.     notify => Exec['remove web-frontend cache'],
  179.   }
  180.  
  181.   if ($::environment == 'vagrant'){
  182.  
  183.     file { '/opt/rh/php55/root/etc/php.d/xdebug.ini':
  184.     ensure  => present,
  185.     owner   => 'root',
  186.     group   => 'root',
  187.     mode    => '0644',
  188.     content => template('profile/php/xdebug.ini.erb'),
  189.     require => File['/opt/rh/php55/root/etc/php.ini'],
  190.     }
  191.   }
  192.  
  193. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement