bundles/users: rework
This commit is contained in:
parent
568c6b55c9
commit
007a617785
7 changed files with 23 additions and 36 deletions
|
@ -1,7 +1,7 @@
|
||||||
defaults = {
|
defaults = {
|
||||||
'users': {
|
'users': {
|
||||||
'git': {
|
'git': {
|
||||||
'deploy_configs': False,
|
'do_not_remove_authorized_keys_from_home': True,
|
||||||
'home-mode': '0755',
|
'home-mode': '0755',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,7 +2,6 @@ defaults = {
|
||||||
'users': {
|
'users': {
|
||||||
'mx-puppet-discord': {
|
'mx-puppet-discord': {
|
||||||
'home': '/opt/mx-puppet-discord',
|
'home': '/opt/mx-puppet-discord',
|
||||||
'deploy_configs': False,
|
|
||||||
'home-mode': '0755',
|
'home-mode': '0755',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,7 +10,6 @@ defaults = {
|
||||||
'users': {
|
'users': {
|
||||||
'seafile': {
|
'seafile': {
|
||||||
'home': '/opt/seafile',
|
'home': '/opt/seafile',
|
||||||
'deploy_configs': False,
|
|
||||||
'home-mode': '0755',
|
'home-mode': '0755',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,7 +2,6 @@ defaults = {
|
||||||
'users': {
|
'users': {
|
||||||
'travelynx': {
|
'travelynx': {
|
||||||
'home': '/opt/travelynx',
|
'home': '/opt/travelynx',
|
||||||
'deploy_configs': False,
|
|
||||||
'home-mode': '0755',
|
'home-mode': '0755',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -36,7 +36,7 @@ for username, attrs in node.metadata['users'].items():
|
||||||
user = users.setdefault(username, {})
|
user = users.setdefault(username, {})
|
||||||
|
|
||||||
user['home'] = home
|
user['home'] = home
|
||||||
user['shell'] = attrs.get('shell', '/bin/bash')
|
user['shell'] = '/bin/bash'
|
||||||
user['password_hash'] = 'x'
|
user['password_hash'] = 'x'
|
||||||
|
|
||||||
if 'groups' in attrs:
|
if 'groups' in attrs:
|
||||||
|
@ -54,37 +54,29 @@ for username, attrs in node.metadata['users'].items():
|
||||||
'mode': '0600',
|
'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}
|
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))):
|
||||||
if exists(join(repo.path, 'data', 'users', 'files', 'tmux', '{}.conf'.format(username))):
|
files[home + '/.tmux.conf'] = {
|
||||||
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'] = {
|
|
||||||
'content_type': 'mako',
|
'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 + '/.config/fish'] = {
|
||||||
files[home + '/.bashrc'] = {
|
'delete': True
|
||||||
'content_type': 'mako',
|
}
|
||||||
'source': 'bash/{}.bashrc'.format(username),
|
|
||||||
}
|
if exists(join(repo.path, 'data', 'users', 'files', 'bash', '{}.bashrc'.format(username))):
|
||||||
else:
|
files[home + '/.bashrc'] = {
|
||||||
files[home + '/.bashrc'] = {
|
'content_type': 'mako',
|
||||||
'delete': True,
|
'source': 'bash/{}.bashrc'.format(username),
|
||||||
}
|
}
|
||||||
|
else:
|
||||||
|
files[home + '/.bashrc'] = {
|
||||||
|
'delete': True,
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
defaults = {
|
defaults = {
|
||||||
'apt': {
|
'apt': {
|
||||||
'packages': {
|
'packages': {
|
||||||
'fish': {},
|
|
||||||
'tmux': {},
|
'tmux': {},
|
||||||
'vim': {},
|
'vim': {},
|
||||||
},
|
},
|
||||||
|
|
|
@ -21,7 +21,6 @@ groups['all'] = {
|
||||||
'ssh_pubkey': [
|
'ssh_pubkey': [
|
||||||
'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC+ja1z5VRQzaKCCePsUM14qMr9QR94qlWc7Je5Poki9UmC1t/TyxRVzcCBL1ZdIfBGx6QKtfkEbvhgb3nxVt3PvXjoJrc6wwGLmNrVsU6B88y35g7nzupQiPKYJwkNzJ9j6Dmkgj1F5Q+aY2SitDaX6vqICLJ4Al/ZFw2IQxVJfC7JXRJ9jRMG5o9gWoE3gWDYEAmw+HU2mNzyeuaD12qJw9DHUimAlgkOWzll3gh9WclsYnnXGrCCn5fyHFUCJl+XXAIy519z7YTpKih02rsIOw5dnaGClBZD/YQu2ZKVFZiwIVH7aBiqHOmtgRyWTQgjbh/fMpIN0ar2f/iZsWYUjd6et48TOmXZYIPCQ5FivXNvxt9oo1XZfq76UHBwlmypLJIWROMbz375n2M6hr3hECuxuPjKEUXAv05KiC1aJ4xc6pFoVhqwAR99hvHw5U4o7/ko2NVjNpTu6Jr5DT5VaQLIdDDjC/93kUjMpdD/8P72bEn7454+WexU6OE6uvNiHj1fetrptr2UAuzVfnCoaV8pBqY7X95gk+lnSENdpr8ltJYMg8s0Z7Pzz0OxsZtzzDY5VmWfC9TCdJkN5lT8IbnaixsYlWdjQl1lMmZGElmelfU3K7YQLAbZiHmHKe4hTl9ZoCcWdTQ3d4y2t1DBos+N2HZNdtFCyOS8esDdMw== cardno:000609506971',
|
'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,
|
'sudo': True,
|
||||||
},
|
},
|
||||||
'sophie': {
|
'sophie': {
|
||||||
|
|
Loading…
Reference in a new issue