puppet-wmdeit_nextcloud/manifests/init.pp

182 lines
3.4 KiB
Puppet

#
#
#
class wmdeit_nextcloud(
$instanceid,
$passwordsalt,
$secret,
$trusted_domains =[] ,
$main_domain,
$ext_url = "https://$main_domain",
$install_dir = "/var/www/nextcloud",
$distfile = "nextcloud-19.0.1.zip",
$sourcefile = "https://download.nextcloud.com/server/releases/nextcloud-19.0.1.zip",
$redis_password = undef,
$db_port = undef,
$db_user = "nextcloud",
$db_password = undef,
$db_host = "localhost",
$db_name = "nextcloud",
$db_type = "mysql",
$db_prefix = "oc_",
$data_dir = "$install_dir/data",
$nc_user = "www-data",
$nc_group = "www-data",
$php_version = "7.2"
)
{
class { 'apache':
mpm_module => 'prefork',
}
class { 'apache::mod::php':
# php_version=>"7.2"
}
class { '::php':
extensions => {
zip => {},
mbstring => {},
gd => {},
curl => {},
pgsql => {},
mysql => {},
ldap => {},
intl => {},
imagick => {},
redis => {},
apcu => {},
},
settings => {
'PHP/memory_limit' => '512M',
}
}
archive { "/tmp/$distfile":
ensure => present,
source => $sourcefile,
extract_path => "/var/www",
extract => true,
cleanup => true,
checksum => $checksum,
checksum_type => $checksum_type,
creates => "$install_dir",
require => Class["apache"]
} ->
apache::vhost { $main_domain:
serveraliases => $trusted_domains,
port => '80',
docroot => $install_dir,
} ->
exec { 'ncperms':
command => "/bin/chown -R www-data:www-data $install_dir",
subscribe => Archive["/tmp/$distfile"],
require => Class["apache"]
} ->
file { "$install_dir/config/config.php":
ensure => file,
content => template("wmdeit_nextcloud/config.php.erb")
} ->
exec {"/bin/mkdir -p $data_dir":
creates => $data_dir
} ->
file {$data_dir:
ensure => directory,
owner => $nc_user,
group => $nc_group
} ->
file {"$data_dir/.ocdata":
ensure => file,
owner => $nc_user,
group => $nc_group
} ->
file {"/etc/php/$php_version/apache2/php.ini":
ensure => file,
content => template("wmdeit_nextcloud/php.ini.erb")
}
cron {'nc_cron':
ensure => present,
user => 'www-data',
command => '/usr/bin/php /var/www/html/cron.php',
minute => '*/15',
}
class {'redis':
bind => '127.0.0.1',
masterauth => $redis_password
}
include java
package {"elasticsearch":
ensure => installed
}
# class { 'elasticsearch':
# status => 'enabled',
# version => '7.8.0',
# ensure => absent
# }
# elasticsearch::instance { 'es-01': }
#class {"wmdeit_nextcloud::solr":
#}
}
class wmdeit_nextcloud::solr
{
###
# solr
package {["openjdk-11-jdk","lsof"]:
ensure => installed
}
file {"/opt":
ensure => directory
} ->
archive { "/tmp/solr-8.6.0.tgz":
ensure => present,
source => "https://downloads.apache.org/lucene/solr/8.6.0/solr-8.6.0.tgz",
extract_path => "/opt/",
extract => true,
cleanup => false,
checksum => $checksum,
checksum_type => $checksum_type,
creates => "/opt/solr-8.6.0",
} ->
file { '/opt/solr':
ensure => link,
target => "/opt/solr-8.6.0",
} ->
group{"solr":
ensure => present
} ->
user{"solr":
ensure => present
}->
file { '/opt/solr/server/logs':
ensure => directory,
owner => 'solr',
group => 'solr',
}->
exec{ '/opt/solr/bin/solr start':
user => 'solr',
}
}