demo
This commit is contained in:
parent
a8d97649c9
commit
1fc1867362
5 changed files with 63 additions and 0 deletions
19
bundles/users/items.py
Normal file
19
bundles/users/items.py
Normal 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
12
bundles/users/metadata.py
Normal 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
18
groups.py
Normal 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
13
nodes.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
nodes = {
|
||||
'node-1': {
|
||||
'hostname': "172.19.138.9",
|
||||
'bundles': {
|
||||
'users',
|
||||
},
|
||||
'metadata': {
|
||||
'users': {
|
||||
'kunsi': {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
bundlewrap>=4.2.2
|
Loading…
Reference in a new issue