bundles/users: rework

This commit is contained in:
Franzi 2020-08-29 19:21:35 +02:00
parent 568c6b55c9
commit 007a617785
Signed by: kunsi
GPG key ID: 12E3D2136B818350
7 changed files with 23 additions and 36 deletions

View file

@ -1,7 +1,7 @@
defaults = {
'users': {
'git': {
'deploy_configs': False,
'do_not_remove_authorized_keys_from_home': True,
'home-mode': '0755',
},
},

View file

@ -2,7 +2,6 @@ defaults = {
'users': {
'mx-puppet-discord': {
'home': '/opt/mx-puppet-discord',
'deploy_configs': False,
'home-mode': '0755',
},
},

View file

@ -10,7 +10,6 @@ defaults = {
'users': {
'seafile': {
'home': '/opt/seafile',
'deploy_configs': False,
'home-mode': '0755',
},
},

View file

@ -2,7 +2,6 @@ defaults = {
'users': {
'travelynx': {
'home': '/opt/travelynx',
'deploy_configs': False,
'home-mode': '0755',
},
},

View file

@ -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,
}

View file

@ -1,7 +1,6 @@
defaults = {
'apt': {
'packages': {
'fish': {},
'tmux': {},
'vim': {},
},

View file

@ -21,7 +21,6 @@ groups['all'] = {
'ssh_pubkey': [
'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC+ja1z5VRQzaKCCePsUM14qMr9QR94qlWc7Je5Poki9UmC1t/TyxRVzcCBL1ZdIfBGx6QKtfkEbvhgb3nxVt3PvXjoJrc6wwGLmNrVsU6B88y35g7nzupQiPKYJwkNzJ9j6Dmkgj1F5Q+aY2SitDaX6vqICLJ4Al/ZFw2IQxVJfC7JXRJ9jRMG5o9gWoE3gWDYEAmw+HU2mNzyeuaD12qJw9DHUimAlgkOWzll3gh9WclsYnnXGrCCn5fyHFUCJl+XXAIy519z7YTpKih02rsIOw5dnaGClBZD/YQu2ZKVFZiwIVH7aBiqHOmtgRyWTQgjbh/fMpIN0ar2f/iZsWYUjd6et48TOmXZYIPCQ5FivXNvxt9oo1XZfq76UHBwlmypLJIWROMbz375n2M6hr3hECuxuPjKEUXAv05KiC1aJ4xc6pFoVhqwAR99hvHw5U4o7/ko2NVjNpTu6Jr5DT5VaQLIdDDjC/93kUjMpdD/8P72bEn7454+WexU6OE6uvNiHj1fetrptr2UAuzVfnCoaV8pBqY7X95gk+lnSENdpr8ltJYMg8s0Z7Pzz0OxsZtzzDY5VmWfC9TCdJkN5lT8IbnaixsYlWdjQl1lMmZGElmelfU3K7YQLAbZiHmHKe4hTl9ZoCcWdTQ3d4y2t1DBos+N2HZNdtFCyOS8esDdMw== cardno:000609506971',
],
'shell': '/usr/bin/fish',
'sudo': True,
},
'sophie': {