first stab

master
Yanick Champoux 2019-10-09 19:28:34 -04:00
parent c3f594584a
commit fa615c5c92
4 changed files with 117 additions and 0 deletions

10
files/apache.config Normal file
View File

@ -0,0 +1,10 @@
<VirtualHost *:80>
ServerName git.babyl.ca
ServerAlias git.babyl.ca
ProxyPass / http://localhost:8085/
ProxyPassReverse / http://localhost:8085/
CustomLog ${APACHE_LOG_DIR}/git.log combined
</VirtualHost>

36
files/gitea.service Normal file
View File

@ -0,0 +1,36 @@
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
#Requires=mysql.service
#Requires=mariadb.service
#Requires=postgresql.service
#Requires=memcached.service
#Requires=redis.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=gitea
Group=gitea
WorkingDirectory=/home/gitea/
# If using unix socket: Tells Systemd to create /run/gitea folder to home gitea.sock
# Manual cration would vanish after reboot.
#RuntimeDirectory=gitea
ExecStart=/home/gitea/bin/gitea web -c /home/gitea/custom/conf/app.ini
Restart=always
Environment=USER=gitea HOME=/home/gitea GITEA_WORK_DIR=/home/gitea
# If you want to bind Gitea to a port below 1024 uncomment
# the two values below
###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target

3
handlers/main.yml Normal file
View File

@ -0,0 +1,3 @@
- name: restart apache
service: name=apache2 state=restarted
become: yes

68
tasks/main.yml Normal file
View File

@ -0,0 +1,68 @@
- name: add gitea user
become: yes
user:
name: gitea
- name: create sub-directories
become: yes
file:
path: /home/gitea/{{item}}
state: directory
owner: gitea
loop:
- log
- data
- custom
- bin
- name: d/l gitea
become: yes
get_url:
mode: a+x
dest: /home/gitea/bin/gitea
url: https://dl.gitea.io/gitea/1.9.4/gitea-1.9.4-linux-386
- name: workdir in bash
become: yes
become_user: gitea
lineinfile:
path: /home/gitea/.bashrc
regexp: GITEA_WORK_DIR
line: export GITEA_WORK_DIR=/home/gitea
backup: yes
- name: install service
become: yes
copy:
dest: /etc/systemd/system/gitea.service
src: files/gitea.service
force: no
backup: yes
- name: enable service
become: yes
systemd:
state: started
name: gitea.service
enabled: yes
- name: apache config
become: yes
template:
dest: /etc/apache2/sites-available/gitea
src: files/apache.config
force: no
backup: yes
- name: enable apache config
become: yes
notify: restart apache
file:
path: /etc/apache2/sites-enabled/gitea
force: no
src: /etc/apache2/sites-available/gitea
state: link
# running from the command line:
# GITEA_WORK_DIR=/var/lib/gitea/ /usr/local/bin/gitea web -c /etc/gitea/app.ini