Compare commits

..

1 Commits

Author SHA1 Message Date
Bryan Joshua Pedini 550459b77f [UNTESTED] added ansible basics 2022-02-06 15:30:12 +01:00
7 changed files with 41 additions and 6 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/.env
/ansible/inventory.ini
/data

4
ansible/ansible.cfg Normal file
View File

@ -0,0 +1,4 @@
[defaults]
nocows = True
inventory = ./inventory.ini
interpreter_python = auto_silent

View File

@ -0,0 +1,2 @@
[gitea]
192.168.1.10 ansible_user=root

6
ansible/main.yml Normal file
View File

@ -0,0 +1,6 @@
---
- hosts: all
become: true
tasks:
- name: Setup Linux user and group
import_tasks: tasks/user.yml

20
ansible/tasks/user.yml Normal file
View File

@ -0,0 +1,20 @@
---
- name: Ensure a Linux group "git" exists
ansible.builtin.group:
state: present
name: git
system: no
uid: "{{ GIT_USER_GID }}"
- name: Ensure a Linux user "git" exists
ansible.builtin.user:
state: present
name: git
group: git
password: "!"
comment: "Gitea"
system: no
uid: "{{ GIT_USER_UID }}"
create_home: no
generate_ssh_key: yes
ssh_key_bits: 4096
ssh_key_comment: "Gitea Host Key"

View File

@ -2,13 +2,13 @@ version: "3"
services:
app:
image: gitea/gitea:${GITEA_VERSION}
restart: unless-stopped
container_name: ${SERVICE_NAME}_gitea
depends_on:
- db
environment:
- USER_GID=${USER_GID}
- USER_UID=${USER_UID}
image: ${GITEA_VERSION}
labels:
- traefik.docker.network=traefik-proxy
- traefik.enable=true
@ -29,6 +29,7 @@ services:
networks:
- internal
- traefik-proxy
restart: unless-stopped
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
@ -37,15 +38,16 @@ services:
ports:
- ${SSH_PORT}:22
db:
image: mariadb:${MYSQL_VERSION}
restart: unless-stopped
container_name: ${SERVICE_NAME}_mysql
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_RANDOM_ROOT_PASSWORD=yes
- MYSQL_USER=${MYSQL_USER}
image: ${MYSQL_VERSION}
networks:
- internal
restart: unless-stopped
volumes:
- ./data/mysql:/var/lib/mysql

View File

@ -1,8 +1,8 @@
GITEA_VERSION=latest
GITEA_VERSION=gitea/gitea:latest
MYSQL_DATABASE=gitea
MYSQL_PASSWORD=
MYSQL_USER=gitea
MYSQL_VERSION=10.6.3
MYSQL_VERSION=mariadb:10.6.3
SERVICE_NAME=git.mydomain.com
TRAEFIK_HOST=git.mydomain.com
TRAEFIK_ROUTER=git_mydomain_com