aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-16 20:37:40 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-16 20:53:40 +0100
commit62fe8998b5497864d51ed0fe909a0ff60cc1520b (patch)
treee8826b3115cb17bae7faa76c8300e993b279fb35
parent69da835d04e741f4e85da3c473ba86c8801931fd (diff)
downloadPuppet-62fe8998b5497864d51ed0fe909a0ff60cc1520b.tar.gz
Puppet-62fe8998b5497864d51ed0fe909a0ff60cc1520b.tar.zst
Puppet-62fe8998b5497864d51ed0fe909a0ff60cc1520b.zip
Make cpu limit for xmr stak parameter
-rw-r--r--environments/global/types/s1-2.yaml1
-rw-r--r--environments/global/types/vps-ovhssd-1.yaml1
-rw-r--r--modules/profile/manifests/xmr_stak.pp3
-rw-r--r--modules/profile/templates/xmr_stak/xmr-stak.service.erb (renamed from modules/profile/files/xmr_stak/xmr-stak.service)3
4 files changed, 6 insertions, 2 deletions
diff --git a/environments/global/types/s1-2.yaml b/environments/global/types/s1-2.yaml
index a7ba753..5bfdf9a 100644
--- a/environments/global/types/s1-2.yaml
+++ b/environments/global/types/s1-2.yaml
@@ -7,3 +7,4 @@ base_installation::system_hostname: "%{ldapvar.self.vars.host.0}"
7base_installation::real_hostname: "%{facts.ec2_metadata.hostname}.v.immae.eu" 7base_installation::real_hostname: "%{facts.ec2_metadata.hostname}.v.immae.eu"
8base_installation::ldap_cert_path: "/etc/ssl/certs/ca-certificates.crt" 8base_installation::ldap_cert_path: "/etc/ssl/certs/ca-certificates.crt"
9letsencrypt::try_for_real_hostname: true 9letsencrypt::try_for_real_hostname: true
10profile::xmr_stak::cpulimit: "30"
diff --git a/environments/global/types/vps-ovhssd-1.yaml b/environments/global/types/vps-ovhssd-1.yaml
index 68534dc..8dd512c 100644
--- a/environments/global/types/vps-ovhssd-1.yaml
+++ b/environments/global/types/vps-ovhssd-1.yaml
@@ -8,3 +8,4 @@ base_installation::real_hostname: "%{facts.ec2_metadata.hostname}.ovh.net"
8base_installation::grub_device: "/dev/sdb" 8base_installation::grub_device: "/dev/sdb"
9base_installation::ldap_cert_path: "/etc/ssl/certs/ca-certificates.crt" 9base_installation::ldap_cert_path: "/etc/ssl/certs/ca-certificates.crt"
10letsencrypt::try_for_real_hostname: false 10letsencrypt::try_for_real_hostname: false
11profile::xmr_stak::cpulimit: "90"
diff --git a/modules/profile/manifests/xmr_stak.pp b/modules/profile/manifests/xmr_stak.pp
index c8bbcdd..ccb6baa 100644
--- a/modules/profile/manifests/xmr_stak.pp
+++ b/modules/profile/manifests/xmr_stak.pp
@@ -1,6 +1,7 @@
1class profile::xmr_stak ( 1class profile::xmr_stak (
2 String $mining_pool, 2 String $mining_pool,
3 String $wallet, 3 String $wallet,
4 Optional[String] $cpulimit = "50",
4 Optional[String] $password = "x", 5 Optional[String] $password = "x",
5) { 6) {
6 ensure_resource('exec', 'systemctl daemon-reload', { 7 ensure_resource('exec', 'systemctl daemon-reload', {
@@ -25,7 +26,7 @@ class profile::xmr_stak (
25 mode => "0644", 26 mode => "0644",
26 owner => "root", 27 owner => "root",
27 group => "root", 28 group => "root",
28 source => "puppet:///modules/profile/xmr_stak/xmr-stak.service", 29 content => template("profile/xmr_stak/xmr-stak.service.erb"),
29 require => User["xmr_stak"], 30 require => User["xmr_stak"],
30 notify => Exec["systemctl daemon-reload"] 31 notify => Exec["systemctl daemon-reload"]
31 } 32 }
diff --git a/modules/profile/files/xmr_stak/xmr-stak.service b/modules/profile/templates/xmr_stak/xmr-stak.service.erb
index 93ee383..d63103b 100644
--- a/modules/profile/files/xmr_stak/xmr-stak.service
+++ b/modules/profile/templates/xmr_stak/xmr-stak.service.erb
@@ -8,8 +8,9 @@ WorkingDirectory=/var/lib/xmr_stak
8Type=simple 8Type=simple
9User=xmr_stak 9User=xmr_stak
10Group=xmr_stak 10Group=xmr_stak
11ExecStart=/usr/bin/cpulimit --limit 90 /usr/bin/xmr-stak -c /var/lib/xmr_stak/xmr-stak.conf 11ExecStart=/usr/bin/cpulimit --limit <%= @cpulimit %> /usr/bin/xmr-stak -c /var/lib/xmr_stak/xmr-stak.conf
12Nice=19 12Nice=19
13 13
14[Install] 14[Install]
15WantedBy=multi-user.target 15WantedBy=multi-user.target
16