Ok, I've created simple script for that.
- name: lesmyrmidons.mongodb
github: lesmyrmidons/ansible-role-mongodb
- name: Graylog2.graylog-ansible-role
github: Graylog2/graylog-ansible-role
#!/usr/bin/env ruby
require 'yaml'
require 'tmpdir'
root = Pathname.new(File.expand_path(__dir__))
roles_list = YAML.load(File.read('.roles-list.yml'))
def command(cmd)
p cmd
system cmd
end
roles_list.each do |role|
puts "\nProcessing #{role['name']}"
dir = Dir.mktmpdir('ansible')
command "cd #{dir}; curl -L #{url} | tar -xf -"
dest = root.join("roles", role['name'])
FileUtils.rm_rf(dest)
FileUtils.mkdir_p(dest)
src = dir
if Dir.new(dir).count == 3
name = Dir.new(dir).to_a.detect { |f| f[0] != '.' }
src = File.join(dir, name)
end
Dir.new(src).each do |f|
next if f == '.' || f == '..'
FileUtils.mv(File.join(src, f), dest)
end
FileUtils.rm_rf(dir)
end
puts "Done!"