Puppet Class: openshift_origin::console
- Defined in:
- manifests/console.pp
Overview
Copyright 2013 Mojo Lingo LLC. Modifications by Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'manifests/console.pp', line 16
class openshift_origin::console {
include openshift_origin::broker_console_dirs
include openshift_origin::firewall::apache
include openshift_origin::selbooleans
include openshift_origin::selbooleans::broker_console
anchor { 'openshift_origin::console_begin': } ->
Class['openshift_origin::broker_console_dirs'] ->
Class['openshift_origin::selbooleans'] ->
Class['openshift_origin::selbooleans::broker_console'] ->
Class['openshift_origin::firewall::apache'] ->
anchor { 'openshift_origin::console_end': }
package { 'openshift-origin-console':
ensure => present,
require => [
Class['openshift_origin::install_method'],
Package['httpd'],
]
}
# These dirs should be created by the package.
file {
[
'/var/log/openshift/console',
'/var/log/openshift/console/httpd',
'/var/www/openshift/console',
'/var/www/openshift/console/httpd',
'/var/www/openshift/console/httpd/run',
]:
ensure => directory,
}
selinux_fcontext {
[
'/var/log/openshift/console(/.*)?',
'/var/log/openshift/console/httpd(/.*)?',
]:
ensure => 'present',
seltype => 'httpd_log_t',
}
selinux_fcontext { '/var/www/openshift/console/httpd/run(/.*)?':
ensure => 'present',
seltype => 'httpd_var_run_t',
}
# Add semanage types to dirs before anything else goes into them.
File['/var/log/openshift/console'] {
seltype => 'httpd_log_t',
require => [
Class['openshift_origin::broker_console_dirs'],
Selinux_fcontext['/var/log/openshift/console(/.*)?'],
],
}
File['/var/www/openshift/console/httpd/run'] {
seltype => 'httpd_var_run_t',
require => [
Package['httpd'],
Class['openshift_origin::broker_console_dirs'],
Selinux_fcontext['/var/www/openshift/console/httpd/run(/.*)?'],
],
}
file { 'openshift console.conf':
path => '/etc/openshift/console.conf',
content => template('openshift_origin/console/console.conf.erb'),
owner => 'apache',
group => 'apache',
mode => '0644',
require => [
Package['openshift-origin-console'],
Class['openshift_origin::broker_console_dirs'],
Package['httpd'],
],
notify => Service['openshift-console'],
}
if $::openshift_origin::development_mode == true {
file { 'openshift console-dev.conf':
path => '/etc/openshift/console-dev.conf',
content => template('openshift_origin/console/console.conf.erb'),
owner => 'apache',
group => 'apache',
mode => '0644',
require => [
Package['openshift-origin-console'],
Class['openshift_origin::broker_console_dirs'],
Package['httpd'],
],
notify => Service['openshift-console'],
}
}
# This File resource is to guarantee that the Gemfile.lock created
# by the following Exec has the appropriate permissions (otherwise
# it is created as owned by root:root)
file { '/var/www/openshift/console/Gemfile.lock':
ensure => 'present',
owner => 'apache',
group => 'apache',
mode => '0644',
selinux_ignore_defaults => true,
require => Package['openshift-origin-console','httpd'],
}
# SCL and Puppet don't play well together; the 'default' here
# circumvents the use of the `scl enable ruby193` mechanism
# while still invoking ruby commands in the correct context
$console_asset_rake_cmd = 'LD_LIBRARY_PATH=/opt/rh/ruby193/root/usr/lib64:/opt/rh/v8314/root/usr/lib64 GEM_PATH=/opt/rh/ruby193/root/usr/local/share/gems:/opt/rh/ruby193/root/usr/share/gems /opt/rh/ruby193/root/usr/bin/rake assets:precompile'
$console_bundle_show = 'LD_LIBRARY_PATH=/opt/rh/ruby193/root/usr/lib64 GEM_PATH=/opt/rh/ruby193/root/usr/local/share/gems:/opt/rh/ruby193/root/usr/share/gems /opt/rh/ruby193/root/usr/bin/bundle show'
exec { 'Console gem dependencies':
cwd => '/var/www/openshift/console/',
command => "rm -f Gemfile.lock && \
${console_bundle_show} && \
chown apache:apache Gemfile.lock && \
rm -rf tmp/cache/* && \
${console_asset_rake_cmd} && \
chown -R apache:apache /var/www/openshift/console",
require => Package['openshift-origin-console','httpd'],
subscribe => [
Package['openshift-origin-console'],
File['/var/www/openshift/console/Gemfile.lock'],
],
notify => Service['openshift-console'],
refreshonly => true,
}
exec { 'restorecon console dir':
command => 'restorecon -R /var/www/openshift/console',
provider => 'shell',
require => Package['openshift-origin-console'],
notify => Service['openshift-console'],
refreshonly => true,
}
service { 'openshift-console':
ensure => true,
require => Package['openshift-origin-console'],
enable => true,
hasstatus => true,
hasrestart => true,
subscribe => File['/etc/openshift/development'],
}
}
|