Hey Guys,
Below my recipe that helped me with my question.
The solution is combine with ruby and chef resource.
Please tell me what do you think if i need to change something.
stdout, stdeerr, status = Open3.capture3(get_repo_files)
array = stdout.split("\n")
array.each do | repo|
execute 'cp pattern file' do
command "cp /etc/yum.repos.d/#{repo} /tmp/backup/centos7/#{node['hostname']}/yum.repos.d/"
action :run
end
end