Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Commit e8d8eb3

Browse files
committed
Download backinator binary in consul puppet module
Signed-off-by: JoshVanL <vleeuwenjoshua@gmail.com>
1 parent 432a3ba commit e8d8eb3

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed

puppet/modules/consul/manifests/init.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
String $sha256sums_url = $consul::params::sha256sums_url,
4040
String $exporter_download_url = $consul::params::exporter_download_url,
4141
String $exporter_signature_url = $consul::params::exporter_signature_url,
42+
String $backinator_version = $consul::params::backinator_version,
43+
String $backinator_download_url = $consul::params::backinator_download_url,
44+
String $backinator_sha256 = $consul::params::backinator_sha256,
4245
Integer $uid = 871,
4346
Integer $gid = 871,
4447
String $user = 'consul',

puppet/modules/consul/manifests/install.pp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
'G'
2424
)
2525

26+
$backinator_download_url = regsubst(
27+
$consul::backinator_download_url,
28+
'#VERSION#',
29+
$consul::backinator_version,
30+
'G'
31+
)
32+
2633
# install unzip if necessary
2734
ensure_resource('package', 'unzip', {})
2835

@@ -91,6 +98,25 @@
9198
}
9299
}
93100

101+
102+
archive {"${consul::_dest_dir}/consul-backinator":
103+
ensure => present,
104+
extract => false,
105+
source => $backinator_download_url,
106+
checksum => $consul::backinator_sha256,
107+
checksum_type => 'sha256',
108+
cleanup => false,
109+
creates => "${consul::_dest_dir}/consul-backinator",
110+
}
111+
-> file {"${consul::_dest_dir}/consul-backinator":
112+
ensure => file,
113+
mode => '0755',
114+
}
115+
-> file {"${consul::link_path}/${consul::app_name}-backinator":
116+
ensure => link,
117+
target => "${consul::_dest_dir}/consul-backinator",
118+
}
119+
94120
file { "${consul::_dest_dir}/consul-backup.sh":
95121
ensure => file,
96122
content => file('consul/consul-backup.sh'),

puppet/modules/consul/manifests/params.pp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@
66
class consul::params {
77
$app_name = 'consul'
88
$version = '1.2.1'
9+
$exporter_version = '0.3.0'
10+
$backinator_version = '1.3'
911
$download_dir = '/tmp'
1012
$systemd_dir = '/etc/systemd/system'
1113
$data_dir = '/var/lib/consul'
1214
$config_dir = '/etc/consul'
1315
$dest_dir = '/opt'
14-
$exporter_version = '0.3.0'
1516
$download_url = 'https://releases.hashicorp.com/consul/#VERSION#/consul_#VERSION#_linux_amd64.zip'
1617
$sha256sums_url = 'https://releases.hashicorp.com/consul/#VERSION#/consul_#VERSION#_SHA256SUMS'
1718
$signature_url = 'https://releases.hashicorp.com/consul/#VERSION#/consul_#VERSION#_SHA256SUMS.sig'
1819
$exporter_download_url = 'https://github.com/prometheus/consul_exporter/releases/download/v#VERSION#/consul_exporter-#VERSION#.linux-amd64.tar.gz'
1920
$exporter_signature_url = 'https://releases.tarmak.io/signatures/consul_exporter/#VERSION#/consul_exporter-#VERSION#.linux-amd64.tar.gz.asc'
21+
$backinator_download_url = 'https://github.com/myENA/consul-backinator/releases/download/v#VERSION#/consul-backinator-#VERSION#-amd64-linux.tar.gz'
22+
$backinator_sha256 = '8ea624487a86007825884685dbc978ba87f7a448f11d59b9eb29fd5b1b2a0e87'
2023
}

puppet/modules/consul/spec/classes/install_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,16 @@
4343
:target => '/opt/consul-1.2.1/consul-backup.sh',
4444
)
4545
end
46+
47+
it 'should install consul backinator' do
48+
should contain_file('/opt/consul-1.2.1/consul-backinator').with(
49+
:ensure => 'file',
50+
:mode => '0755',
51+
)
52+
should contain_file('/opt/bin/consul-backinator').with(
53+
:ensure => 'link',
54+
:target => '/opt/consul-1.2.1/consul-backinator',
55+
)
56+
end
4657
end
4758
end

0 commit comments

Comments
 (0)