Merge branch 'add-support-for-gitea' of https://github.com/C-J1/ansible-nas

* 'add-support-for-gitea' of https://github.com/C-J1/ansible-nas:
  Swapped from volumes to bind mounts for gitea
  Fixed all.yml.dist for gitea
  Gitea working, but needs some settings tweaks
  Beginnings of a Gitea addition
This commit is contained in:
David Stephens 2018-11-14 23:02:32 +00:00
commit ecb8c811ec
3 changed files with 79 additions and 0 deletions

View file

@ -31,6 +31,7 @@ stats_enabled: false
duplicati_enabled: true
nextcloud_enabled: false
nginx_enabled: true # if you enable nginx, you'll need to map ports 80 and 443 on your router to your Ansible-NAS
gitea_enabled: false
# IRC bouncer
znc_enabled: false
@ -253,6 +254,11 @@ influxdb_data_directory: "{{ docker_home }}/influxdb"
grafana_data_directory: "{{ docker_home }}/grafana"
stat_collection_interval: 15s
###
### Gitea
###
gitea_data_directory: "{{ docker_home }}/gitea"
###
### Nextcloud
###

View file

@ -65,6 +65,10 @@
when: nginx_enabled == true
tags: nginx
- import_tasks: tasks/gitea.yml
when: gitea_enabled == true
tags: gitea
- import_tasks: tasks/stats.yml
when: stats_enabled == true
tags: stats

69
tasks/gitea.yml Normal file
View file

@ -0,0 +1,69 @@
---
- name: Create Gitea group account
group:
name: git
gid: 1309
state: present
- name: Create Gitea user account
user:
name: git
uid: 1309
state: present
system: yes
update_password: on_create
create_home: no
group: git
- name: Create Gitea Directories
file:
path: "{{ item }}"
state: directory
owner: git
group: git
recurse: yes
with_items:
- "{{ gitea_data_directory }}/gitea"
- "{{ gitea_data_directory }}/mysql"
- name: Create MySQL container for Gitea
docker_container:
name: gitea-mysql
image: mysql:5.7
pull: true
volumes:
- "{{ gitea_data_directory }}/mysql:/var/lib/mysql:rw"
env:
MYSQL_DATABASE: gitea
MYSQL_USER: gitea
MYSQL_PASSWORD: gitea
MYSQL_ROOT_PASSWORD: gitea
restart_policy: unless-stopped
memory: 1g
- name: Create Gitea container
docker_container:
name: gitea
image: gitea/gitea:1.6
pull: true
links:
- gitea-mysql:db
volumes:
- "{{ gitea_data_directory }}/gitea:/data:rw"
ports:
- "3001:3000"
- "222:22"
env:
DB_TYPE: mysql
DB_HOST: db:3306
DB_NAME: gitea
DB_USER: gitea
DB_PASSWD: gitea
RUN_MODE: prod
SSH_DOMAIN: "{{ ansible_nas_hostname }}"
SSH_PORT: 222
ROOT_URL: "http://{{ ansible_nas_hostname }}:3001/"
USER_UID: 1309
USER_GID: 1309
restart_policy: unless-stopped
memory: 1g