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