diff --git a/mythtv/files/mythfilldatabase b/mythtv/files/mythfilldatabase new file mode 100755 index 0000000..f5028d0 --- /dev/null +++ b/mythtv/files/mythfilldatabase @@ -0,0 +1,3 @@ +#!/bin/sh + +mythfilldatabase > /dev/null diff --git a/mythtv/files/mythoptimize b/mythtv/files/mythoptimize new file mode 100755 index 0000000..009acf3 --- /dev/null +++ b/mythtv/files/mythoptimize @@ -0,0 +1,4 @@ +#!/bin/sh + +MYTHVERSION="`rpm -q --queryformat='%{VERSION}\n' mythtv-docs`" +perl /usr/share/doc/mythtv-docs-${MYTHVERSION}/contrib/optimize_mythdb.pl > /dev/null diff --git a/mythtv/manifests/init.pp b/mythtv/manifests/init.pp new file mode 100644 index 0000000..cb666a6 --- /dev/null +++ b/mythtv/manifests/init.pp @@ -0,0 +1,114 @@ + +# 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" + } + + package { ["mythtv-backend", "mythtv-setup", "mythtv-docs"]: + ensure => installed, + } + + 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"], + } + +} + + +# 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", "perl-DBD-MySQL" ]: + 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, + } + + file { "/usr/share/mythweb/data": + ensure => directory, + mode => 0770, + owner => root, + group => httpsd, + require => Package["mythweb"], + } + +} \ No newline at end of file diff --git a/mythtv/templates/config.xml.erb b/mythtv/templates/config.xml.erb new file mode 100644 index 0000000..5862175 --- /dev/null +++ b/mythtv/templates/config.xml.erb @@ -0,0 +1,12 @@ + + + + + <%= mythtv_dbhost -%> + <%= mythtv_dbuser -%> + <%= mythtv_dbpass -%> + <%= mythtv_dbname -%> + + + + diff --git a/mythtv/templates/mysql.txt.erb b/mythtv/templates/mysql.txt.erb new file mode 100644 index 0000000..47cf4d8 --- /dev/null +++ b/mythtv/templates/mysql.txt.erb @@ -0,0 +1,39 @@ +DBHostName=<%= mythtv_dbhost %> + +# By default, Myth tries to ping the DB host to see if it exists. +# If your DB host or network doesn't accept pings, set this to no: +# +#DBHostPing=no + +DBUserName=<%= mythtv_dbuser %> +DBPassword=<%= mythtv_dbpass %> +DBName=<%= mythtv_dbname %> +DBType=QMYSQL3 + +# Set the following if you want to use something other than this +# machine's real hostname for identifying settings in the database. +# This is useful if your hostname changes often, as otherwise you +# will need to reconfigure mythtv (or futz with the DB) every time. +# TWO HOSTS MUST NOT USE THE SAME VALUE +# +#LocalHostName=my-unique-identifier-goes-here + +# If you want your frontend to be able to wake your MySQL server +# using WakeOnLan, have a look at the following settings: +# +# +# The time the frontend waits (in seconds) between reconnect tries. +# This should be the rough time your MySQL server needs for startup +# +#WOLsqlReconnectWaitTime=0 +# +# +# This is the number of retries to wake the MySQL server +# until the frontend gives up +# +#WOLsqlConnectRetry=5 +# +# +# This is the command executed to wake your MySQL server. +# +#WOLsqlCommand=echo 'WOLsqlServerCommand not set'