users = { 'git': {}, } directories = { '/home/git': { 'mode': '0755', 'owner': 'git', 'group': 'git', }, '/home/git/.ssh': { 'mode': '0755', 'owner': 'git', 'group': 'git', }, '/var/lib/gitea': { 'owner': 'git', 'mode': '0700', 'triggers': { 'svc_systemd:gitea:restart', }, }, } files = { '/etc/systemd/system/gitea.service': { 'content_type': 'mako', 'context': node.metadata['gitea'], 'triggers': { 'action:systemd-reload', 'svc_systemd:gitea:restart', }, }, '/etc/gitea/app.ini': { 'content_type': 'mako', 'context': node.metadata['gitea'], 'triggers': { 'svc_systemd:gitea:restart', }, }, '/usr/local/bin/gitea': { 'content_type': 'download', 'source': 'https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-amd64'.format(version=node.metadata['gitea']['version']), 'content_hash': node.metadata['gitea']['sha1'], 'mode': '0755', 'triggers': { 'svc_systemd:gitea:restart', }, 'preceded_by': { 'svc_systemd:gitea:stop', }, }, } if node.metadata['gitea'].get('install_ssh_key', False): files['/home/git/.ssh/id_ed25519'] = { 'content': repo.vault.decrypt_file(f'gitea/files/ssh-keys/{node.name}.key.vault'), 'mode': '0600', 'owner': 'git', 'group': 'git', } svc_systemd = { 'gitea': { 'needs': { 'file:/etc/gitea/app.ini', 'file:/etc/systemd/system/gitea.service', 'file:/usr/local/bin/gitea', }, }, }