Chore: Refactored the ansible playbook to use one .env file and vars

Chore: Moved to gondor
This commit is contained in:
Amritanshu Agrawal 2023-08-07 07:32:28 +05:30
parent 5565e923ab
commit 77e2411a88
13 changed files with 53 additions and 93 deletions

View File

@ -2,15 +2,11 @@ HOST=0.0.0.0
PORT=80
LOG_LEVEL=WARN
DEBUG=false
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/brewman_hinchco
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/brewman_{{ name }}
MODULE_NAME=brewman.main
PROJECT_NAME=brewman
POSTGRES_SERVER=db
POSTGRES_USER=postgres
POSTGRES_PASSWORD=123456
POSTGRES_DB=brewman_hinchco
SECRET_KEY=7b889cff76532fde8483304cf415243f70df200518ba9aee4d26c0709ad6fbd1
MIDDLEWARE_SECRET_KEY=1e36e7f678
SECRET_KEY={{ secret_key }}
MIDDLEWARE_SECRET_KEY={{ middleware_key }}
ALGORITHM=HS256
JWT_TOKEN_EXPIRE_MINUTES=30
ALEMBIC_LOG_LEVEL=INFO

View File

@ -1,17 +0,0 @@
HOST=0.0.0.0
PORT=80
LOG_LEVEL=WARN
DEBUG=false
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/acc
MODULE_NAME=brewman.main
PROJECT_NAME=brewman
POSTGRES_SERVER=db
POSTGRES_USER=postgres
POSTGRES_PASSWORD=123456
POSTGRES_DB=exp
SECRET_KEY=c9bee2d38676447c2f7a9ea715446e2fd09f16fbaa5b3f6a6f207ec18993987f
MIDDLEWARE_SECRET_KEY=cb71666b9c
ALGORITHM=HS256
JWT_TOKEN_EXPIRE_MINUTES=30
ALEMBIC_LOG_LEVEL=INFO
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN

View File

@ -1,17 +0,0 @@
HOST=0.0.0.0
PORT=80
LOG_LEVEL=WARN
DEBUG=false
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/exp
MODULE_NAME=brewman.main
PROJECT_NAME=brewman
POSTGRES_SERVER=db
POSTGRES_USER=postgres
POSTGRES_PASSWORD=123456
POSTGRES_DB=exp
SECRET_KEY=8546a61262dab7c05ccf2e26abe30bc10966904df6dfd29259ea85dd0844a8e7
MIDDLEWARE_SECRET_KEY=da6fcd999b
ALGORITHM=HS256
JWT_TOKEN_EXPIRE_MINUTES=30
ALEMBIC_LOG_LEVEL=INFO
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN

View File

@ -1,17 +0,0 @@
HOST=0.0.0.0
PORT=80
LOG_LEVEL=WARN
DEBUG=false
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/hops
MODULE_NAME=brewman.main
PROJECT_NAME=brewman
POSTGRES_SERVER=db
POSTGRES_USER=postgres
POSTGRES_PASSWORD=123456
POSTGRES_DB=exp
SECRET_KEY=cfb3be420c4e2b0ed423b2e4e238713d0461e2ba56198138ad6c4d82aef6295c
MIDDLEWARE_SECRET_KEY=9c2bdd24be
ALGORITHM=HS256
JWT_TOKEN_EXPIRE_MINUTES=30
ALEMBIC_LOG_LEVEL=INFO
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN

View File

@ -1,17 +0,0 @@
HOST=0.0.0.0
PORT=80
LOG_LEVEL=WARN
DEBUG=false
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/mhl
MODULE_NAME=brewman.main
PROJECT_NAME=brewman
POSTGRES_SERVER=db
POSTGRES_USER=postgres
POSTGRES_PASSWORD=123456
POSTGRES_DB=exp
SECRET_KEY=c9fd1b99931feb083f67470170650420b99eb35368d3de186427166c28d32c8b
MIDDLEWARE_SECRET_KEY=9183bdcfb0
ALGORITHM=HS256
JWT_TOKEN_EXPIRE_MINUTES=30
ALEMBIC_LOG_LEVEL=INFO
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN

View File

@ -5,11 +5,11 @@
# - A hostname/ip can be a member of multiple groups
[brewman]
acc ansible_host=beacon var_file=vars/acc.yml
exp ansible_host=beacon var_file=vars/exp.yml
hops ansible_host=beacon var_file=vars/hops.yml
mhl ansible_host=beacon var_file=vars/mhl.yml
hinchco ansible_host=beacon var_file=vars/hinchco.yml
acc ansible_host=gondor var_file=vars/acc.yml
exp ansible_host=gondor var_file=vars/exp.yml
hops ansible_host=gondor var_file=vars/hops.yml
mhl ansible_host=gondor var_file=vars/mhl.yml
hinchco ansible_host=gondor var_file=vars/hinchco.yml
[all:vars]
ansible_python_interpreter=/usr/bin/python3

View File

@ -6,6 +6,7 @@
become: true
vars_files:
- "{{ var_file }}"
- vars/default.yml
tasks:
- name: Copy dockerfile
@ -30,7 +31,7 @@
- name: Upload the .env file
template:
src: "{{ env_file }}"
src: "files/.env"
dest: "/var/lib/{{ host_directory }}/.env"
- name: Create brewman container
@ -40,8 +41,10 @@
state: started
restart_policy: "unless-stopped"
env_file: "/var/lib/{{ host_directory }}/.env"
links:
- "postgres:db"
etc_hosts:
db : "{{ db_host }}"
# links:
# - "postgres:db"
published_ports:
- "127.0.0.1:{{ host_port }}:80"
volumes:

View File

@ -1,6 +1,11 @@
---
name: acc
# host_directory: "brewman-{{ name }}"
# db_name: "brewman_{{ name }}"
http_host: "acc.hopsngrains.com"
http_conf: "acc.hopsngrains.com.conf"
host_port: "8659"
host_directory: "brewman-acc"
env_file: "files/.env-acc"
secret_key: c9bee2d38676447c2f7a9ea715446e2fd09f16fbaa5b3f6a6f207ec18993987f
middleware_key: cb71666b9c

4
docker/vars/default.yml Normal file
View File

@ -0,0 +1,4 @@
---
db_host: 172.26.12.67
host_directory: "brewman-{{ name }}"
db_name: "brewman_{{ name }}"

View File

@ -1,6 +1,11 @@
---
name: exp
# host_directory: "brewman-{{ name }}"
# db_name: "brewman_{{ name }}"
http_host: "exp.tanshu.com"
http_conf: "exp.tanshu.com.conf"
host_port: "8656"
host_directory: "brewman-exp"
env_file: "files/.env-exp"
secret_key: 8546a61262dab7c05ccf2e26abe30bc10966904df6dfd29259ea85dd0844a8e7
middleware_key: da6fcd999b

View File

@ -1,6 +1,11 @@
---
name: hinchco
# host_directory: "brewman-{{ name }}"
# db_name: "brewman_{{ name }}"
http_host: "acc.hinchco.in"
http_conf: "acc.hinchco.in.conf"
host_port: "8655"
host_directory: "brewman-hinchco"
env_file: "files/.env-hinchco"
secret_key: 7b889cff76532fde8483304cf415243f70df200518ba9aee4d26c0709ad6fbd1
middleware_key: 1e36e7f678

View File

@ -1,6 +1,11 @@
---
name: hops
# host_directory: "brewman-{{ name }}"
# db_name: "brewman_{{ name }}"
http_host: "hops.hopsngrains.com"
http_conf: "hops.hopsngrains.com.conf"
host_port: "8658"
host_directory: "brewman-hops"
env_file: "files/.env-hops"
secret_key: cfb3be420c4e2b0ed423b2e4e238713d0461e2ba56198138ad6c4d82aef6295c
middleware_key: 9c2bdd24be

View File

@ -1,6 +1,11 @@
---
name: mhl
# host_directory: "brewman-{{ name }}"
# db_name: "brewman_{{ name }}"
http_host: "mhl.hopsngrains.com"
http_conf: "mhl.hopsngrains.com.conf"
host_port: "8657"
host_directory: "brewman-mhl"
env_file: "files/.env-mhl"
secret_key: c9fd1b99931feb083f67470170650420b99eb35368d3de186427166c28d32c8b
middleware_key: 9183bdcfb0