]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/commitdiff
Make cpu limit for xmr stak parameter
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 16 Mar 2018 19:37:40 +0000 (20:37 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 16 Mar 2018 19:53:40 +0000 (20:53 +0100)
environments/global/types/s1-2.yaml
environments/global/types/vps-ovhssd-1.yaml
modules/profile/manifests/xmr_stak.pp
modules/profile/templates/xmr_stak/xmr-stak.service.erb [moved from modules/profile/files/xmr_stak/xmr-stak.service with 63% similarity]

index a7ba753399c03cff653d135f6df21c62993d339b..5bfdf9ac0c2c8be169c140f04df1b2470ccfbe28 100644 (file)
@@ -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"
index 68534dc2dfdcfbf6e06413903ee21b5e7ffc5db6..8dd512c593fdd67e7e58a08981c3fb6ff5af16c0 100644 (file)
@@ -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"
index c8bbcdd39c26bfd5081aae5003f9a3c26ffdfbd4..ccb6baaf97028cec06840e95cfae882514a649f5 100644 (file)
@@ -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"]
   }
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 93ee383d682318744de0c7e95d36a67b08e03040..d63103b85e0cad10aeb3d3fdf907302987f64868 100644 (file)
@@ -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
+