2021-01-01 15:09:53 +00:00
|
|
|
---
|
|
|
|
- hosts: teier.eu
|
|
|
|
gather_facts: no
|
|
|
|
tasks:
|
|
|
|
- name: Create database for Nummus
|
2021-01-17 16:37:14 +00:00
|
|
|
community.postgresql.postgresql_db
|
2021-01-01 15:09:53 +00:00
|
|
|
login_user: root
|
2021-01-17 16:37:14 +00:00
|
|
|
login_password: "{{ lookup('env', 'POSTGRES_PASSWORD') }}"
|
2021-01-01 15:09:53 +00:00
|
|
|
name: nummus
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Create database user for Nummus
|
2021-01-17 16:37:14 +00:00
|
|
|
community.postgresql.postgresql_user:
|
|
|
|
login_user: postgres
|
|
|
|
login_password: "{{ lookup('env', 'POSTGRES_PASSWORD') }}"
|
2021-01-01 15:09:53 +00:00
|
|
|
name: "nummus"
|
2021-01-17 16:37:14 +00:00
|
|
|
db: nummus
|
2021-01-01 15:09:53 +00:00
|
|
|
password: "{{ lookup('env', 'NUMMUS_DB_PASSWORD') }}"
|
2021-01-17 16:37:14 +00:00
|
|
|
priv: 'ALL'
|
2021-01-01 15:09:53 +00:00
|
|
|
state: present
|
2021-01-17 16:37:14 +00:00
|
|
|
|
2021-01-01 15:09:53 +00:00
|
|
|
- name: Check dc directory
|
|
|
|
stat:
|
|
|
|
path: /dc/nummus
|
|
|
|
register: nummus_dc_dir_stat
|
|
|
|
|
|
|
|
- name: Create nummus dc directory
|
|
|
|
file:
|
|
|
|
path: /dc/nummus
|
|
|
|
state: directory
|
|
|
|
mode: 0755
|
|
|
|
group: root
|
|
|
|
owner: root
|
|
|
|
when: nummus_dc_dir_stat.islnk is not defined
|
|
|
|
|
|
|
|
- name: Copy compose file
|
|
|
|
copy:
|
|
|
|
src: docker-compose.yml
|
|
|
|
dest: /dc/nummus
|
|
|
|
|
|
|
|
- name: Start nummus
|
|
|
|
shell: "cd /dc/nummus && docker-compose up -d"
|
|
|
|
environment:
|
2021-01-17 16:37:14 +00:00
|
|
|
NUMMUS_DB_PASSWORD: "{{ lookup('env', 'NUMMUS_DB_PASSWORD') }}"
|