Add support for couchbase.
This commit is contained in:
parent
61212dfc4d
commit
3d5b252375
|
@ -45,4 +45,14 @@ open_asfa_keylocak_auth_url: http://localhost:8080/auth/
|
|||
open_asfa_keycloak_client_secret: 'use a vault'
|
||||
open_asfa_keycloak_realm: 'realm'
|
||||
open_asfa_keycloak_client_name: 'asfa_client_name'
|
||||
open_asfa_keycloak_client_id: 'asfa_client_id'
|
||||
open_asfa_keycloak_client_id: 'asfa_client_id'
|
||||
|
||||
open_asfa_couchbase_volume: couchbase_data
|
||||
open_asfa_couchbase_image: 'couchbase:community'
|
||||
open_asfa_couchbase_volume_type: 'local'
|
||||
open_asfa_couchbase_volume_o: ""
|
||||
open_asfa_couchbase_volume_device: ""
|
||||
open_asfa_couchbase_connect_string: "couchbase://couchbase"
|
||||
open_asfa_couchbase_username: "Administrator"
|
||||
# open_asfa_couchbase_password: "use a vault"
|
||||
open_asfa_couchbase_bucket: "harvester"
|
|
@ -1,13 +1,11 @@
|
|||
galaxy_info:
|
||||
author: Andrea Dell'Amico
|
||||
description: Systems Architect
|
||||
namespace: adellam
|
||||
role_name: open_asfa
|
||||
description: Open Asfa production environment
|
||||
company: ISTI-CNR
|
||||
|
||||
issue_tracker_url: https://support.d4science.org/projects/d4science-operation
|
||||
|
||||
license: EUPL 1.2+
|
||||
|
||||
min_ansible_version: 2.8
|
||||
min_ansible_version: "2.9"
|
||||
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
|
@ -18,7 +16,7 @@ galaxy_info:
|
|||
- bionic
|
||||
- name: EL
|
||||
versions:
|
||||
- 7
|
||||
- "7"
|
||||
|
||||
galaxy_tags:
|
||||
- open-asfa
|
||||
|
|
|
@ -1,64 +1,84 @@
|
|||
---
|
||||
- name: Manage the installation of the OpenASFA configuration of the database
|
||||
block:
|
||||
- name: Create the directory where the DB init script is going to be installed
|
||||
file: dest={{ open_asfa_compose_dir }} state=directory
|
||||
|
||||
- name: Install the DB initialization script
|
||||
template: src=pg-create-user-db.sh.j2 dest={{ open_asfa_compose_dir }}/pg-create-user-db.sh owner=root group=root mode='0555'
|
||||
|
||||
run_once: True
|
||||
when:
|
||||
- open_asfa_db_docker_host == ansible_fqdn
|
||||
- open_asfa_db_as_container
|
||||
tags: [ 'open_asfa', 'open_asfa_swarm', 'open_asfa_db' ]
|
||||
tags: ['open_asfa', 'open_asfa_swarm', 'open_asfa_db']
|
||||
run_once: true
|
||||
block:
|
||||
- name: Create the directory where the DB init script is going to be installed
|
||||
ansible.builtin.file:
|
||||
dest: "{{ open_asfa_compose_dir }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0700
|
||||
|
||||
- name: Install the DB initialization script
|
||||
ansible.builtin.template:
|
||||
src: pg-create-user-db.sh.j2
|
||||
dest: "{{ open_asfa_compose_dir }}/pg-create-user-db.sh"
|
||||
owner: root
|
||||
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
|
||||
file: dest={{ open_asfa_compose_dir }} state=directory
|
||||
ansible.builtin.file:
|
||||
dest: "{{ open_asfa_compose_dir }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0700
|
||||
|
||||
- name: Install the pgadmin configuration files
|
||||
template: src={{ item }}.j2 dest={{ open_asfa_compose_dir }}/{{ item }} owner=root group=root mode='0444'
|
||||
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
|
||||
|
||||
run_once: True
|
||||
when: open_asfa_pgadmin_docker_host == ansible_fqdn
|
||||
tags: [ 'open_asfa', 'open_asfa_swarm', 'open_asfa_db' ]
|
||||
|
||||
- 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: Add the label that will be used as a constraint for the PostgreSQL DB
|
||||
docker_node:
|
||||
hostname: '{{ open_asfa_db_docker_host }}'
|
||||
labels:
|
||||
asfa_pg_data: 'asfa_server'
|
||||
labels_state: 'merge'
|
||||
when: open_asfa_db_as_container
|
||||
|
||||
- name: Add the label that will be used as a constraint for the Pgadmin service
|
||||
docker_node:
|
||||
hostname: '{{ open_asfa_pgadmin_docker_host }}'
|
||||
labels:
|
||||
asfa_pgadmin_data: 'asfa_server'
|
||||
labels_state: 'merge'
|
||||
- name: Install the docker compose file of Couchbase
|
||||
ansible.builtin.template:
|
||||
src: open-asfa-couchbase-docker-compose.yml.j2
|
||||
dest: "{{ open_asfa_compose_dir }}/docker-open-asfa-stack-couchbase.yml"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0400
|
||||
|
||||
- name: Install the docker compose file
|
||||
template: src=open-asfa-docker-compose.yml.j2 dest={{ open_asfa_compose_dir }}/docker-open-asfa-stack.yml owner=root group=root mode='0400'
|
||||
ansible.builtin.template:
|
||||
src: open-asfa-docker-compose.yml.j2
|
||||
dest: "{{ open_asfa_compose_dir }}/docker-open-asfa-stack.yml"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0400
|
||||
|
||||
- name: Install the docker compose file for postgresql and pgadmin
|
||||
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'
|
||||
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: Start the OpenAsfa stack
|
||||
docker_stack:
|
||||
- name: Start the OpenAsfa stack
|
||||
community.docker.docker_stack:
|
||||
name: open-asfa
|
||||
state: present
|
||||
compose:
|
||||
- '{{ open_asfa_compose_dir }}/docker-open-asfa-stack-db.yml'
|
||||
# - '{{ open_asfa_compose_dir }}/docker-open-asfa-stack.yml'
|
||||
|
||||
run_once: True
|
||||
when: docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool
|
||||
tags: [ 'open_asfa', 'open_asfa_swarm' ]
|
||||
- '{{ open_asfa_compose_dir }}/docker-open-asfa-stack-couchbase.yml'
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
version: '3.6'
|
||||
|
||||
networks:
|
||||
{% if open_asfa_behind_haproxy %}
|
||||
haproxy-public:
|
||||
external: true
|
||||
{% endif %}
|
||||
{{ open_asfa_docker_network }}:
|
||||
|
||||
volumes:
|
||||
{{ open_asfa_couchbase_volume }}:
|
||||
{% if open_asfa_couchbase_volume_type == "nfs4" %}
|
||||
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: {{ open_asfa_couchbase_volume_type }}
|
||||
o: "{{ open_asfa_couchbase_volume_o }}"
|
||||
device: "{{ open_asfa_couchbase_volume_device }}"
|
||||
{% endif %}
|
||||
|
||||
services:
|
||||
couchbase:
|
||||
image: {{ open_asfa_couchbase_image }}
|
||||
networks:
|
||||
- {{ open_asfa_docker_network }}
|
||||
{% if open_asfa_behind_haproxy %}
|
||||
- haproxy-public
|
||||
{% endif %}
|
||||
volumes:
|
||||
- {{ open_asfa_couchbase_volume }}:/opt/couchbase/var
|
||||
deploy:
|
||||
placement:
|
||||
constraints: [node.role == worker]
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
delay: 5s
|
||||
max_attempts: 3
|
||||
window: 120s
|
||||
logging:
|
||||
driver: 'journald'
|
Loading…
Reference in New Issue