Puppet Class: psick::aws::cli

Defined in:
manifests/aws/cli.pp

Overview

Parameters:

  • ensure (String) (defaults to: 'present')
  • region (String) (defaults to: $psick::aws::region)
  • aws_access_key_id (String) (defaults to: '')
  • aws_secret_access_key (String) (defaults to: '')
  • config_template (String) (defaults to: 'psick/aws/credentials.erb')
  • install_gems (Array) (defaults to: ['aws-sdk-core' , 'retries'])
  • install_system_gems (Boolean) (defaults to: true)
  • install_puppet_gems (Boolean) (defaults to: true)
  • manage (Boolean) (defaults to: $psick::manage)
  • noop_manage (Boolean) (defaults to: $psick::noop_manage)
  • noop_value (Boolean) (defaults to: $psick::noop_value)


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
# File 'manifests/aws/cli.pp', line 2

class psick::aws::cli (
  String $ensure                = 'present',
  String $region                = $psick::aws::region,
  String $aws_access_key_id     = '', # lint:ignore:params_empty_string_assignment
  String $aws_secret_access_key = '', # lint:ignore:params_empty_string_assignment
  String $config_template       = 'psick/aws/credentials.erb',
  Array $install_gems           = ['aws-sdk-core' , 'retries'],
  Boolean $install_system_gems  = true,
  Boolean $install_puppet_gems  = true,

  Boolean $manage               = $psick::manage,
  Boolean $noop_manage          = $psick::noop_manage,
  Boolean $noop_value           = $psick::noop_value,
) {
  if $manage {
    if $noop_manage {
      noop($noop_value)
    }
    contain psick::python::pip
    contain psick::ruby

    tp::install { 'awscli':
      ensure => $ensure,
    }
    ensure_packages('jq')

    $install_gems.each | $gem | {
      if $install_system_gems {
        package { $gem:
          ensure   => $ensure,
          provider => 'gem',
          require  => Class['psick::ruby'],
        }
      }
      if $install_puppet_gems {
        package { "puppet_${gem}":
          ensure   => $ensure,
          name     => $gem,
          provider => 'puppet_gem',
          require  => Class['psick::ruby'],
        }
      }
    }

    file { '/root/.aws':
      ensure => directory,
    }
    if $aws_access_key_id != ''
    and $aws_secret_access_key != '' {
      file { '/root/.aws/credentials':
        ensure  => $ensure,
        content => template($config_template),
        mode    => '0400',
      }
    }

    if $region != '' {
      file { '/root/.aws/config':
        ensure  => $ensure,
        content => template('psick/aws/config.erb'),
      }
    }
  }
}