Puppet Class: r_profile::cloud::azure
- Defined in:
- manifests/cloud/azure.pp
Overview
puppet module install puppet-nodejs –version 2.3.0
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 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 |
# File 'manifests/cloud/azure.pp', line 36
class r_profile::cloud::azure(
Optional[String] $subscription_id = hiera('r_profile::cloud::azure::subscription_id', undef),
Optional[String] $tenant_id = hiera('r_profile::cloud::azure::tenant_id', undef),
Optional[String] $client_id = hiera('r_profile::cloud::azure::client_id', undef),
Optional[String] $client_secret = hiera('r_profile::cloud::azure::client_secret', undef),
Hash $azure_vm = hiera('r_profile::cloud::azure::azure_vm', {}),
Hash $azure_vm_default = hiera('r_profile::cloud::azure::azure_vm_default', {}),
String $azure_gem_version = hiera('r_profile::cloud::azure::azure_gem_version',"0.7.9"),
String $azure_mgmt_gem_version = hiera('r_profile::cloud::azure::azure_mgmt_gem_version', "0.3.1")
) {
include r_profile::nodejs
ensure_packages(
[
'gcc',
'libffi-devel',
'python-devel',
'openssl-devel',
'perl-Digest-SHA'
],
{
ensure => present
}
)
package { 'azure-cli':
ensure => 'present',
provider => 'npm',
}
# Azure module very picky about what rubygems to use so we pin exact versions.
# Using a gem that is too new will give ruby errors like this:
# Error: Could not run: Puppet detected a problem with the information
# returned from Azure when accessing azure_vm. The specific error was:
# undefined method `value' for #<Array:0x000000057af3c8>
package { "hocon":
ensure => "1.1.3",
provider => "puppet_gem",
}
package { "retries":
ensure => "0.0.5",
provider => "puppet_gem",
}
package { "azure":
ensure => $azure_gem_version,
provider => "puppet_gem",
}
package { [ "azure_mgmt_compute", "azure_mgmt_network", "azure_mgmt_resources", "azure_mgmt_storage"]:
ensure => $azure_mgmt_gem_version,
provider => "puppet_gem",
}
# If all required authentication fields are present, manage the azure.conf
# file and its content, otherwise leave it alone. This allows it to be
# populated by other methods if necessary
if $subscription_id and $tenant_id and $client_id and client_secret {
file { "/etc/puppetlabs/puppet/azure.conf":
ensure => file,
owner => 'root',
group => 'root',
mode => '0600',
content => epp("${module_name}/cloud/azure/azure.conf.epp", {
subscription_id => $subscription_id,
tenant_id => $tenant_id,
client_id => $client_id,
client_secret => $client_secret,
}),
}
}
$azure_vm.each |$title, $opts| {
azure_vm {
default:
* => $azure_vm_default,
;
$title:
* => $opts,
}
}
}
|