Fix a typo.

This commit is contained in:
Andrea Dell'Amico 2023-07-19 16:34:06 +02:00
parent 3c000e43a6
commit 807b647d2a
Signed by: andrea.dellamico
GPG Key ID: 147ABE6CEB9E20FF
3 changed files with 71 additions and 32 deletions

View File

@ -7,10 +7,10 @@ open_asfa_docker_server_image: 'lucabrl01/asfa-server'
open_asfa_docker_client_image: 'lucabrl01/asfa-client'
open_asfa_docker_network: 'open_asfa_net'
# IMPORTANT. Set it to True for the server that is going to host the DB
open_asfa_behind_haproxy: True
open_asfa_behind_haproxy: true
open_asfa_haproxy_public_net: 'haproxy-public'
# DB
open_asfa_db_as_container: True
open_asfa_db_as_container: true
open_asfa_db_pg_version: 12
open_asfa_db_image: 'postgres:{{ open_asfa_db_pg_version }}-alpine'
open_asfa_db_docker_host: 'localhost'
@ -20,11 +20,17 @@ open_asfa_db_port: 5432
open_asfa_db_name: 'asfadb'
open_asfa_db_user: 'asfadb_user'
open_asfa_db_volume: 'asfa_pg_data'
open_asfa_pg_volume_type: 'local'
open_asfa_pg_volume_o: ""
open_asfa_pg_volume_device: ""
open_asfa_db_allowed_hosts:
- '127.0.0.1/8'
open_asfa_db_constraints: '[node.labels.asfa_pg_data==asfa_server]'
open_asfa_pgadmin_image: 'dpage/pgadmin4:5'
open_asfa_pgadmin_data_vol: 'open_asfa_pgadmin_data'
open_asfa_pgadmin_volume_type: 'local'
open_asfa_pgadmin_volume_o: ""
open_asfa_pgadmin_volume_device: ""
open_asfa_pgadmin_docker_host: '{{ open_asfa_db_docker_host }}'
open_asfa_pgadmin_constraints: '[node.role == worker]'
open_asfa_pgadmin_email: 'noreply@example.com'
@ -48,7 +54,7 @@ open_asfa_keycloak_client_name: 'asfa_client_name'
open_asfa_keycloak_client_id: 'asfa_client_id'
open_asfa_couchbase_volume: couchbase_data
open_asfa_couchbase_image: 'couchbase:community'
open_asfa_couchbase_image: 'couchbase:community-7.2.0'
open_asfa_couchbase_volume_type: 'local'
open_asfa_couchbase_volume_o: ""
open_asfa_couchbase_volume_device: ""

View File

@ -1,8 +1,22 @@
---
- name: Create the compose directory
run_once: true
when: docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool
tags: ['open_asfa', 'open_asfa_swarm']
block:
- name: Create the compose directory
ansible.builtin.file:
dest: "{{ open_asfa_compose_dir }}"
state: directory
owner: root
group: root
mode: 0700
- name: Manage the installation of the OpenASFA configuration of the database
when:
- open_asfa_db_docker_host == ansible_fqdn
- open_asfa_db_as_container
- open_asfa_pg_volume_type == "local"
tags: ['open_asfa', 'open_asfa_swarm', 'open_asfa_db']
run_once: true
block:
@ -22,35 +36,27 @@
group: root
mode: 0555
- name: Manage the installation of the OpenASFA configuration of pgadmin
when: open_asfa_pgadmin_docker_host == ansible_fqdn
tags: ['open_asfa', 'open_asfa_swarm', 'open_asfa_db']
run_once: true
block:
- name: Create the directory where the pgadmin configuration is going to be installed
ansible.builtin.file:
dest: "{{ open_asfa_compose_dir }}"
state: directory
owner: root
group: root
mode: 0700
- name: Install the pgadmin configuration files
ansible.builtin.template:
src: "{{ item }}.j2"
dest: "{{ open_asfa_compose_dir }}/{{ item }}"
owner: root
group: root
mode: 0444
loop:
- pgadmin_config_local.py
- pgadmin_servers.json
- name: Add the label that will be used as a constraint for the PostgreSQL DB
community.docker.docker_node:
hostname: '{{ open_asfa_db_docker_host }}'
labels:
pg_data_asfa: 'asfa_server'
pgadmin_data_asfa: 'asfa_server'
labels_state: 'merge'
- name: Manage the installation of the OpenASFA configuration of the swarm service
when: docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool
tags: ['open_asfa', 'open_asfa_swarm']
run_once: true
block:
- name: Install the docker compose file for postgresql and pgadmin
ansible.builtin.template:
src: open-asfa-db-docker-compose.yml.j2
dest: "{{ open_asfa_compose_dir }}/docker-open-asfa-stack-db.yml"
owner: root
group: root
mode: 0400
- name: Install the docker compose file of Couchbase
ansible.builtin.template:
src: open-asfa-couchbase-docker-compose.yml.j2
@ -59,7 +65,7 @@
group: root
mode: 0400
- name: Install the docker compose file
- name: Install the docker compose file of the ASFA service
ansible.builtin.template:
src: open-asfa-docker-compose.yml.j2
dest: "{{ open_asfa_compose_dir }}/docker-open-asfa-stack.yml"
@ -67,13 +73,22 @@
group: root
mode: 0400
- name: Install the docker compose file for postgresql and pgadmin
- name: Install the DB initialization script
ansible.builtin.template:
src: open-asfa-db-docker-compose.yml.j2
dest: "{{ open_asfa_compose_dir }}/docker-open-asfa-stack-db.yml"
src: pg-create-user-db.sh.j2
dest: "{{ open_asfa_compose_dir }}/pg-create-user-db.sh"
owner: root
group: root
mode: 0400
mode: 0555
when:
- open_asfa_db_as_container
- open_asfa_pg_volume_type != "local"
- name: Create the secret for the Postgres initizalization script
community.docker.docker_secret:
name: open_asfa_pg_config
data_src: '{{ open_asfa_compose_dir }}/pg-create-user-db.sh'
state: present
- name: Install the pgadmin configuration files
ansible.builtin.template:

View File

@ -10,6 +10,15 @@ networks:
volumes:
{% if open_asfa_db_as_container %}
{{ open_asfa_db_volume }}:
{% if open_asfa_pg_volume_type == "nfs4" %}
driver: local
driver_opts:
type: {{ open_asfa_pg_volume_type }}
o: "{{ open_asfa_pg_volume_o }}"
device: "{{ open_asfa_pg_volume_device }}"
{% endif %}
{% endif %}
{{ open_asfa_pgadmin_data_vol }}:
driver: local
@ -23,6 +32,8 @@ secrets:
external: true
open_asfa_pgadmin_servers:
external: true
open_asfa_pg_config:
external: true
services:
{% if open_asfa_db_as_container %}
@ -32,16 +43,23 @@ services:
- {{ open_asfa_docker_network }}
volumes:
- {{ open_asfa_db_volume }}:/var/lib/postgresql/data/pg_data
- {{ open_asfa_compose_dir }}/pg-create-user-db.sh:/docker-entrypoint-initdb.d/pg-create-user-db.sh:ro
environment:
POSTGRES_PASSWORD: {{ open_asfa_db_pwd }}
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PORT: {{ open_asfa_db_port }}
PGDATA: /var/lib/postgresql/data/pg_data
secrets:
- source: open_asfa_pg_config
target: /docker-entrypoint-initdb.d/pg-create-user-db.sh
mode: 0555
deploy:
placement:
{% if open_asfa_pg_volume_type == "nfs4" %}
constraints: [node.role == worker]
{% else %}
constraints: {{ open_asfa_db_constraints }}
{% endif %}
restart_policy:
condition: on-failure
delay: 5s