Commit 81860e71 by John Jarvis

Merge pull request #1571 from edx/jarv/use-ami-and-inst

use ami id and using copy for config template
parents ce25386f 374d4c53
......@@ -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,6 +4,8 @@ stop on runlevel [016]
respawn
chdir {{ newrelic_logwatch_dir }}
pre-start script
sed -i "s/HOSTNAME/$(hostname)/" {{ newrelic_logwatch_dir }}/config/newrelic_plugin.yml
ami_id=$(ec2metadata --ami-id)
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