bundles/sudo: add bundle

This commit is contained in:
Franzi 2020-03-27 11:52:17 +00:00
parent 9a956e832a
commit 067b498bf2
Signed by: kunsi
GPG key ID: 12E3D2136B818350
4 changed files with 33 additions and 3 deletions

View file

@ -0,0 +1,11 @@
Defaults timestamp_timeout=5
Defaults insults
Defaults passwd_timeout=10
Defaults env_reset
root ALL=(ALL) ALL
% for user in node.metadata['sudo']:
${user} ALL=(ALL) NOPASSWD:ALL
% endfor

9
bundles/sudo/items.py Normal file
View file

@ -0,0 +1,9 @@
groups = {
'sudo': {},
}
files = {
'/etc/sudoers': {
'content_type': 'mako',
},
}

11
bundles/sudo/metadata.py Normal file
View file

@ -0,0 +1,11 @@
@metadata_processor
def sudo_users(metadata):
sudoers = []
for username, config in metadata.get('users', {}).items():
if 'sudo' in config and config['sudo']:
sudoers.append(username)
metadata['sudo'] = sudoers
return metadata, RUN_ME_AGAIN