From 7428d7dfbe0ec7237e4f0c798c6dd69b327874f6 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 31 Jan 2014 18:16:49 +0100 Subject: [PATCH] Create the user for GitLab --- files/gitlab-cookbooks/gitlab/attributes/default.rb | 11 +++++++++++ files/gitlab-cookbooks/gitlab/recipes/default.rb | 2 ++ files/gitlab-cookbooks/gitlab/recipes/users.rb | 16 ++++++++-------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/files/gitlab-cookbooks/gitlab/attributes/default.rb b/files/gitlab-cookbooks/gitlab/attributes/default.rb index f4c7371..0de8d43 100644 --- a/files/gitlab-cookbooks/gitlab/attributes/default.rb +++ b/files/gitlab-cookbooks/gitlab/attributes/default.rb @@ -17,6 +17,17 @@ default['gitlab']['bootstrap']['enable'] = true +#### +# The Git User that services run as +#### +# The username for the chef services user +default['gitlab']['user']['username'] = "git" +# The shell for the chef services user +default['gitlab']['user']['shell'] = "/bin/sh" +# The home directory for the chef services user +default['gitlab']['user']['home'] = "/var/opt/gitlab" + + ### # PostgreSQL ### diff --git a/files/gitlab-cookbooks/gitlab/recipes/default.rb b/files/gitlab-cookbooks/gitlab/recipes/default.rb index 2009dd5..6a7ee19 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/default.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/default.rb @@ -44,6 +44,8 @@ directory "/var/opt/gitlab" do action :create end +include_recipe "gitlab::users" + # Install our runit instance include_recipe "runit" diff --git a/files/gitlab-cookbooks/gitlab/recipes/users.rb b/files/gitlab-cookbooks/gitlab/recipes/users.rb index b153539..60cf33e 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/users.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/users.rb @@ -15,13 +15,13 @@ # limitations under the License. # -# Create a user for Chef services to run as -user node['chef_server']['user']['username'] do - system true - shell node['chef_server']['user']['shell'] - home node['chef_server']['user']['home'] -end +gitlab_username = node['gitlab']['user']['username'] -group node['chef_server']['user']['username'] do - members [node['chef_server']['user']['username']] +group gitlab_username + +# Create a user for Chef services to run as +user gitlab_username do + shell node['gitlab']['user']['shell'] + home node['gitlab']['user']['home'] + gid gitlab_username end -- libgit2 0.21.2