bundles/users: rework
This commit is contained in:
parent
568c6b55c9
commit
007a617785
7 changed files with 23 additions and 36 deletions
|
@ -36,7 +36,7 @@ for username, attrs in node.metadata['users'].items():
|
|||
user = users.setdefault(username, {})
|
||||
|
||||
user['home'] = home
|
||||
user['shell'] = attrs.get('shell', '/bin/bash')
|
||||
user['shell'] = '/bin/bash'
|
||||
user['password_hash'] = 'x'
|
||||
|
||||
if 'groups' in attrs:
|
||||
|
@ -54,37 +54,29 @@ for username, attrs in node.metadata['users'].items():
|
|||
'mode': '0600',
|
||||
}
|
||||
|
||||
elif attrs.get('deploy_configs', True):
|
||||
elif not attrs.get('do_not_remove_authorized_keys_from_home', False):
|
||||
files[home + '/.ssh/authorized_keys'] = {'delete': True}
|
||||
|
||||
if attrs.get('deploy_configs', True):
|
||||
if exists(join(repo.path, 'data', 'users', 'files', 'tmux', '{}.conf'.format(username))):
|
||||
files[home + '/.tmux.conf'] = {
|
||||
'content_type': 'mako',
|
||||
'source': 'tmux/{}.conf'.format(username),
|
||||
}
|
||||
else:
|
||||
files[home + '/.tmux.conf'] = {
|
||||
'delete': True,
|
||||
}
|
||||
|
||||
if exists(join(repo.path, 'data', 'users', 'files', 'fish', '{}.conf'.format(username))):
|
||||
fish_src = 'fish/{}.conf'.format(username)
|
||||
else:
|
||||
fish_src = 'fish.conf'
|
||||
|
||||
files[home + '/.config/fish/config.fish'] = {
|
||||
if exists(join(repo.path, 'data', 'users', 'files', 'tmux', '{}.conf'.format(username))):
|
||||
files[home + '/.tmux.conf'] = {
|
||||
'content_type': 'mako',
|
||||
'source': fish_src
|
||||
'source': 'tmux/{}.conf'.format(username),
|
||||
}
|
||||
else:
|
||||
files[home + '/.tmux.conf'] = {
|
||||
'delete': True,
|
||||
}
|
||||
files[home + '/.config/fish/fish_variables'] = {}
|
||||
|
||||
if exists(join(repo.path, 'data', 'users', 'files', 'bash', '{}.bashrc'.format(username))):
|
||||
files[home + '/.bashrc'] = {
|
||||
'content_type': 'mako',
|
||||
'source': 'bash/{}.bashrc'.format(username),
|
||||
}
|
||||
else:
|
||||
files[home + '/.bashrc'] = {
|
||||
'delete': True,
|
||||
}
|
||||
files[home + '/.config/fish'] = {
|
||||
'delete': True
|
||||
}
|
||||
|
||||
if exists(join(repo.path, 'data', 'users', 'files', 'bash', '{}.bashrc'.format(username))):
|
||||
files[home + '/.bashrc'] = {
|
||||
'content_type': 'mako',
|
||||
'source': 'bash/{}.bashrc'.format(username),
|
||||
}
|
||||
else:
|
||||
files[home + '/.bashrc'] = {
|
||||
'delete': True,
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
defaults = {
|
||||
'apt': {
|
||||
'packages': {
|
||||
'fish': {},
|
||||
'tmux': {},
|
||||
'vim': {},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue