I\'m newbie in Chef and I want to execute a script to add users in my system. I have a cookbook in chef called usersinto and attributes:
node.default[\"use
It seems your script accepts one argument. What I can't tell if that argument is a single user in or a single string of users. If it only accepts one user, you'd need to make your node["usersinto"]["users"]
attribute an array (this looks like it should be an array in any case).
node.default["usersinto"]["users"] = %w{user1 user2 user3}
Once you have your array, iterate over it executing the bash script for each user.
node["usersinto"]["users"].each do |user|
bash "launch-add" do
code <<-EOH
sh /home/user/addusers.sh #{user}
EOH
end
end
In the case that your script accepts multiple arguments (each argument being a different user)
bash "launch-add" do
code <<-EOH
sh /home/user/addusers.sh #{node['usersinto']['users'].join(' ')}
EOH
end