From 72f1fd427253cdc78ae897782f1a1e598dba8b46 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 2 Mar 2026 19:23:26 +0000 Subject: [PATCH] Configure git user directly using chef resources --- cookbooks/git/metadata.rb | 1 - cookbooks/git/recipes/server.rb | 17 ++++++++++++++--- roles/git.rb | 5 +++-- test/data_bags/accounts/git.json | 6 ------ 4 files changed, 17 insertions(+), 12 deletions(-) delete mode 100644 test/data_bags/accounts/git.json diff --git a/cookbooks/git/metadata.rb b/cookbooks/git/metadata.rb index 19f53944f..003590d11 100644 --- a/cookbooks/git/metadata.rb +++ b/cookbooks/git/metadata.rb @@ -6,6 +6,5 @@ description "Installs and configures git" version "1.0.0" supports "ubuntu" -depends "accounts" depends "apache" depends "networking" diff --git a/cookbooks/git/recipes/server.rb b/cookbooks/git/recipes/server.rb index bd586e9f2..cdd705ba6 100644 --- a/cookbooks/git/recipes/server.rb +++ b/cookbooks/git/recipes/server.rb @@ -17,14 +17,25 @@ # limitations under the License. # -node.default[:accounts][:users][:git][:status] = :role - -include_recipe "accounts" include_recipe "apt" include_recipe "networking" git_directory = node[:git][:directory] +group "git" do + gid 508 + append true +end + +user "git" do + uid 508 + gid 508 + comment "git.openstreetmap.org" + home git_directory + shell "/usr/sbin/nologin" + manage_home false +end + directory git_directory do owner "root" group "root" diff --git a/roles/git.rb b/roles/git.rb index 6dfbe6b24..5ff823f76 100644 --- a/roles/git.rb +++ b/roles/git.rb @@ -23,9 +23,10 @@ default_attributes( :yellowbkpk => { :status => :user, :shell => "/usr/bin/git-shell" - }, + } + }, + :groups => { :git => { - :status => :role, :members => [:tomh, :grant, :matt, :lonvia, :yellowbkpk, :stereo, :pnorman] } } diff --git a/test/data_bags/accounts/git.json b/test/data_bags/accounts/git.json deleted file mode 100644 index 1938a3fc8..000000000 --- a/test/data_bags/accounts/git.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "id": "git", - "uid": "508", - "comment": "git.openstreetmap.org", - "home": "/var/lib/git" -} -- 2.39.5