Last active
June 25, 2018 21:47
-
-
Save 7yl4r/08ee2ab84a488d9733f2ec6e3d37e3cf to your computer and use it in GitHub Desktop.
first pass at ipfs puppet module install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ipfs::install(){ | |
$installer_version = '1.5.2' | |
$ipfs_version = '0.4.15' | |
$dl_url = "https://dist.ipfs.io/ipfs-update/v${version}/ipfs-update_v${version}_linux-amd64.tar.gz" | |
$ipfs_install_dir = '/opt/ipfs' | |
file { $ipfs_install_dir: | |
path => '/opt/ipfs', | |
ensure => 'directory', | |
} | |
# file { 'ipfs_update_script': | |
# path => '/opt/ipfs/ipfs-update.tar.gz', | |
# ensure => 'file', | |
# mode => 'a+x', | |
# source => 'https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz', | |
# require => File['ipfs_install_dir'], | |
# } | |
include '::archive' # NOTE: optional for posix platforms | |
$archive_path = "$ipfs_install_dir/ipfs_update.tar.gz" | |
$extracted_path = "$ipfs_install_dir/ipfs-update" | |
archive { $archive_path: | |
ensure => present, | |
extract => true, | |
extract_path => '/opt/ipfs', | |
source => $dl_url, | |
# checksum => 'checksum hash', | |
# checksum_type => 'sha1', | |
creates => $extracted_path, | |
cleanup => false, | |
require => File[$ipfs_install_dir], | |
} | |
exec { 'ipfs_update_install': | |
command => "$extracted_path/ipfs-update install ${ipfs_version}", | |
require => Archive[$archive_path], | |
cwd => $extracted_path, | |
# user => airflow, # ? | |
environment => [ | |
# set GOPATH b/c https://github.com/ipfs/ipfs-update/issues/73 | |
'HOME=/root', # $HOME not set by exec automatically... | |
'GOPATH=/root/go', | |
], | |
unless => '/usr/bin/which ipfs', | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment