Created
August 27, 2014 19:57
-
-
Save rlister/1e8025c0f97b2482b4b2 to your computer and use it in GitHub Desktop.
force ohai ec2 plugin for aws instances
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## for an unknown reason, on a subset of instances the | |
## ohai ec2 data is not populated unless this file exists | |
## so touch it until we figure out why | |
[ '/etc/chef', '/etc/chef/ohai', '/etc/chef/ohai/hints' ].each do |dir| | |
directory(dir).run_action(:create) | |
end | |
## this plugin file just needs to exist to able the plugin | |
ec2_json = file '/etc/chef/ohai/hints/ec2.json' do | |
content '' | |
end | |
## create during compile phase | |
ec2_json.run_action(:create) | |
## reloads node attributes during run | |
reload_ec2 = ohai 'reload_ec2' do | |
plugin 'ec2' | |
action :nothing | |
end | |
## force the reload now if plugin updated | |
if ec2_json.updated? | |
reload_ec2.run_action(:reload) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment