Skip to content

Instantly share code, notes, and snippets.

@mmalchuk
Forked from michalskalski/fuel_tasks.rb
Created April 11, 2016 06:14
Show Gist options
  • Save mmalchuk/36e97b434efb2d012c6495ee88d452b2 to your computer and use it in GitHub Desktop.
Save mmalchuk/36e97b434efb2d012c6495ee88d452b2 to your computer and use it in GitHub Desktop.
Print granual task for specific role
#!/usr/bin/env ruby
require 'yaml'
# fuel rel --rel X --deployment-tasks --download
tasks_file = ARGV[0]
role = ARGV[1]
tasks = YAML.load_file(tasks_file)
def info(task)
puts "#{task['id']}: #{task['parameters']['puppet_manifest']}"
end
tasks.each do |task|
if ['puppet'].include? task['type']
if task.has_key?('groups')
info task if task['groups'].include?(role)
end
if task.has_key?('role')
info task if task['role'].include?(role)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment