servers/services/gitea/tasks/setup.yml
2022-02-20 00:15:52 +01:00

53 lines
1.0 KiB
YAML

---
- name: 'Ensure repositories directory exists'
file:
path: "{{ repositories_path }}"
state: directory
owner: "{{ ansible_user }}"
tags:
- setup
- name: 'Create git user for ssh access'
user:
name: git
shell: /bin/bash
system: yes
password: '!'
state: present
generate_ssh_key: yes
register: git_user
tags:
- setup
- name: 'Add host key for gitea SSH passthrough'
ansible.posix.authorized_key:
user: "{{ git_user.name }}"
key: "{{ git_user.ssh_public_key }}"
state: present
manage_dir: False
tags:
- setup
- name: 'Ensure /app/gitea exists'
file:
path: "/app/gitea"
state: directory
tags:
- setup
- name: 'Copy gitea-ssh-forward script to remote'
copy:
src: "{{ service_path }}/bin/gitea-ssh-forward"
dest: "/app/gitea/gitea"
mode: +x
tags:
- setup
- name: 'Link /app/gitea/gitea to /usr/local/bin/gitea'
file:
src: "/app/gitea/gitea"
dest: "/usr/local/bin/gitea"
state: link
tags:
- setup