From 68bbff6199a64dd32739487334260962261f7195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 21 Feb 2018 20:42:04 +0100 Subject: Add xmr-stak --- modules/profile/manifests/xmr_stak.pp | 57 +++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 modules/profile/manifests/xmr_stak.pp (limited to 'modules/profile/manifests') diff --git a/modules/profile/manifests/xmr_stak.pp b/modules/profile/manifests/xmr_stak.pp new file mode 100644 index 0000000..20d2c08 --- /dev/null +++ b/modules/profile/manifests/xmr_stak.pp @@ -0,0 +1,57 @@ +class profile::xmr_stak { + ensure_resource('exec', 'systemctl daemon-reload', { + command => '/usr/bin/systemctl daemon-reload', + refreshonly => true + }) + + 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"], + } + + file { "/etc/systemd/system/xmr-stak.service": + mode => "0644", + owner => "root", + group => "root", + source => "puppet:///modules/profile/xmr_stak/xmr-stak.service", + require => User["xmr_stak"], + notify => Exec["systemctl daemon-reload"] + } + + $mining_pool = lookup("xmr_stak::mining_pool") |$key| { {} } + $wallet = lookup("xmr_stak::wallet") |$key| { {} } + $password = lookup("xmr_stak::password") |$key| { "x" } + $instance = regsubst($facts["ec2_metadata"]["hostname"], "\.", "_", "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"], + } + + 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"] + ] + } +} + -- cgit v1.2.3