Commit 374d4c53 by John Jarvis

using ami-id-hostname, creating copy

parent 48a00b13
......@@ -24,7 +24,7 @@
- name: create agent configuration
template: >
src=opt/newrelic_platform_plugins/newrelic_logwatcher_agent/config/newrelic_plugin.yml.j2
dest={{ newrelic_logwatch_dir }}/config/newrelic_plugin.yml
dest={{ newrelic_logwatch_dir }}/config/newrelic_plugin.yml.copy
notify: restart newrelic-logwatch-agent
- template:
......
......@@ -4,8 +4,8 @@ stop on runlevel [016]
respawn
chdir {{ newrelic_logwatch_dir }}
pre-start script
instance_id=$(ec2metadata --instance-id)
ami_id=$(ec2metadata --ami-id)
sed -i "s/HOSTNAME/${ami_id}-${instance_id}/" {{ newrelic_logwatch_dir }}/config/newrelic_plugin.yml
hostname=$(hostname)
sed "s/HOSTNAME/${ami_id}-${hostname}/" {{ newrelic_logwatch_dir }}/config/newrelic_plugin.yml.copy > {{ newrelic_logwatch_dir }}/config/newrelic_plugin.yml
end script
exec ruby newrelic_logwatcher_agent.rb
Markdown is supported
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