aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--environments/production/data/common.yaml2
-rw-r--r--modules/profile/files/xmr_stak/xmr-stak.service15
-rw-r--r--modules/profile/manifests/tools.pp2
-rw-r--r--modules/profile/manifests/xmr_stak.pp57
-rw-r--r--modules/profile/templates/xmr_stak/xmr-stak.conf.erb23
-rw-r--r--modules/role/manifests/cryptoportfolio.pp12
6 files changed, 105 insertions, 6 deletions
diff --git a/environments/production/data/common.yaml b/environments/production/data/common.yaml
index 32e0aa3..78cce6b 100644
--- a/environments/production/data/common.yaml
+++ b/environments/production/data/common.yaml
@@ -21,3 +21,5 @@ base_installation::system_users:
21 - host: "immae.eu" 21 - host: "immae.eu"
22 key: "AAAAB3NzaC1yc2EAAAADAQABAAABAQDi5PgLBwMRyRwzJPnSgUyRAuB9AAxMijsw1pR/t/wmxQne1O5fIPOleHx+D8dyZbwm+XkzlcJpgT0Qy3qC9J8BPhshJvO/tA/8CI/oS/FE0uWsyACH1DMO2dk4gRRZGSE9IuzDMRPlnfZ3n0tdsPzzv3GH4It/oPIgsvkTowKztGLQ7Xmjr5BxzAhXcIQymqA0U3XWHSdWvnSRDaOFG0PDoVMS85IdwlviVKLnV5Sstb4NC/P28LFfgvW8DO/XrOqujgDomqTmR41dK/AyrGGOb2cQUMO4l8Oa+74aOyKaB61rr/rJkr+wCbEttkTvgFa6zZygSk3edfiWE2rgn4+v" 22 key: "AAAAB3NzaC1yc2EAAAADAQABAAABAQDi5PgLBwMRyRwzJPnSgUyRAuB9AAxMijsw1pR/t/wmxQne1O5fIPOleHx+D8dyZbwm+XkzlcJpgT0Qy3qC9J8BPhshJvO/tA/8CI/oS/FE0uWsyACH1DMO2dk4gRRZGSE9IuzDMRPlnfZ3n0tdsPzzv3GH4It/oPIgsvkTowKztGLQ7Xmjr5BxzAhXcIQymqA0U3XWHSdWvnSRDaOFG0PDoVMS85IdwlviVKLnV5Sstb4NC/P28LFfgvW8DO/XrOqujgDomqTmR41dK/AyrGGOb2cQUMO4l8Oa+74aOyKaB61rr/rJkr+wCbEttkTvgFa6zZygSk3edfiWE2rgn4+v"
23 key_type: "ssh-rsa" 23 key_type: "ssh-rsa"
24xmr_stak::mining_pool: "pool.minexmr.com:7777"
25xmr_stak::wallet: "44CA8TxTFYbQqN2kLyk8AnB6Ghz4mcbGpYC2EyXW7A8H9QspvWnTjDn39XUZDPrFwPa5JNwt4TmAxcooPWv4SaJqL87Bcdo"
diff --git a/modules/profile/files/xmr_stak/xmr-stak.service b/modules/profile/files/xmr_stak/xmr-stak.service
new file mode 100644
index 0000000..93ee383
--- /dev/null
+++ b/modules/profile/files/xmr_stak/xmr-stak.service
@@ -0,0 +1,15 @@
1[Unit]
2Description=XMR Miner
3After=network.target
4
5[Service]
6WorkingDirectory=/var/lib/xmr_stak
7
8Type=simple
9User=xmr_stak
10Group=xmr_stak
11ExecStart=/usr/bin/cpulimit --limit 90 /usr/bin/xmr-stak -c /var/lib/xmr_stak/xmr-stak.conf
12Nice=19
13
14[Install]
15WantedBy=multi-user.target
diff --git a/modules/profile/manifests/tools.pp b/modules/profile/manifests/tools.pp
index 0b0ab46..9f9d593 100644
--- a/modules/profile/manifests/tools.pp
+++ b/modules/profile/manifests/tools.pp
@@ -1,3 +1,3 @@
1class profile::tools { 1class profile::tools {
2 ensure_packages(['vim', 'bash-completion', 'net-tools']) 2 ensure_packages(['vim', 'bash-completion', 'net-tools', 'htop'])
3} 3}
diff --git a/modules/profile/manifests/xmr_stak.pp b/modules/profile/manifests/xmr_stak.pp
new file mode 100644
index 0000000..20d2c08
--- /dev/null
+++ b/modules/profile/manifests/xmr_stak.pp
@@ -0,0 +1,57 @@
1class profile::xmr_stak {
2 ensure_resource('exec', 'systemctl daemon-reload', {
3 command => '/usr/bin/systemctl daemon-reload',
4 refreshonly => true
5 })
6
7 ensure_packages(["cpulimit"])
8 aur::package { "xmr-stak_cpu": }
9
10 user { "xmr_stak":
11 name => "xmr_stak",
12 ensure => "present",
13 managehome => true,
14 home => "/var/lib/xmr_stak",
15 system => true,
16 password => "!!",
17 require => Aur::Package["xmr-stak_cpu"],
18 }
19
20 file { "/etc/systemd/system/xmr-stak.service":
21 mode => "0644",
22 owner => "root",
23 group => "root",
24 source => "puppet:///modules/profile/xmr_stak/xmr-stak.service",
25 require => User["xmr_stak"],
26 notify => Exec["systemctl daemon-reload"]
27 }
28
29 $mining_pool = lookup("xmr_stak::mining_pool") |$key| { {} }
30 $wallet = lookup("xmr_stak::wallet") |$key| { {} }
31 $password = lookup("xmr_stak::password") |$key| { "x" }
32 $instance = regsubst($facts["ec2_metadata"]["hostname"], "\.", "_", "G")
33
34 file { "/var/lib/xmr_stak/xmr-stak.conf":
35 mode => "0644",
36 owner => "root",
37 group => "root",
38 content => template("profile/xmr_stak/xmr-stak.conf.erb"),
39 require => User["xmr_stak"],
40 }
41
42 service { "xmr-stak":
43 enable => true,
44 ensure => "running",
45 subscribe => [
46 Aur::Package["xmr-stak_cpu"],
47 File["/var/lib/xmr_stak/xmr-stak.conf"],
48 File["/etc/systemd/system/xmr-stak.service"]
49 ],
50 require => [
51 Aur::Package["xmr-stak_cpu"],
52 File["/var/lib/xmr_stak/xmr-stak.conf"],
53 File["/etc/systemd/system/xmr-stak.service"]
54 ]
55 }
56}
57
diff --git a/modules/profile/templates/xmr_stak/xmr-stak.conf.erb b/modules/profile/templates/xmr_stak/xmr-stak.conf.erb
new file mode 100644
index 0000000..e483b0e
--- /dev/null
+++ b/modules/profile/templates/xmr_stak/xmr-stak.conf.erb
@@ -0,0 +1,23 @@
1"pool_list" :
2[
3{"pool_address" : "<%= @mining_pool %>", "wallet_address" : "<%= @wallet %>.<%= @instance %>", "pool_password" : "<%= @password %>", "use_nicehash" : false, "use_tls" : false, "tls_fingerprint" : "", "pool_weight" : 1 },
4],
5
6"currency" : "monero",
7"call_timeout" : 10,
8"retry_time" : 30,
9"giveup_limit" : 0,
10
11"verbose_level" : 3,
12"print_motd" : true,
13"h_print_time" : 60,
14"aes_override" : null,
15"use_slow_memory" : "warn",
16"tls_secure_algo" : true,
17"daemon_mode" : true,
18"flush_stdout" : false,
19"output_file" : "",
20"httpd_port" : 0,
21"http_login" : "",
22"http_pass" : "",
23"prefer_ipv4" : true,
diff --git a/modules/role/manifests/cryptoportfolio.pp b/modules/role/manifests/cryptoportfolio.pp
index 9a2bfd2..5860f90 100644
--- a/modules/role/manifests/cryptoportfolio.pp
+++ b/modules/role/manifests/cryptoportfolio.pp
@@ -1,9 +1,15 @@
1class role::cryptoportfolio { 1class role::cryptoportfolio {
2 ensure_resource('exec', 'systemctl daemon-reload', {
3 command => '/usr/bin/systemctl daemon-reload',
4 refreshonly => true
5 })
6
2 include "base_installation" 7 include "base_installation"
3 8
4 include "profile::tools" 9 include "profile::tools"
5 include "profile::postgresql" 10 include "profile::postgresql"
6 include "profile::apache" 11 include "profile::apache"
12 include "profile::xmr_stak"
7 13
8 $password_seed = lookup("base_installation::puppet_pass_seed") |$key| { {} } 14 $password_seed = lookup("base_installation::puppet_pass_seed") |$key| { {} }
9 15
@@ -244,9 +250,7 @@ class role::cryptoportfolio {
244 owner => "root", 250 owner => "root",
245 group => "root", 251 group => "root",
246 content => template("role/cryptoportfolio/cryptoportfolio-app.service.erb"), 252 content => template("role/cryptoportfolio/cryptoportfolio-app.service.erb"),
247 } ~> exec { 'systemctl deamon-reload': 253 notify => Exec["systemctl daemon-reload"],
248 command => '/usr/bin/systemctl daemon-reload',
249 refreshonly => true
250 } 254 }
251 255
252 service { 'cryptoportfolio-app': 256 service { 'cryptoportfolio-app':
@@ -303,6 +307,4 @@ class role::cryptoportfolio {
303 require => [File[$cf_front_app_static_conf], Exec["web-cryptoportfolio-dependencies"]] 307 require => [File[$cf_front_app_static_conf], Exec["web-cryptoportfolio-dependencies"]]
304 } 308 }
305 } 309 }
306
307 # TODO: xmr_stack
308} 310}