From 62fe8998b5497864d51ed0fe909a0ff60cc1520b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 16 Mar 2018 20:37:40 +0100 Subject: Make cpu limit for xmr stak parameter --- environments/global/types/s1-2.yaml | 1 + environments/global/types/vps-ovhssd-1.yaml | 1 + modules/profile/files/xmr_stak/xmr-stak.service | 15 --------------- modules/profile/manifests/xmr_stak.pp | 3 ++- modules/profile/templates/xmr_stak/xmr-stak.service.erb | 16 ++++++++++++++++ 5 files changed, 20 insertions(+), 16 deletions(-) delete mode 100644 modules/profile/files/xmr_stak/xmr-stak.service create mode 100644 modules/profile/templates/xmr_stak/xmr-stak.service.erb 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/files/xmr_stak/xmr-stak.service b/modules/profile/files/xmr_stak/xmr-stak.service deleted file mode 100644 index 93ee383..0000000 --- a/modules/profile/files/xmr_stak/xmr-stak.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=XMR Miner -After=network.target - -[Service] -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 -Nice=19 - -[Install] -WantedBy=multi-user.target 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/templates/xmr_stak/xmr-stak.service.erb b/modules/profile/templates/xmr_stak/xmr-stak.service.erb new file mode 100644 index 0000000..d63103b --- /dev/null +++ b/modules/profile/templates/xmr_stak/xmr-stak.service.erb @@ -0,0 +1,16 @@ +[Unit] +Description=XMR Miner +After=network.target + +[Service] +WorkingDirectory=/var/lib/xmr_stak + +Type=simple +User=xmr_stak +Group=xmr_stak +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 + -- cgit v1.2.3 From c443842eae41fb28d5608acfd303106e5f24798a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 17 Mar 2018 10:48:34 +0100 Subject: Add cron to update pacman keys --- modules/base_installation/manifests/cronie.pp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/base_installation/manifests/cronie.pp b/modules/base_installation/manifests/cronie.pp index 72f2d8f..e8d5dfd 100644 --- a/modules/base_installation/manifests/cronie.pp +++ b/modules/base_installation/manifests/cronie.pp @@ -29,5 +29,12 @@ class base_installation::cronie inherits base_installation { user => root, special => "reboot" } + cron { 'pacman_keys': + ensure => present, + command => "pacman-key --populate archlinux", + user => root, + minute => "0", + hour => "1", + } } } -- cgit v1.2.3