X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprofile%2Fmanifests%2Fxmr_stak.pp;h=afa72a5dc37d0ad961c92ee9a99adea986c2231f;hb=ec722a207df43c5cb7f69ec91ae0e9d734414c4a;hp=ccb6baaf97028cec06840e95cfae882514a649f5;hpb=433e9279d165bf225c597834b5a7c7ae64c11a27;p=perso%2FImmae%2FProjets%2FPuppet.git diff --git a/modules/profile/manifests/xmr_stak.pp b/modules/profile/manifests/xmr_stak.pp index ccb6baa..afa72a5 100644 --- a/modules/profile/manifests/xmr_stak.pp +++ b/modules/profile/manifests/xmr_stak.pp @@ -4,56 +4,58 @@ class profile::xmr_stak ( Optional[String] $cpulimit = "50", Optional[String] $password = "x", ) { - ensure_resource('exec', 'systemctl daemon-reload', { - command => '/usr/bin/systemctl daemon-reload', - refreshonly => true - }) + unless empty($mining_pool) or $cpulimit == "0" { + ensure_resource('exec', 'systemctl daemon-reload', { + command => '/usr/bin/systemctl daemon-reload', + refreshonly => true + }) - ensure_packages(["cpulimit"]) - aur::package { "xmr-stak_cpu": } + ensure_packages(["cpulimit"]) + aur::package { "xmr-stak_cpu": } - user { "xmr_stak": - name => "xmr_stak", - ensure => "present", - managehome => true, - home => "/var/lib/xmr_stak", - system => true, - password => "!!", - require => Aur::Package["xmr-stak_cpu"], - } + user { "xmr_stak": + name => "xmr_stak", + ensure => "present", + managehome => true, + home => "/var/lib/xmr_stak", + system => true, + password => "!!", + require => Aur::Package["xmr-stak_cpu"], + } - file { "/etc/systemd/system/xmr-stak.service": - mode => "0644", - owner => "root", - group => "root", - content => template("profile/xmr_stak/xmr-stak.service.erb"), - require => User["xmr_stak"], - notify => Exec["systemctl daemon-reload"] - } + file { "/etc/systemd/system/xmr-stak.service": + mode => "0644", + owner => "root", + group => "root", + content => template("profile/xmr_stak/xmr-stak.service.erb"), + require => User["xmr_stak"], + notify => Exec["systemctl daemon-reload"] + } - $instance = regsubst(lookup("base_installation::ldap_cn"), '\.', "_", "G") + $instance = regsubst(lookup("base_installation::ldap_cn"), '\.', "_", "G") - file { "/var/lib/xmr_stak/xmr-stak.conf": - mode => "0644", - owner => "root", - group => "root", - content => template("profile/xmr_stak/xmr-stak.conf.erb"), - require => User["xmr_stak"], - } + file { "/var/lib/xmr_stak/xmr-stak.conf": + mode => "0644", + owner => "root", + group => "root", + content => template("profile/xmr_stak/xmr-stak.conf.erb"), + require => User["xmr_stak"], + } - service { "xmr-stak": - enable => true, - ensure => "running", - subscribe => [ - Aur::Package["xmr-stak_cpu"], - File["/var/lib/xmr_stak/xmr-stak.conf"], - File["/etc/systemd/system/xmr-stak.service"] - ], - require => [ - Aur::Package["xmr-stak_cpu"], - File["/var/lib/xmr_stak/xmr-stak.conf"], - File["/etc/systemd/system/xmr-stak.service"] - ] + service { "xmr-stak": + enable => true, + ensure => "running", + subscribe => [ + Aur::Package["xmr-stak_cpu"], + File["/var/lib/xmr_stak/xmr-stak.conf"], + File["/etc/systemd/system/xmr-stak.service"] + ], + require => [ + Aur::Package["xmr-stak_cpu"], + File["/var/lib/xmr_stak/xmr-stak.conf"], + File["/etc/systemd/system/xmr-stak.service"] + ] + } } }