Puppet Class: ec2tagfacts
- Inherits:
- ec2tagfacts::params
- Defined in:
- manifests/init.pp
Overview
Class: ec2tagfacts
EC2 tags are turned into puppet facts. AWS cli automatically installed.
Parameters
- aws_access_key_id
-
This is an aws_access_key_id with policy rights to read tags.
- aws_secret_access_key
-
This is the secret_access_key to the above key id.
- aws_cli_ini_settings
-
Full path to the aws cli ini file to store credentials. Default is provided.
- manage_awscli
-
True to have this module manage awscli installation, false not to. If false awscli must be installed by other means.
- enable_epel
-
True to enable EPEL automatically, false not to. Automatically set in ec2tagfacts::params based on OS family.
- pippkg
-
Set in ec2tagfacts::params, this is the Python pip package name by OS family. False disables python pip package management.
- awscli
-
Set in ec2tagfacts::params, this is the pip package name of awscli.
- rubyjsonpkg
-
Set in ec2tagfacts::params, this is the ruby-json package name. False disables ruby-json package package management.
Examples
/* Autodetect awscli tools provider installation */
class { 'ec2tagfacts':
aws_access_key_id => 'ASFJIJ3IGJ5JSKAJ',
aws_secret_access_key => 'svbasJAB254FHU6hsH5ujxfjdSs',
}
/* Force pip provider installation */
class { 'ec2tagfacts':
aws_access_key_id => 'ASFJIJ3IGJ5JSKAJ',
aws_secret_access_key => 'svbasJAB254FHU6hsH5ujxfjdSs',
awscli_pkg => 'pip',
awscli => 'awscli',
}
/* Force yum provider installation and don't set an access key or secret since we use a Role */
class { 'ec2tagfacts':
awscli_pkg => 'yum',
awscli => 'awscli',
}
Authors
Bryan Andrews <bryanandrews@gmail.com>
Copyright
Copyright 2015 Bryan Andrews, unless otherwise noted.
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 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'manifests/init.pp', line 66
class ec2tagfacts (
Optional[String] $aws_access_key_id = undef,
Optional[String] $aws_secret_access_key = undef,
String $aws_cli_ini_settings = $ec2tagfacts::params::aws_cli_ini_settings,
Boolean $manage_awscli = true,
Boolean $enable_epel = $ec2tagfacts::params::enable_epel,
$pippkg = $ec2tagfacts::params::pippkg,
String $awscli = $ec2tagfacts::params::awscli,
String $rubyjsonpkg = $ec2tagfacts::params::rubyjsonpkg,
Variant[String, Enum['apt','pip','portage','yum']] $awscli_pkg = $ec2tagfacts::params::awscli_pkg,
) inherits ec2tagfacts::params {
if $manage_awscli == true {
if $enable_epel == true {
include ::epel
}
if $pippkg != false {
if $enable_epel == true {
Class['epel'] -> Package[$pippkg]
}
package { $pippkg:
ensure => 'installed',
}
package { $awscli:
ensure => 'installed',
provider => $awscli_pkg,
require => Package[$pippkg],
}
} else {
package { $awscli:
ensure => 'installed',
provider => $awscli_pkg,
}
}
}
if $rubyjsonpkg != false {
package { 'ruby-json-package':
ensure => 'installed',
name => $rubyjsonpkg,
}
}
if ($aws_secret_access_key != undef) and ($aws_access_key_id != undef) {
$directory = dirname($aws_cli_ini_settings)
file { $directory:
ensure => directory,
require => Package[$awscli],
recurse => true,
}
ini_setting { 'aws_access_key_id setting':
ensure => present,
path => $aws_cli_ini_settings,
section => 'default',
setting => 'aws_access_key_id',
value => $aws_access_key_id,
require => File[$directory],
}
ini_setting { 'aws_secret_access_key setting':
ensure => present,
path => $aws_cli_ini_settings,
section => 'default',
setting => 'aws_secret_access_key',
value => $aws_secret_access_key,
require => File[$directory],
}
}
}
|