]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blob - modules/profile/manifests/xmr_stak.pp
Merge branch 'fixes' into dev
[perso/Immae/Projets/Puppet.git] / modules / profile / manifests / xmr_stak.pp
1 class profile::xmr_stak (
2 String $mining_pool,
3 String $wallet,
4 Optional[String] $cpulimit = "50",
5 Optional[String] $password = "x",
6 ) {
7 ensure_resource('exec', 'systemctl daemon-reload', {
8 command => '/usr/bin/systemctl daemon-reload',
9 refreshonly => true
10 })
11
12 ensure_packages(["cpulimit"])
13 aur::package { "xmr-stak_cpu": }
14
15 user { "xmr_stak":
16 name => "xmr_stak",
17 ensure => "present",
18 managehome => true,
19 home => "/var/lib/xmr_stak",
20 system => true,
21 password => "!!",
22 require => Aur::Package["xmr-stak_cpu"],
23 }
24
25 file { "/etc/systemd/system/xmr-stak.service":
26 mode => "0644",
27 owner => "root",
28 group => "root",
29 content => template("profile/xmr_stak/xmr-stak.service.erb"),
30 require => User["xmr_stak"],
31 notify => Exec["systemctl daemon-reload"]
32 }
33
34 $instance = regsubst(lookup("base_installation::ldap_cn"), '\.', "_", "G")
35
36 file { "/var/lib/xmr_stak/xmr-stak.conf":
37 mode => "0644",
38 owner => "root",
39 group => "root",
40 content => template("profile/xmr_stak/xmr-stak.conf.erb"),
41 require => User["xmr_stak"],
42 }
43
44 service { "xmr-stak":
45 enable => true,
46 ensure => "running",
47 subscribe => [
48 Aur::Package["xmr-stak_cpu"],
49 File["/var/lib/xmr_stak/xmr-stak.conf"],
50 File["/etc/systemd/system/xmr-stak.service"]
51 ],
52 require => [
53 Aur::Package["xmr-stak_cpu"],
54 File["/var/lib/xmr_stak/xmr-stak.conf"],
55 File["/etc/systemd/system/xmr-stak.service"]
56 ]
57 }
58 }
59