Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
$agent_ocs_pause = $::ocsinventory::agent_ocs_pause,
$agent_ocs_server = $::ocsinventory::agent_ocs_server,
$agent_ocs_tag = $::ocsinventory::agent_ocs_tag,
$db_host = $::ocsinventory::db_host,
$db_port = $::ocsinventory::db_port,
$db_name = $::ocsinventory::db_name,
$db_local = $::ocsinventory::db_local,
$db_user = $::ocsinventory::db_user,
$db_pass = $::ocsinventory::db_pass,
) {
File {
group => $::ocsinventory::config_group,
Expand Down Expand Up @@ -72,6 +78,19 @@
ensure => file,
content => template("ocsinventory/server.${::osfamily}.conf.erb");
}
if $::osfamily == 'Debian' {
file { "${::ocsinventory::params::deploy_reports_dir}/dbconfig.inc.php":
ensure => file,
content => template('ocsinventory/reports.Debian.dbconfig.inc.php.erb'),
owner => $::ocsinventory::config_httpd_user,
group => $::ocsinventory::config_httpd_group,
}
exec { "rm install.php":
command => "rm ${::ocsinventory::params::deploy_reports_dir}/install.php",
onlyif => ["test -f ${::ocsinventory::params::deploy_reports_dir}/install.php",
"mysql -u $db_user -p$db_pass -h $db_host -P $db_port $db_name -e 'show tables' | grep -q config"]
}
}
}
}

8 changes: 8 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@
$pkg_list_server = $::ocsinventory::params::pkg_list_server,
$pkg_server_ensure = $::ocsinventory::params::pkg_server_ensure,
$server = $::ocsinventory::params::server,
$db_host = $::ocsinventory::params::db_host,
$db_port = $::ocsinventory::params::db_port,
$db_name = $::ocsinventory::params::db_name,
$db_local = $::ocsinventory::params::db_local,
$db_user = $::ocsinventory::params::db_user,
$db_pass = $::ocsinventory::params::db_passs,
$config_httpd_user = $::ocsinventory::params::httpd_user,
$config_httpd_group = $::ocsinventory::params::httpd_group,
) inherits ::ocsinventory::params {
class { '::ocsinventory::install': } ->
class { '::ocsinventory::config': } ->
Expand Down
28 changes: 27 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
$pkg_agent_ensure = present
$pkg_server_ensure = present
$server = false
$db_host = 'localhost'
$db_port = 3306
$db_name = 'ocsweb'
$db_local = 'ocsweb'
$db_user = 'ocs'
$db_passs = 'ocs'

case $::osfamily {
'RedHat': {
Expand All @@ -21,7 +27,6 @@
$log_dir_agent = '/var/log/ocsinventory-agent'
$log_dir_server = '/var/log/ocsinventory-server'
$pkg_deps = undef

case $::lsbmajdistrelease {
'7': {
$pkg_list_agent = [
Expand Down Expand Up @@ -49,7 +54,28 @@
'ocsinventory-server',
]
}
'Debian': {
$config_dir = '/etc/ocsinventory'
$config_dir_mode = '0755'
$config_dir_recurse = false
$config_file_mode = '0644'
$config_group = 'root'
$config_user = 'root'
$log_dir_agent = '/var/log/ocsinventory-agent'
$log_dir_server = '/var/log/ocsinventory-server'
$pkg_deps = undef
$httpd_user = 'www-data'
$httpd_group = 'www-data'

$pkg_list_agent = [
'ocsinventory-agent',
]
$pkg_list_server = [
'ocsinventory-reports',
'ocsinventory-server',
]
$deploy_reports_dir = '/usr/share/ocsinventory-reports'
}
default: {
fail "Operating system ${::operatingsystem} is not supported."
}
Expand Down
68 changes: 68 additions & 0 deletions templates/reports.Debian.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
################################################################################
#
# OCS Inventory NG Administration Server
#
# Copyleft 2008 OCS Inventory NG Team
# Web: http://www.ocsinventory-ng.org
#
# This code is open source and may be copied and modified as long as the source
# code is always made freely available.
# Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
################################################################################

#
# ANY CHANGE ON THIS FILE REQUIRES APACHE RESTART TO TAKE EFFECT
#

################################################################################
# Administration console public pages
#

# Uncomment if you want a virtual host for OCS Inventory NG
#<VirtualHost *:80>
# ServerName ocsinventory-ng
# ServerAlias ocsinventory-ng.yourdomain.tld
# DocumentRoot /usr/share/ocsinventory-reports

Alias /ocsreports /usr/share/ocsinventory-reports

<Directory /usr/share/ocsinventory-reports>
# By default, users can use console from everywhere
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Allow from all
</IfModule>

Options Indexes FollowSymLinks
DirectoryIndex index.php

# Uncomment following to force use of HTTPS in Administration Server
#SSLRequireSSL

#php_flag short_open_tag on
php_flag file_uploads on

# Some PHP tuning for deployement feature up to 50 MB
php_value post_max_size 51M
php_value upload_max_filesize 50M

# You may have to uncomment following on errors
#php_value memory_limit 16M
#php_value max_execution_time -1
#php_value max_input_time -1

# Uncomment following to allow HTTP body request up to 4 MB
# instead default 512 KB
#LimitRequestBody 4194304
</Directory>

################################################################################
# Deployment packages download area
#
Alias /download /var/lib/ocsinventory-reports/download

#</VirtualHost>

7 changes: 7 additions & 0 deletions templates/reports.Debian.dbconfig.inc.php.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
define("DB_NAME", "<%= @db_name %>");
define("SERVER_READ","<%= @db_host %>");
define("SERVER_WRITE","<%= @db_host %>");
define("COMPTE_BASE","<%= @db_user %>");
define("PSWD_BASE","<%= @db_pass %>");
?>
Loading