This commit is contained in:
Franzi 2020-12-27 18:15:14 +01:00
parent a8d97649c9
commit 1fc1867362
Signed by: kunsi
GPG key ID: 12E3D2136B818350
5 changed files with 63 additions and 0 deletions

19
bundles/users/items.py Normal file
View file

@ -0,0 +1,19 @@
users = {
'root': {
'password': repo.vault.password_for(f'{node.name} root password'),
},
}
for user, config in node.metadata['users'].items():
directories[f'/home/{user}'] = {
'owner': user,
'mode': '0700',
}
users[user] = {
'password': config['password'],
'groups': {
'sudo',
},
'shell': '/bin/bash',
}

12
bundles/users/metadata.py Normal file
View file

@ -0,0 +1,12 @@
@metadata_reactor
def generate_password_for_every_user(metadata):
users = {}
for user in metadata.get('users', {}).keys():
users[user] = {
'password': repo.vault.human_password_for(f'{node.name} user {user}'),
}
return {
'users': users,
}

18
groups.py Normal file
View file

@ -0,0 +1,18 @@
groups = {
#'group-1': {
# 'bundles': (
# 'bundle-1',
# ),
# 'members': (
# 'node-1',
# ),
# 'subgroups': (
# 'group-2',
# ),
#},
'all': {
'member_patterns': (
r".*",
),
},
}

13
nodes.py Normal file
View file

@ -0,0 +1,13 @@
nodes = {
'node-1': {
'hostname': "172.19.138.9",
'bundles': {
'users',
},
'metadata': {
'users': {
'kunsi': {},
},
},
},
}

1
requirements.txt Normal file
View file

@ -0,0 +1 @@
bundlewrap>=4.2.2