Commit eca383d4 authored by Alex Tayts's avatar Alex Tayts
Browse files

account for on-prem deployments

parent 4b1e3dce
......@@ -29,6 +29,12 @@ class cloudwatch (
$resource_ensure = 'present'
}
# determine if this server is an EC2 instance
$hosted = ('ec2_metadata' in $facts) ? {
true => 'ec2',
default => 'onPremise'
}
# install package
package { 'amazon-cloudwatch-agent': ensure => $pkg_ensure }
......@@ -44,7 +50,7 @@ class cloudwatch (
# create a toml configuration file from the default json config generated by the module
exec { 'fetch-config':
command => "${agent_dir}/bin/amazon-cloudwatch-agent-ctl -s -a fetch-config -c file:${config_file}",
command => "${agent_dir}/bin/amazon-cloudwatch-agent-ctl -s -a fetch-config -m ${hosted} -c file:${config_file}",
onlyif => [ "/usr/bin/test -f ${config_file}" ],
refreshonly => true,
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment