puppet/mythtv/manifests/init.pp

137 lines
2.7 KiB
Puppet

# Install MythTV backend service.
#
# === Global variables
#
# $mythtv_dbhost:
# Database server name (defaults to localhost).
#
# $mythtv_dbname:
# Database name (defaults to mythconverg).
#
# $mythtv_dbuser:
# Database user name (defaults to mythtv).
#
# $mythtv_dbpass:
# Database password.
#
class mythtv::backend {
if ! $mythtv_dbhost {
$mythtv_dbhost = "localhost"
}
if ! $mythtv_dbuser {
$mythtv_dbuser = "mythtv"
}
if ! $mythtv_dbname {
$mythtv_dbname = "mythconverg"
}
include user::system
realize(User["mythtv"], Group["mythtv"])
package { ["mythtv-backend",
"mythtv-setup",
"mythtv-docs",
"perl-DBD-MySQL",
"mysql", ]:
ensure => installed,
require => [ User["mythtv"],
Group["mythtv"], ],
}
file { "/etc/mythtv/mysql.txt":
ensure => present,
content => template("mythtv/mysql.txt.erb"),
mode => 0640,
owner => root,
group => mythtv,
notify => Service["mythbackend"],
require => Package["mythtv-backend"],
}
file { "/etc/mythtv/config.xml":
ensure => present,
content => template("mythtv/config.xml.erb"),
mode => 0640,
owner => root,
group => mythtv,
notify => Service["mythbackend"],
require => Package["mythtv-backend"],
}
file { "/root/.mythtv":
ensure => "/etc/mythtv",
force => true,
require => Package["mythtv-backend"],
}
service { "mythbackend":
ensure => running,
enable => true,
require => Package["mythtv-backend"],
}
file { "/etc/cron.daily/mythorphans":
ensure => present,
source => "puppet:///mythtv/mythorphans",
mode => 0755,
owner => root,
group => root,
}
}
# Install MythTV daily cron jobs.
#
# This class should be included only to one host.
#
class mythtv::cron inherits mythtv::backend {
package { [ "perl-MythTV", "perl-Net-UPnP" ]:
ensure => installed,
}
file { "/etc/cron.daily/mythfilldatabase":
ensure => present,
source => "puppet:///mythtv/mythfilldatabase",
mode => 0755,
owner => root,
group => root,
}
file { "/etc/cron.daily/mythoptimize":
ensure => present,
source => "puppet:///mythtv/mythoptimize",
mode => 0755,
owner => root,
group => root,
}
}
# Install MythTV web frontend.
#
class mythtv::mythweb {
package { [ "mythweb", "mythweather" ]:
ensure => installed,
}
apache::configfile { "mythweb.conf":
content => template("mythtv/mythweb.conf.erb"),
http => false,
require => Package["mythweb"],
}
file { "/usr/share/mythweb/data":
ensure => directory,
mode => 0770,
owner => root,
group => httpsd,
require => Package["mythweb"],
}
}