Sha256: 641e6d66b02ee9201e49ec27333aa251ea4223df8498e2d81cf6414ff62238ab

Contents?: true

Size: 892 Bytes

Versions: 9

Compression:

Stored size: 892 Bytes

Contents

include_recipe "ruby-shadow"

if node[:users]

  node[:users].keys.each do |username|
    config = node[:users][username]

    group username do
    end
    user username do
      comment config[:comment]
      gid username

      # Added config for home in this site specific cookbook:
      if config[:home]
        if config[:home] != '/root'
          parent_dir = config[:home].split("/")[0..-2].join("/")
          FileUtils.mkdir_p(parent_dir) unless File.exists?(parent_dir)
        end

        home_path = config[:home]
        home home_path
      else
        home_path = "/home/#{username}"
        home home_path
      end
      
      Kernel.system "chmod 700 #{home_path}" if config[:hidden_home]
      
      shell "/bin/bash"
      password config[:password]
      supports :manage_home => true
      action [:create, :manage]
    end  
    
    add_keys username
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
solokit-0.1.17 cookbooks/site/users/recipes/default.rb
solokit-0.1.16 cookbooks/site/users/recipes/default.rb
solokit-0.1.15 cookbooks/site/users/recipes/default.rb
solokit-0.1.14 cookbooks/site/users/recipes/default.rb
solokit-0.1.13 cookbooks/site/users/recipes/default.rb
solokit-0.1.12 cookbooks/site/users/recipes/default.rb
solokit-0.1.11 cookbooks/site/users/recipes/default.rb
solokit-0.1.10 cookbooks/site/users/recipes/default.rb
solokit-0.1.9 cookbooks/site/users/recipes/default.rb