Download gitea binary

This commit is contained in:
flyingscorpio@clevo 2022-04-07 23:18:20 +02:00
parent 1b39e5de29
commit c91cd93b6b
3 changed files with 76 additions and 0 deletions

View file

@ -24,6 +24,13 @@
state: started
enabled: true
- name: Start gitea service
become: true
systemd:
name: gitea
state: started
enabled: true
- name: Start nftables service
become: true
systemd:

View file

@ -0,0 +1,23 @@
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
Requires=mariadb.service
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
[Install]
WantedBy=multi-user.target

View file

@ -69,3 +69,49 @@
owner: root
group: git
mode: 0640
- name: Find latest gitea version
uri:
url: https://dl.gitea.io/gitea/version.json
register: gitea_binary
- name: Set gitea binary architecture to amd64
set_fact:
gitea_binary_arch: amd64
when: ansible_facts['architecture'] == 'x86_64'
- name: Set gitea binary architecture to arm-6
set_fact:
gitea_binary_arch: amd64
when: ansible_facts['architecture'] != 'x86_64'
- name: Get latest gitea binary
become: true
get_url:
url: "https://dl.gitea.io/gitea/{{ gitea_binary.json.latest.version }}/gitea-{{ gitea_binary.json.latest.version }}-linux-{{ gitea_binary_arch }}"
dest: "/home/git/gitea-{{ gitea_binary.json.latest.version }}"
owner: git
group: git
mode: 0664
- name: Copy gitea binary to global location
become: true
copy:
src: "/home/git/gitea-{{ gitea_binary.json.latest.version }}"
dest: /usr/local/bin/gitea
remote_src: true
owner: root
group: root
mode: 0755
- name: Copy /etc/gitea/app.ini
become: true
copy:
src: gitea.service
dest: /etc/systemd/system/gitea.service
owner: root
group: root
mode: 0644
notify:
- Reload systemd daemon
- Start gitea service