Advertisement
Guest User

eric-chen

a guest
May 9th, 2018
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Puppet 1.52 KB | None | 0 0
  1. include '::mysql::server'
  2. include '::firewall'
  3. class mediawiki {
  4.  
  5.   $phpmysql = $osfamily ? {
  6.     'redhat'  => 'php-mysql',
  7.     'debian'  => 'php5-mysql',
  8.     default   => 'php-mysql',
  9.   }
  10.  
  11.   package { $phpmysql:
  12.     ensure  => 'present',
  13.   }
  14.  
  15.   if $osfamily == 'redhat' {
  16.   package { 'php-xml':
  17.     ensure => 'present',
  18.     }
  19.   }
  20.  
  21.  file  { '/var/www/html/index.html':
  22.     ensure => 'absent',
  23.  
  24.   }
  25.  
  26.  file { 'LocalSettings.php':
  27.     path    => '/var/www/html/LocalSettings.php',
  28.     ensure  => 'file',
  29.     content => template('mediawiki/LocalSettings.erb'),
  30.   }
  31.  
  32.  vcsrepo { '/var/www/html':
  33.     ensure  => 'present',
  34.     provider => 'git',
  35.     source   => "https://github.com/wikimedia/mediawiki.git",
  36.     revision  => 'REL1_23',
  37.   }
  38.  
  39.     File['/var/www/html/index.html'] -> Vcsrepo['/var/www/html']
  40.  
  41. }
  42.  
  43. class { '::mysql::server':
  44.   ensure => 'present',
  45.   create_root_user => true,
  46.   root_password           => 'training',
  47.   remove_default_accounts => true,
  48.   service_name            => 'mysql',
  49.   ensure                  => 'running',
  50.   grant                   => ['SELECT', 'UPDATE'],
  51. }
  52. class { '::firewall': }
  53.  
  54.   firewall { '000 allow http access':
  55.     port    => '80',
  56.     proto  => 'tcp',
  57.     action => 'accept'
  58.   }
  59.  
  60.   firewall { '001 allow SSH access':
  61.     port    => '22',
  62.     proto  => 'tcp',
  63.     action => 'accept'
  64.   }
  65.  
  66. class { '::apache::mod::php': }
  67.  
  68. class { '::apache':
  69.  
  70.     docroot    => '/var/www/html',
  71.     mpm_module => 'prefork',
  72.     subscribe  => Package[$phpmysql],
  73.  
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement