Commit 7428d7dfbe0ec7237e4f0c798c6dd69b327874f6

Authored by Jacob Vosmaer
1 parent d15a8456

Create the user for GitLab

files/gitlab-cookbooks/gitlab/attributes/default.rb
... ... @@ -17,6 +17,17 @@
17 17  
18 18 default['gitlab']['bootstrap']['enable'] = true
19 19  
  20 +####
  21 +# The Git User that services run as
  22 +####
  23 +# The username for the chef services user
  24 +default['gitlab']['user']['username'] = "git"
  25 +# The shell for the chef services user
  26 +default['gitlab']['user']['shell'] = "/bin/sh"
  27 +# The home directory for the chef services user
  28 +default['gitlab']['user']['home'] = "/var/opt/gitlab"
  29 +
  30 +
20 31 ###
21 32 # PostgreSQL
22 33 ###
... ...
files/gitlab-cookbooks/gitlab/recipes/default.rb
... ... @@ -44,6 +44,8 @@ directory "/var/opt/gitlab" do
44 44 action :create
45 45 end
46 46  
  47 +include_recipe "gitlab::users"
  48 +
47 49 # Install our runit instance
48 50 include_recipe "runit"
49 51  
... ...
files/gitlab-cookbooks/gitlab/recipes/users.rb
... ... @@ -15,13 +15,13 @@
15 15 # limitations under the License.
16 16 #
17 17  
18   -# Create a user for Chef services to run as
19   -user node['chef_server']['user']['username'] do
20   - system true
21   - shell node['chef_server']['user']['shell']
22   - home node['chef_server']['user']['home']
23   -end
  18 +gitlab_username = node['gitlab']['user']['username']
24 19  
25   -group node['chef_server']['user']['username'] do
26   - members [node['chef_server']['user']['username']]
  20 +group gitlab_username
  21 +
  22 +# Create a user for Chef services to run as
  23 +user gitlab_username do
  24 + shell node['gitlab']['user']['shell']
  25 + home node['gitlab']['user']['home']
  26 + gid gitlab_username
27 27 end
... ...