database, gitea setup now to have them talk

This commit is contained in:
Ibrahim Mkusa 2024-09-07 19:03:57 -04:00
parent f0e53d0bdf
commit e6dd4d70a0

View File

@ -7,6 +7,8 @@
vars: vars:
postgresql_user: gitea postgresql_user: gitea
postgresql_db: giteadb postgresql_db: giteadb
container_network: gitea_network
gitea_directory: /home/ubuntu/hifadhi_kuu/gitea
tasks: tasks:
- name: install postgresql - name: install postgresql
apt: apt:
@ -63,3 +65,44 @@
path: /etc/postgresql/14/main/pg_hba.conf path: /etc/postgresql/14/main/pg_hba.conf
regexp: "^local.*all.*all.*peer" regexp: "^local.*all.*all.*peer"
line: "local all all scram-sha-256" line: "local all all scram-sha-256"
- name: create the gitea directory for the service
ansible.builtin.file:
path: "{{gitea_directory}}"
state: directory
mode: '0755'
- name: install gitea container
community.docker.docker_image:
name: gitea/gitea
source: pull
pull:
platform: amd64
- name: create network the docker container will run in
community.docker.docker_network:
name: "{{container_network}}"
- name: run and make persistant gitea container
community.docker.docker_container:
name: gitea
image: gitea/gitea
state: started
restart_policy: always
ports:
- "3000:3000"
- "2222:2222"
env:
GITEA__database__DB_TYPE=postgres
GITEA__database__HOST=localhost:5432
GITEA__database__NAME=giteadb
GITEA__database__USER=gitea
GITEA__database__PASSWD="{{postgresql_password}}"
networks:
- name: "{{container_network}}"
volumes:
- ./data:/var/lib/gitea
- ./config:/etc/gitea
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
working_dir: "{{gitea_directory}}"