]>
Commit | Line | Data |
---|---|---|
a045b9dc IB |
1 | class profile::xmr_stak ( |
2 | String $mining_pool, | |
3 | String $wallet, | |
62fe8998 | 4 | Optional[String] $cpulimit = "50", |
a045b9dc IB |
5 | Optional[String] $password = "x", |
6 | ) { | |
c2f33e53 IB |
7 | unless empty($mining_pool) or $cpulimit == "0" { |
8 | ensure_resource('exec', 'systemctl daemon-reload', { | |
9 | command => '/usr/bin/systemctl daemon-reload', | |
10 | refreshonly => true | |
11 | }) | |
68bbff61 | 12 | |
c2f33e53 | 13 | ensure_packages(["cpulimit"]) |
42c7bdd6 IB |
14 | aur::package { "xmr-stak_cpu": |
15 | ensure => "absent" | |
16 | } -> | |
17 | aur::package { "xmr-stak": } | |
18 | ~> | |
19 | exec { "remove cpu.txt": | |
20 | command => "/usr/bin/rm /var/lib/xmr_stak/cpu.txt", | |
21 | refreshonly => true, | |
22 | before => Service["xmr-stak"], | |
23 | } | |
68bbff61 | 24 | |
c2f33e53 IB |
25 | user { "xmr_stak": |
26 | name => "xmr_stak", | |
27 | ensure => "present", | |
28 | managehome => true, | |
29 | home => "/var/lib/xmr_stak", | |
30 | system => true, | |
31 | password => "!!", | |
42c7bdd6 | 32 | require => Aur::Package["xmr-stak"], |
c2f33e53 | 33 | } |
68bbff61 | 34 | |
c2f33e53 IB |
35 | file { "/etc/systemd/system/xmr-stak.service": |
36 | mode => "0644", | |
37 | owner => "root", | |
38 | group => "root", | |
39 | content => template("profile/xmr_stak/xmr-stak.service.erb"), | |
40 | require => User["xmr_stak"], | |
41 | notify => Exec["systemctl daemon-reload"] | |
42 | } | |
68bbff61 | 43 | |
c2f33e53 | 44 | $instance = regsubst(lookup("base_installation::ldap_cn"), '\.', "_", "G") |
68bbff61 | 45 | |
c2f33e53 IB |
46 | file { "/var/lib/xmr_stak/xmr-stak.conf": |
47 | mode => "0644", | |
48 | owner => "root", | |
49 | group => "root", | |
50 | content => template("profile/xmr_stak/xmr-stak.conf.erb"), | |
51 | require => User["xmr_stak"], | |
52 | } | |
68bbff61 | 53 | |
c2f33e53 IB |
54 | service { "xmr-stak": |
55 | enable => true, | |
56 | ensure => "running", | |
57 | subscribe => [ | |
42c7bdd6 | 58 | Aur::Package["xmr-stak"], |
c2f33e53 IB |
59 | File["/var/lib/xmr_stak/xmr-stak.conf"], |
60 | File["/etc/systemd/system/xmr-stak.service"] | |
61 | ], | |
62 | require => [ | |
42c7bdd6 | 63 | Aur::Package["xmr-stak"], |
c2f33e53 IB |
64 | File["/var/lib/xmr_stak/xmr-stak.conf"], |
65 | File["/etc/systemd/system/xmr-stak.service"] | |
66 | ] | |
67 | } | |
68bbff61 IB |
68 | } |
69 | } | |
70 |