85 lines
1.9 KiB
YAML
85 lines
1.9 KiB
YAML
---
|
|
|
|
- name: Install dependencies
|
|
ansible.builtin.apt:
|
|
name:
|
|
- git
|
|
- xq
|
|
state: present
|
|
|
|
- name: Install nginx site
|
|
ansible.builtin.template:
|
|
src: nginx-site.conf
|
|
dest: /etc/nginx/sites-available/forgejo
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
notify: Reload nginx
|
|
|
|
- name: Enable nginx site
|
|
ansible.builtin.file:
|
|
src: /etc/nginx/sites-available/forgejo
|
|
dest: /etc/nginx/sites-enabled/forgejo
|
|
state: link
|
|
notify: Reload nginx
|
|
|
|
- name: Create user
|
|
ansible.builtin.user:
|
|
name: "{{ git_server_user }}"
|
|
home: "{{ git_server_working_dir }}"
|
|
shell: /bin/bash
|
|
comment: Git server
|
|
|
|
- name: Create logging dir
|
|
ansible.builtin.file:
|
|
state: directory
|
|
path: /var/log/forgejo
|
|
owner: "{{ git_server_user }}"
|
|
group: "{{ git_server_user }}"
|
|
mode: 0755
|
|
|
|
# TODO: Install initial config
|
|
|
|
- name: Install service file
|
|
ansible.builtin.template:
|
|
src: forgejo.service
|
|
dest: /etc/systemd/system/forgejo.service
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
notify: Reload forgejo
|
|
|
|
- name: Install update script
|
|
ansible.builtin.template:
|
|
src: update.sh
|
|
dest: "{{ git_server_working_dir }}/update.sh"
|
|
owner: "{{ git_server_user }}"
|
|
group: "{{ git_server_user }}"
|
|
mode: 0755
|
|
|
|
- name: Perform initial update
|
|
ansible.builtin.command: "{{ git_server_working_dir }}/update.sh"
|
|
args:
|
|
creates: "{{ git_server_working_dir }}/forgejo"
|
|
notify: Reload forgejo
|
|
|
|
- name: Enable service
|
|
ansible.builtin.systemd:
|
|
name: forgejo
|
|
enabled: true
|
|
daemon_reload: true
|
|
|
|
- name: Start service
|
|
ansible.builtin.systemd:
|
|
name: forgejo
|
|
state: started
|
|
daemon_reload: true
|
|
|
|
- name: Install cronjob
|
|
ansible.builtin.template:
|
|
src: cronjob
|
|
dest: /etc/cron.d/forgejo
|
|
|
|
- name: Debug
|
|
ansible.builtin.debug:
|
|
msg: "If Forgejo has not been setup yet, please do so manually."
|