ansible/roles/install_gitea/tasks/main.yml

75 lines
1.7 KiB
YAML
Raw Permalink Normal View History

2021-01-25 00:30:10 +01:00
---
- name: Ensure the directory exist
file:
path: /var/local/gitea
state: directory
- name: Ensure the user gitea exists
2021-01-27 00:26:01 +01:00
user:
name: gitea
create_home: no
password_lock: yes
- name: Retrieve info about users
getent:
database: passwd
2021-01-25 00:30:10 +01:00
- name: Warning
debug:
msg: This is a test server, do not use in production
- name: Copy docker-compose.yml
template:
src: docker-compose.yml.j2
dest: /var/local/gitea/docker-compose.yml
mode: 0644
owner: root
group: staff
- name: Start the container
docker_compose:
project_src: /var/local/gitea
2021-01-26 21:24:21 +01:00
- name: Copy key
copy:
src: /var/certificates/{{ server_hostname }}_privkey.pem
2021-01-27 00:26:01 +01:00
dest: /var/local/gitea/gitea/key.pem
owner: gitea
group: gitea
mode: 0600
2021-01-26 21:24:21 +01:00
remote_src: yes
2021-01-27 00:26:01 +01:00
notify: restart gitea
2021-01-26 21:24:21 +01:00
- name: Copy certificate
copy:
src: /var/certificates/{{ server_hostname }}_cert.pem
2021-01-27 00:26:01 +01:00
dest: /var/local/gitea/gitea/cert.pem
owner: gitea
group: gitea
2021-01-26 21:24:21 +01:00
remote_src: yes
2021-01-27 00:26:01 +01:00
notify: restart gitea
- name: Specify the link the private key
lineinfile:
path: /var/local/gitea/gitea/gitea/conf/app.ini
insertafter: '^\[server\]'
regexp: '^KEY_FILE'
line: KEY_FILE = /data/key.pem
notify: restart gitea
- name: Specify the link the private key
lineinfile:
path: /var/local/gitea/gitea/gitea/conf/app.ini
insertafter: '^\[server\]'
regexp: '^CERT_FILE'
line: CERT_FILE = /data/cert.pem
notify: restart gitea
- name: Use https
lineinfile:
path: /var/local/gitea/gitea/gitea/conf/app.ini
insertafter: '^\[server\]'
regexp: '^PROTOCOL'
line: PROTOCOL = https
notify: restart gitea