Add a role to all EC2 servers on a Chef Server

knife exec -E 'nodes.find("ec2:*") { |n|
  n.run_list << "role[awsrole]" unless
  n.run_list.include?("role[awsrole]"); n.save }'
Written on March 9, 2016 by ianpenney