legacy-server-config/nummus/init.yml

45 lines
1.1 KiB
YAML

---
- hosts: teier.eu
gather_facts: no
tasks:
- name: Create database for Nummus
community.postgresql.postgresql_db
login_user: root
login_password: "{{ lookup('env', 'POSTGRES_PASSWORD') }}"
name: nummus
state: present
- name: Create database user for Nummus
community.postgresql.postgresql_user:
login_user: postgres
login_password: "{{ lookup('env', 'POSTGRES_PASSWORD') }}"
name: "nummus"
db: nummus
password: "{{ lookup('env', 'NUMMUS_DB_PASSWORD') }}"
priv: 'ALL'
state: present
- 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:
NUMMUS_DB_PASSWORD: "{{ lookup('env', 'NUMMUS_DB_PASSWORD') }}"