Skip to content

Commit

Permalink
Added some configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
clouetb committed Jul 8, 2017
1 parent 4ac157f commit bc17bec
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 3 deletions.
21 changes: 20 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# == Class: geth::config
class geth::config inherits geth {
class geth::config ($init_data, $account_password) inherits geth {
exec { 'geth-init-data':
cwd => '/home/geth'
command => 'geth --datadir data init $init_data',
user => 'geth',
path => [ '/usr/bin', '/bin', '/usr/sbin' ],
}~>
file { 'passfile':
path => '/home/geth/passfile',
content => "${account_password}",
owner => 'geth',
mode => '0400',
}~>
exec { 'geth-create-account':
cwd => '/home/geth'
command => 'geth account new --password /home/geth/passfile',
user => 'geth',
path => [ '/usr/bin', '/bin', '/usr/sbin' ],
}
}

22 changes: 20 additions & 2 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
baseurl => 'http://repo.okay.com.mx/centos/$releasever/$basearch/release',
descr => 'OKAY RPM repository',
enabled => 1,
gpgcheck => 1,
gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OKAY',
gpgcheck => 0,
}

package { 'go-ethereum':
Expand All @@ -21,6 +20,25 @@
user { 'geth':
ensure => 'present',
groups => 'geth',
managehome => true,
}

file { 'datadir':
path => '/home/geth/data',
ensure => 'directory',
owner => 'geth',
}

file { '/lib/systemd/system/geth.service':
mode => '0644',
owner => 'root',
group => 'root',
content => template('geth/geth.service.erb'),
}~>
exec { 'geth-systemd-reload':
command => 'systemctl daemon-reload',
path => [ '/usr/bin', '/bin', '/usr/sbin' ],
refreshonly => true,
}

}
Expand Down
10 changes: 10 additions & 0 deletions manifests/service.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# == Class: geth::service
class geth::service inherits geth {
file { 'logdir':
path => '/var/log/geth',
ensure => 'directory',
owner => 'geth',
mode => '0755',
}~>
service { 'geth':
ensure => running,
enable => true,
}
}
13 changes: 13 additions & 0 deletions templates/geth.service.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Go Ethereum client
Wants=basic.target
After=basic.target network.target

[Service]
WorkingDirectory=/home/geth
User=geth
ExecStart=/usr/bin/geth
Type=simple

[Install]
WantedBy=default.target

0 comments on commit bc17bec

Please sign in to comment.