aboutsummaryrefslogtreecommitdiffstats
path: root/modules/blog/manifests/init.pp
blob: 291d0ef18f40f22c9c0ea80d32a9085680572883 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
class blog {

    class base {
        $blog_location = "/var/www/vhosts/blog.$domain"
        $blog_domain = "blog.$domain"
	$blog_db_backupdir = "/var/lib/backups/blog_db"
	$blog_files_backupdir = "/var/lib/backups/blog_files"

        user { "blog":
        groups => apache,
        comment => "Mageia Blog",
        home => "/var/lib/blog",
        }
    }
    
    class files-bots inherits base {
        package { ['wget','php-mysql','php-ldap','unzip']:
            ensure => installed
        }

        file { "check_new-blog-post":
            path => "/usr/local/bin/check_new-blog-post.sh",
            ensure => present,
            owner => root,
            group => root,
            mode => 755,
            content => template("blog/check_new-blog-post.sh")
        }
   
        cron { "Blog bot":
            user => blog,
            minute => '*/15',
            command => "/usr/local/bin/check_new-blog-post.sh",
            require => [File["check_new-blog-post"], User['blog']],
        }

        include apache::mod_php

        apache::vhost_base { "$blog_domain":
            location => $blog_location,
            content => template('blog/blogs_vhosts.conf'),
        }

        apache::vhost_base { "ssl_$blog_domain":
            use_ssl => true,
            vhost => $blog_domain,
            location => $blog_location,
            content => template('blog/blogs_vhosts.conf'),
        }

        file { "$blog_location":
	        ensure => directory,
	        owner => apache,
	        group => apache,
	        mode => 644,
        }
    }
    class db_backup inherits base {
        file { $blog_db_backupdir:
                ensure => directory,
                owner => root,
                group => root,
                mode => 644,
        }

	file { "backup_blog-db":
            path => "/usr/local/bin/backup_blog-db.sh",
            ensure => present,
            owner => root,
            group => root,
            mode => 755,
            content => template("blog/backup_blog-db.sh")
        }

        cron { "Backup DB (blog)":
            user => root,
            hour => '23',
            minute => '42',
            command => "/usr/local/bin/backup_blog-db.sh",
            require => [File["backup_blog-db"]],
        }
    }
    class files_backup inherits base {
        file { $blog_files_backupdir:
                ensure => directory,
                owner => root,
                group => root,
                mode => 644,
        }

        file { "backup_blog-files":
            path => "/usr/local/bin/backup_blog-files.sh",
            ensure => present,
            owner => root,
            group => root,
            mode => 755,
            content => template("blog/backup_blog-files.sh")
        }

        cron { "Backup files (blog)":
            user => root,
            hour => '23',
            minute => '42',
            command => "/usr/local/bin/backup_blog-files.sh",
            require => [File["backup_blog-files"]],
        }
    }
}