From af94edbda43a103a92473834709faebdc054151c Mon Sep 17 00:00:00 2001 From: dcore94 Date: Tue, 16 Feb 2021 12:26:19 +0100 Subject: [PATCH] created playbook for prod --- README.md | 7 ++-- roles/external-postgres/defaults/main.yml | 9 +++++ site-prod.yaml | 41 +++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 roles/external-postgres/defaults/main.yml create mode 100644 site-prod.yaml diff --git a/README.md b/README.md index 25c1460..00808ed 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,12 @@ Files for swarms and configurations will be generated inside a temporary folder In order to change destination folder use the switch: `-e target_path=anotherdir` If you only want to review the generated files run the command `ansible-playbook site.yaml -e dry=true` In order to switch between postgres and mysql specify the db on the proper variable: `-e db=mysql` -In order to skip worker creation specify the noworker varaible: `-e noworker=true` +In order to connect to an external postgres withouth pulling up a service in the stack use -e db=remote-postgres +In order to skip worker creation specify the noworker variable: `-e noworker=true` In order to enable the cluster replacement use the switch: `-e cluster_replacement=true` -If you run the stack in production behind a load balenced setup ensure the variable cluster_check is true: `ansible-playbook site.yaml -e cluster_check=true` +If you run the stack in production behind a load balanced setup ensure the variable cluster_check is true: `ansible-playbook site.yaml -e cluster_check=true` + +In order to avoid confusion of all variables a proper site.yaml has been created for prod environment. Run `ansible-playbook site-prod.yaml` and this should deploy a stack with prod setup. Other setting can be fine tuned by checking the variables in the proper roles which are: diff --git a/roles/external-postgres/defaults/main.yml b/roles/external-postgres/defaults/main.yml new file mode 100644 index 0000000..51ce107 --- /dev/null +++ b/roles/external-postgres/defaults/main.yml @@ -0,0 +1,9 @@ +--- +use_jdbc: True +postgres_host: "postgresql-srv.d4science.org" +conductor_db: "postgres" +jdbc_user: "conductor_u" +jdbc_pass: "c36dda661add7c2b5093087ddb655992" +jdbc_db: "conductor" +jdbc_url: "jdbc:postgresql://{{ postgres_host }}:5432/{{ jdbc_db }}" + diff --git a/site-prod.yaml b/site-prod.yaml new file mode 100644 index 0000000..f153281 --- /dev/null +++ b/site-prod.yaml @@ -0,0 +1,41 @@ +--- +- hosts: localhost + vars: + cluster_check: true + conductor_workers_server: http://conductor-server:8080/api + roles: + - common + - external-postgres + - elasticsearch + - cluster-replacement + - conductor + - workers + tasks: + - name: Start es + docker_stack: + name: conductor-prod + state: present + compose: + - "{{ target_path }}/elasticsearch-swarm.yaml" + when: dry is not defined or not dry|bool + + - name: Waiting for databases + pause: + seconds: 5 + when: dry is not defined or not dry|bool + + - name: Start conductor + docker_stack: + name: conductor-prod + state: present + compose: + - "{{ target_path }}/conductor-swarm.yaml" + when: dry is not defined or not dry|bool + + - name: Start workers + docker_stack: + name: conductor-prod + state: present + compose: + - "{{ target_path }}/conductor-workers-swarm.yaml" + when: dry is not defined or not dry|bool