Skip to content

Commit cd14ee0

Browse files
committed
facts/server: Respect nsswitch.conf for retrieving Groups
1 parent 9ce7ac4 commit cd14ee0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pyinfra/facts/server.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,11 @@ class Groups(FactBase[List[str]]):
363363
"""
364364

365365
def command(self):
366-
return "cat /etc/group"
366+
# getent will return the same output as `cat /etc/groups` but will
367+
# respect nsswitch.conf settings, e.g. for using LDAP as additional source
368+
# Note, that LDAP e.g. using sssd might be configured to not enumerate
369+
# all groups / users, in which case only the local groups will be returned
370+
return "getent group"
367371

368372
default = list
369373

0 commit comments

Comments
 (0)