Puppet Class: vulnerability::install::linux
- Defined in:
- manifests/install/linux.pp
Summary
This class takes care of installing `grype` on linux systems.Overview
vulnerability::install::linux
See the file “LICENSE” for the full license governing this code.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 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 |
# File 'manifests/install/linux.pp', line 25
class vulnerability::install::linux (
String[1] $base_url,
Stdlib::Absolutepath $root_dir,
String[1] $temp_dir,
String[1] $version
) {
if $facts['grype_version'] != $version {
$source_file = "grype_${version}_linux_amd64.tar.gz"
unless defined(Package['tar']) {
package { 'tar':
ensure => 'present',
}
}
file { "${temp_dir}/${source_file}":
ensure => 'file',
source => "${base_url}/v${version}/${source_file}",
}
-> exec { 'extract grype':
command => "tar xvf ${temp_dir}/${source_file} grype",
path => '/bin:/usr/bin',
cwd => "${root_dir}/bin",
require => Package['tar'],
}
-> file { "${root_dir}/bin/grype":
ensure => 'file',
owner => 'root',
mode => '0755',
}
cleanup { 'cleanup grype download':
file_name => "${temp_dir}/${source_file}",
}
}
file { "${root_dir}/etc/grype_yaml.tpl":
ensure => 'file',
source => 'puppet:///modules/vulnerability/grype_yaml.tpl',
owner => 'root',
mode => '0755',
}
}
|