From f335e51b1319b1b7d7f28a8b9fb95fdeb130dacd Mon Sep 17 00:00:00 2001 From: asifbasha61 Date: Fri, 23 Jun 2023 09:54:12 +0530 Subject: [PATCH] updated ansible yml and docker-compose according to public and localhost installation --- ansible/localhost_install.yml | 27 ++++ ansible/{install.yml => public_install.yml} | 0 .../tasks/configure_compose.yml | 18 +-- .../templates/docker-compose_localhost.yml.j2 | 116 ++++++++++++++++++ ...se.yml.j2 => docker-compose_public.yml.j2} | 0 5 files changed, 153 insertions(+), 8 deletions(-) create mode 100644 ansible/localhost_install.yml rename ansible/{install.yml => public_install.yml} (100%) create mode 100644 ansible/roles/configurations/templates/docker-compose_localhost.yml.j2 rename ansible/roles/configurations/templates/{docker-compose.yml.j2 => docker-compose_public.yml.j2} (100%) diff --git a/ansible/localhost_install.yml b/ansible/localhost_install.yml new file mode 100644 index 0000000..79dc487 --- /dev/null +++ b/ansible/localhost_install.yml @@ -0,0 +1,27 @@ +--- +- name: Installing cQube + hosts: localhost + gather_facts: true + remote_user: root + become: true + vars_files: + - ../config_files/config.yml + - ../config_files/program_selector.yml + - ../config_files/aws_s3_config.yml + - ../config_files/azure_container_config.yml + - ../config_files/local_storage_config.yml + - ../config_files/oracle_storage_config.yml + - ../.version + + roles: + - configurations + - postgres + - python + - keycloak + - ingestion + - spec + - generator + - dashboard + - querybuilder + - nifi + - cqube_version diff --git a/ansible/install.yml b/ansible/public_install.yml similarity index 100% rename from ansible/install.yml rename to ansible/public_install.yml diff --git a/ansible/roles/configurations/tasks/configure_compose.yml b/ansible/roles/configurations/tasks/configure_compose.yml index c4f4996..8761eff 100644 --- a/ansible/roles/configurations/tasks/configure_compose.yml +++ b/ansible/roles/configurations/tasks/configure_compose.yml @@ -1,13 +1,15 @@ - name: copying compose file to ansible directory template: - src: docker-compose.yml.j2 + src: docker-compose.yml_public.j2 dest: "docker-compose.yml" mode: "0644" - tags: install + when: mode_of_installation != "localhost" + tags: [ install, update ] - #- name: copying compose file to ansible directory - # template: - # src: docker-compose.yml_upgrade.j2 - # dest: "docker-compose.yml" - #mode: "0644" - #tags: update +- name: copying compose file to ansible directory + template: + src: docker-compose.yml_localhost.j2 + dest: "docker-compose.yml" + mode: "0644" + when: mode_of_installation == "localhost" + tags: [ install, update ] diff --git a/ansible/roles/configurations/templates/docker-compose_localhost.yml.j2 b/ansible/roles/configurations/templates/docker-compose_localhost.yml.j2 new file mode 100644 index 0000000..4f26f00 --- /dev/null +++ b/ansible/roles/configurations/templates/docker-compose_localhost.yml.j2 @@ -0,0 +1,116 @@ +version: '2.2' +services: + postgres_app: + container_name: postgres_app + image: postgres_ms:1 + restart: always + ports: + - 5432:5432 + environment: + - POSTGRES_DB={{ db_name }} + - POSTGRES_USER={{ db_user }} + - POSTGRES_PASSWORD={{ db_password }} + networks: + cqube_net: + ipv4_address: "10.0.0.3" + python_app: + container_name: python_app + image: python_ms:1 + restart: always + volumes: + - python_executable_env:/usr/local/lib/python3.7/site-packages + networks: + cqube_net: + ipv4_address: "10.0.0.4" + keycloak_app: + container_name: keycloak_app + image: keycloak_ms:1 + restart: always + ports: + - 8080:8080 + environment: + - KEYCLOAK_USER={{ keycloak_adm_name }} + - KEYCLOAK_PASSWORD={{ keycloak_adm_password }} + - PROXY_ADDRESS_FORWARDING=true + networks: + cqube_net: + ipv4_address: "10.0.0.5" + ingest_app: + container_name: ingest_app + image: ingestion_ms:1 + restart: always + ports: + - 3000:3000 + networks: + cqube_net: + ipv4_address: "10.0.0.6" + spec_app: + container_name: spec_app + image: spec_ms:1 + restart: always + ports: + - 3001:3001 + networks: + cqube_net: + ipv4_address: "10.0.0.7" + generator_app: + container_name: generator_app + image: generator_ms:1 + restart: always + ports: + - 3003:3003 + volumes: + - adapter_volume:/python_app/adapter + networks: + cqube_net: + ipv4_address: "10.0.0.8" + dashboard_app: + container_name: dashboard_app + image: dashboard_ms:1 + restart: always + ports: + - 4200:80 + networks: + cqube_net: + ipv4_address: "10.0.0.9" + querybuilder_app: + container_name: querybuilder_app + image: querybuilder_ms:1 + restart: always + ports: + - 3002:3002 + networks: + cqube_net: + ipv4_address: "10.0.0.10" + nifi_app: + container_name: nifi_app + image: nifi_ms:1 + restart: always + ports: + - 8096:8096 + volumes: + - python_executable_env:/usr/local/lib/python3.7/dist-packages + - adapter_volume:/opt/nifi/nifi-current/adapter + environment: + - NIFI_WEB_HTTP_HOST=0.0.0.0 + - NIFI_WEB_HTTP_PORT=8096 + networks: + cqube_net: + ipv4_address: "10.0.0.11" +networks: + cqube_net: + driver: bridge + ipam: + driver: default + config: + - subnet: "10.0.0.0/24" + gateway: "10.0.0.1" + name: cqube_net +volumes: + python_executable_env: + driver: local + name: python_executable_env + adapter_volume: + driver: local + name: adapter_volume + diff --git a/ansible/roles/configurations/templates/docker-compose.yml.j2 b/ansible/roles/configurations/templates/docker-compose_public.yml.j2 similarity index 100% rename from ansible/roles/configurations/templates/docker-compose.yml.j2 rename to ansible/roles/configurations/templates/docker-compose_public.yml.j2