Created
November 17, 2009 22:38
-
-
Save adamhjk/237344 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cookbook/ftp_stuff/definitions/ftp_user.rb | |
define :ftp_user, :password => nil do | |
begin | |
r = resources(:template => "/etc/ftp_passwd") | |
rescue | |
r = template "/etc/ftp_passwd" do | |
owner "root" | |
group "root" | |
mode "0600" | |
cookbook "ftppasswd.erb" | |
variables({}) | |
end | |
end | |
r.variables[:users][params[:name]] = params[:password] | |
end | |
# cookbooks/bobo/recipes/default.rb | |
ftp_user "bobo" do | |
password "monkey" | |
end | |
ftp_user "tclown" do | |
password "clones" | |
end | |
# cookbooks/ftp_user/templates/default/ftppasswd.erb | |
# Will print every ftp_user | |
<%- @users.each do |u, p| %> | |
<%= u %>:%<= p %> | |
<%- end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment