From 62fe8998b5497864d51ed0fe909a0ff60cc1520b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 16 Mar 2018 20:37:40 +0100 Subject: [PATCH] Make cpu limit for xmr stak parameter --- environments/global/types/s1-2.yaml | 1 + environments/global/types/vps-ovhssd-1.yaml | 1 + modules/profile/manifests/xmr_stak.pp | 3 ++- .../xmr_stak/xmr-stak.service.erb} | 3 ++- 4 files changed, 6 insertions(+), 2 deletions(-) rename modules/profile/{files/xmr_stak/xmr-stak.service => templates/xmr_stak/xmr-stak.service.erb} (63%) 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}" base_installation::real_hostname: "%{facts.ec2_metadata.hostname}.v.immae.eu" base_installation::ldap_cert_path: "/etc/ssl/certs/ca-certificates.crt" letsencrypt::try_for_real_hostname: true +profile::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" base_installation::grub_device: "/dev/sdb" base_installation::ldap_cert_path: "/etc/ssl/certs/ca-certificates.crt" letsencrypt::try_for_real_hostname: false +profile::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 @@ class profile::xmr_stak ( String $mining_pool, String $wallet, + Optional[String] $cpulimit = "50", Optional[String] $password = "x", ) { ensure_resource('exec', 'systemctl daemon-reload', { @@ -25,7 +26,7 @@ class profile::xmr_stak ( mode => "0644", owner => "root", group => "root", - source => "puppet:///modules/profile/xmr_stak/xmr-stak.service", + content => template("profile/xmr_stak/xmr-stak.service.erb"), require => User["xmr_stak"], notify => Exec["systemctl daemon-reload"] } diff --git a/modules/profile/files/xmr_stak/xmr-stak.service b/modules/profile/templates/xmr_stak/xmr-stak.service.erb similarity index 63% rename from modules/profile/files/xmr_stak/xmr-stak.service rename to 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 Type=simple User=xmr_stak Group=xmr_stak -ExecStart=/usr/bin/cpulimit --limit 90 /usr/bin/xmr-stak -c /var/lib/xmr_stak/xmr-stak.conf +ExecStart=/usr/bin/cpulimit --limit <%= @cpulimit %> /usr/bin/xmr-stak -c /var/lib/xmr_stak/xmr-stak.conf Nice=19 [Install] WantedBy=multi-user.target + -- 2.41.0