Puppet Class: owncloud::server::config

Defined in:
manifests/server/config.pp

Overview



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
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
163
164
# File 'manifests/server/config.pp', line 1

class owncloud::server::config {

  # do user before package 
  # Users::Account[$owncloud::server::user] -> Class['sickbeard::package']
  # $fcgi_port = 9006,

  $directory_ensure = $owncloud::server::ensure ? {
    present => link,
    default => $owncloud::server::ensure
  }

  #users::account { $owncloud::server::user:
  account { $owncloud::server::user:
    ensure   => $owncloud::server::ensure,
    uid      => 560,
    gid      => 560,
    home_dir => $owncloud::server::data_dir,
    shell    => '/bin/false',
    comment  => 'Owncloud',
  }

  # nginx::vhost { "owncloud.${::fqdn}":
  #   root  => "${owncloud::server::path}/",
  # }
  # nginx::vhost::snippet { 'root':
  #   vhost   => "owncloud.${::fqdn}",
  #   content => template('owncloud/nginx_vhost.erb'),
  #   ensure  => $owncloud::server::ensure,
  #  }
  #nginx::vhost::snippet { 'owncloud':
  #  ensure  => $owncloud::server::ensure,
  #  vhost   => 'default',
  #  content => template('owncloud/nginx_vhost_subdirectory.erb'),
  #}

  
  #file { "/var/www/html_owncloud":
  #  ensure => directory,
  #  owner => "root",
  #  group => "root",
  #  mode => 755
  #}
  #file { '/var/www/html_owncloud/index.html':
  #  content => "<HTML>\n<HEAD>\n<TITLE>\nOwncloud HTTP server</TITLE>\n</HEAD>\n<BODY bgcolor=#ffffcc>\n<H1>Owncloud server</H1>\n<P>\n<A href=\"owncloud/\">Link</A>\n</BODY>\n</HTML>\n",
  #}
  apache::vhost { 'owncloud':
    ensure  => $owncloud::server::ensure,
    name => 'owncloud',
    #docroot => '/var/www/html_owncloud',
    docroot => '/usr/share/owncloud',
    #scriptalias => '/var/www/cgi-bin',
    #scriptalias => '/usr/share/cgi-bin',
    port => '8080',
    #aliases => [ { alias => '/', path => '/usr/share/owncloud' } ],
    directories => [ {
        path => '/usr/share/owncloud',
        allow => 'from 127.0.0.1 ::1 192.168.21.0/24',
        options => ['ExecCGI', 'Includes', 'Indexes','FollowSymLinks','MultiViews'], 
      #},{
      #  path => '/var/www/html_owncloud',
      #  allow => 'from 127.0.0.1 ::1 192.168.21.0/24',
      #  options => ['ExecCGI', 'Includes', 'Indexes','FollowSymLinks','MultiViews'], 
      } ],
    custom_fragment => template('owncloud/apache_vhost_subdirectory.erb'),
    #ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9006/usr/share/owncloud/$1'
    #proxy_pass => [], 
    #proxy_requests => 'On' , 
#    custom_fragment => '
#  DirectoryIndex index.php index.html
#  #ErrorDocument 403 /core/templates/403.php
#  #ErrorDocument 404 /core/templates/404.php
#  #ProxyPassMatch ^/(.*\.php.*)$ fcgi://127.0.0.1:9006/usr/share/owncloud/$1
#  RewriteCond %{REQUEST_URI} !index\.php$
#  RewriteCond %{REQUEST_URI} \.php
#  RewriteRule ^(/.*\.php(.*)?)$ fcgi://127.0.0.1:9006/usr/share/owncloud$1 [P]',
  }

  mysql::db { $owncloud::server::mysql_database:
    user     => $owncloud::server::mysql_user,
    password => $owncloud::server::mysql_password,
    host     => $owncloud::server::mysql_host,
    grant    => ['all'],
  }

  # make sure data directory is writeble by php-fpm
  #file { $owncloud::server::data_dir:
  #  ensure  => $owncloud::server::ensure,
  #  owner   => $owncloud::server::user,
  #  group   => $owncloud::server::user,
  #  mode    => '0600',
  #  recurse => true,
  #  force   => true
  #}

  file { '/etc/owncloud/':
    ensure  => $owncloud::server::ensure,
    owner   => $owncloud::server::user,
    group   => $owncloud::server::user,
    mode    => '0600',
    recurse => false,
    force   => true
  }

  file { '/etc/owncloud/config.php':
    ensure  => $owncloud::server::ensure,
    owner   => $owncloud::server::user,
    group   => $owncloud::server::user,
    mode    => '0600',
    recurse => false,
    content => template('owncloud/config.php.erb'),
  }

  file { "${owncloud::server::path}/config/":
    ensure  => $directory_ensure,
    target  => '/etc/owncloud/',
    force   => true,
    require => [Class['owncloud::server::package'], File['/etc/owncloud/config.php']],
  }
  file { "/var/lib/owncloud/tmp":
    ensure => directory,
    owner => "owncloud",
    group => "owncloud",
    mode => 755
  }

  #php::fpm::pool { 'owncloud':
  #  ensure  => $owncloud::server::ensure,
  #  port    => 9006,
  #  require => Users::Account[$owncloud::server::user]
  #}
  include php::fpm::daemon
  php::fpm::conf { 'owncloud':
    listen  => '127.0.0.1:9006',
    user    => 'owncloud',
    #php_settings         => [
    #  '#php_admin_flag[display_errors] = off',
    #  'php_admin_flag[log_errors] = on',
    #  "php_admin_value[error_log] = /var/log/php-fpm/owncloud-error.log",
    #  "#php_admin_value[memory_limit] = Dollar{memory_limit}",
    #  "#php_admin_value[date.timezone] = Dollar{time_zone}",
    #  "php_admin_value[session.save_path]=/var/lib/owncloud/tmp"
    #],
    php_flag => {
      "zlib.output_compression" => "off",
    },
    php_admin_flag => {
      #"log_errors" => "on",
    },
    php_admin_value => {
      #"error_log" => "/var/log/php-fpm/owncloud-error.log", 
      "session.save_path" => "/var/lib/owncloud/tmp",
    },
    require => Package['httpd'],
  }

  cron { 'owncloud cron':
    command => "/usr/bin/php5 ${owncloud::server::path}/cron.php",
    user    => $owncloud::server::user,
    hour    => '*',
    minute  => '*',
    require => User[$owncloud::server::user],
  }

}