39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# File 'manifests/init.pp', line 39
class archive (
Optional[String[1]] $seven_zip_name = $archive::params::seven_zip_name,
Optional[Enum['chocolatey','windows','']] $seven_zip_provider = $archive::params::seven_zip_provider,
Optional[String[1]] $seven_zip_source = undef,
Boolean $aws_cli_install = false,
Boolean $gsutil_install = false,
Hash $archives = {},
) inherits archive::params {
if $facts['os']['family'] == 'Windows' and !($seven_zip_provider in ['', undef]) {
package { '7zip':
ensure => present,
name => $seven_zip_name,
source => $seven_zip_source,
provider => $seven_zip_provider,
}
}
if $aws_cli_install {
# TODO: Windows support.
if $facts['os']['family'] != 'Windows' {
# Using bundled install option:
# http://docs.aws.amazon.com/cli/latest/userguide/installing.html#install-bundle-other-os
file { '/opt/awscli-bundle':
ensure => 'directory',
}
archive { 'awscli-bundle.zip':
ensure => present,
path => '/opt/awscli-bundle/awscli-bundle.zip',
source => 'https://s3.amazonaws.com/aws-cli/awscli-bundle.zip',
extract => true,
extract_path => '/opt',
creates => '/opt/awscli-bundle/install',
cleanup => true,
}
exec { 'install_aws_cli':
command => '/opt/awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws',
refreshonly => true,
subscribe => Archive['awscli-bundle.zip'],
}
}
}
if $gsutil_install {
# TODO: Windows support.
if $facts['os']['family'] != 'Windows' {
# Using bundled install option:
# https://cloud.google.com/storage/docs/quickstart-gsutil
file { '/opt/gsutil-bundle':
ensure => 'directory',
}
archive { 'gsutil.zip':
ensure => present,
path => '/opt/gsutil-bundle/gsutil.zip',
source => 'https://storage.googleapis.com/pub/gsutil.zip',
extract => true,
extract_path => '/opt',
creates => '/opt/gsutil-bundle/gsutil',
cleanup => true,
}
exec { 'install_gsutil':
command => '/opt/gsutil-bundle/gsutil/setup.py install -q',
refreshonly => true,
subscribe => Archive['gsutil.zip'],
}
}
}
$archives.each |$archive_name, $archive_settings| {
archive { $archive_name:
* => $archive_settings,
}
}
}
|