Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gitlab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
infra
ansible
roles
gitlab
Commits
45660c7b
Commit
45660c7b
authored
Jul 1, 2024
by
nd
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://git.cccv.de/infra/ansible/roles/gitlab
parents
12f7e936
a07dcd65
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
files/gitlab-ldap-sync.py
+5
-5
5 additions, 5 deletions
files/gitlab-ldap-sync.py
templates/gitlab.rb.j2
+0
-62
0 additions, 62 deletions
templates/gitlab.rb.j2
with
5 additions
and
67 deletions
files/gitlab-ldap-sync.py
+
5
−
5
View file @
45660c7b
...
@@ -106,7 +106,7 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run=
...
@@ -106,7 +106,7 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run=
existing_member_dns
=
[]
existing_member_dns
=
[]
logging
.
debug
(
'
Checking current Gitlab group members
'
)
logging
.
debug
(
'
Checking current Gitlab group members
'
)
members
=
group
.
members
.
list
(
all
=
True
)
members
=
group
.
members
.
list
(
all
=
True
)
owner_count
=
len
([
member
for
member
in
members
if
member
.
access_level
==
gitlab
.
OWNER_ACCESS
])
owner_count
=
len
([
member
for
member
in
members
if
member
.
access_level
==
gitlab
.
const
.
OWNER_ACCESS
])
logging
.
debug
(
'
Group has %d owners
'
,
owner_count
)
logging
.
debug
(
'
Group has %d owners
'
,
owner_count
)
for
member
in
members
:
for
member
in
members
:
user
=
gl
.
users
.
get
(
member
.
id
)
user
=
gl
.
users
.
get
(
member
.
id
)
...
@@ -120,9 +120,9 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run=
...
@@ -120,9 +120,9 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run=
logging
.
info
(
'
Removing user %s from group %s
'
,
dn
,
group
.
full_path
)
logging
.
info
(
'
Removing user %s from group %s
'
,
dn
,
group
.
full_path
)
if
not
dry_run
:
if
not
dry_run
:
member
.
delete
()
member
.
delete
()
elif
member
.
access_level
!=
gitlab
.
MAST
ER_ACCESS
:
elif
member
.
access_level
!=
gitlab
.
const
.
MAINTAIN
ER_ACCESS
:
# We cannot change the access level of the last owner of a top-level group
# We cannot change the access level of the last owner of a top-level group
if
member
.
access_level
==
gitlab
.
OWNER_ACCESS
:
if
member
.
access_level
==
gitlab
.
const
.
OWNER_ACCESS
:
if
owner_count
==
1
and
not
group
.
parent_id
:
if
owner_count
==
1
and
not
group
.
parent_id
:
logging
.
info
(
'
Not updating access level of %s in group %s, because it is the last owner
'
,
dn
,
group
.
full_path
)
logging
.
info
(
'
Not updating access level of %s in group %s, because it is the last owner
'
,
dn
,
group
.
full_path
)
continue
continue
...
@@ -130,7 +130,7 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run=
...
@@ -130,7 +130,7 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run=
logging
.
info
(
'
Updating access level of %s in group %s
'
,
dn
,
group
.
full_path
)
logging
.
info
(
'
Updating access level of %s in group %s
'
,
dn
,
group
.
full_path
)
try
:
try
:
if
not
dry_run
:
if
not
dry_run
:
member
.
access_level
=
gitlab
.
MAST
ER_ACCESS
member
.
access_level
=
gitlab
.
const
.
MAINTAIN
ER_ACCESS
member
.
save
()
member
.
save
()
except
gitlab
.
exceptions
.
GitlabUpdateError
as
e
:
except
gitlab
.
exceptions
.
GitlabUpdateError
as
e
:
logging
.
exception
(
'
Access level update of %s in group %s failed
'
,
dn
,
group
.
full_path
)
logging
.
exception
(
'
Access level update of %s in group %s failed
'
,
dn
,
group
.
full_path
)
...
@@ -144,7 +144,7 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run=
...
@@ -144,7 +144,7 @@ def sync_group_members(gl, group, member_dns, ldap_provider='ldapmain', dry_run=
continue
continue
try
:
try
:
if
not
dry_run
:
if
not
dry_run
:
group
.
members
.
create
({
'
user_id
'
:
user
.
id
,
'
access_level
'
:
gitlab
.
MAST
ER_ACCESS
})
group
.
members
.
create
({
'
user_id
'
:
user
.
id
,
'
access_level
'
:
gitlab
.
const
.
MAINTAIN
ER_ACCESS
})
except
gitlab
.
exceptions
.
GitlabCreateError
as
e
:
except
gitlab
.
exceptions
.
GitlabCreateError
as
e
:
if
e
.
response_code
==
500
:
if
e
.
response_code
==
500
:
logging
.
info
(
'
Adding user %s to group %s failed with Internal Server Error
'
,
dn
,
group
.
full_path
)
logging
.
info
(
'
Adding user %s to group %s failed with Internal Server Error
'
,
dn
,
group
.
full_path
)
...
...
This diff is collapsed.
Click to expand it.
templates/gitlab.rb.j2
+
0
−
62
View file @
45660c7b
...
@@ -1783,68 +1783,6 @@ registry_nginx['enable'] = false
...
@@ -1783,68 +1783,6 @@ registry_nginx['enable'] = false
# To completely disable prometheus, and all of it's exporters, set to false
# To completely disable prometheus, and all of it's exporters, set to false
# prometheus_monitoring['enable'] = true
# prometheus_monitoring['enable'] = true
################################################################################
## Grafana Dashboards
##! Docs: https://docs.gitlab.com/ee/administration/monitoring/prometheus/#prometheus-as-a-grafana-data-source
################################################################################
grafana['enable'] = false
# grafana['log_directory'] = '/var/log/gitlab/grafana'
# grafana['home'] = '/var/opt/gitlab/grafana'
# grafana['admin_password'] = 'admin'
# grafana['allow_user_sign_up'] = false
# grafana['basic_auth_enabled'] = false
# grafana['disable_login_form'] = true
# grafana['gitlab_application_id'] = 'GITLAB_APPLICATION_ID'
# grafana['gitlab_secret'] = 'GITLAB_SECRET'
# grafana['env_directory'] = '/opt/gitlab/etc/grafana/env'
# grafana['allowed_groups'] = []
# grafana['gitlab_auth_sign_up'] = true
# grafana['env'] = {
# 'SSL_CERT_DIR' => "#{node['package']['install-dir']}/embedded/ssl/certs/"
# }
# grafana['metrics_enabled'] = false
# grafana['metrics_basic_auth_username'] = 'grafana_metrics' # default: nil
# grafana['metrics_basic_auth_password'] = 'please_set_a_unique_password' # default: nil
### Dashboards
#
# See: http://docs.grafana.org/administration/provisioning/#dashboards
#
# NOTE: Setting this will override the default.
#
# grafana['dashboards'] = [
# {
# 'name' => 'GitLab Omnibus',
# 'orgId' => 1,
# 'folder' => 'GitLab Omnibus',
# 'type' => 'file',
# 'disableDeletion' => true,
# 'updateIntervalSeconds' => 600,
# 'options' => {
# 'path' => '/opt/gitlab/embedded/service/grafana-dashboards',
# }
# }
# ]
### Datasources
#
# See: http://docs.grafana.org/administration/provisioning/#example-datasource-config-file
#
# NOTE: Setting this will override the default.
#
# grafana['datasources'] = [
# {
# 'name' => 'GitLab Omnibus',
# 'type' => 'prometheus',
# 'access' => 'proxy',
# 'url' => 'http://localhost:9090'
# }
# ]
##! Advanced settings. Should be changed only if absolutely needed.
# grafana['http_addr'] = 'localhost'
# grafana['http_port'] = 3000
################################################################################
################################################################################
## Gitaly
## Gitaly
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment