From 397d2fcba4ede2e9016b88b7d6f14e6d753d7e99 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 22 May 2023 20:29:21 +0200 Subject: [PATCH] Remove the volume constraints. --- .vscode/settings.json | 3 ++ defaults/main.yml | 1 - meta/main.yml | 13 ++++----- tasks/main.yml | 28 +++++++------------ .../bluecloud-ufish-db-docker-compose.yml.j2 | 6 +++- .../bluecloud-ufish-docker-compose.yml.j2 | 5 +--- 6 files changed, 24 insertions(+), 32 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2de2499 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "ansible.python.interpreterPath": "/opt/local/bin/python3.10" +} \ No newline at end of file diff --git a/defaults/main.yml b/defaults/main.yml index 9ee713b..09f8ca1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -18,7 +18,6 @@ bc_ufish_db_port: 3306 bc_ufish_db_name: 'bc_ufish' bc_ufish_db_user: 'bc_ufish_u' bc_ufish_db_volume: 'bc_ufish_db_data' -bc_ufish_db_constraints: 'node.labels.ufish_db_data == bc_ufish' # Kb bc_ufish_phpmyadmin_upload_size: '51200000' bc_ufish_phpmyadmin_url: 'https://ufish-phpmyadmin.d4science.org' diff --git a/meta/main.yml b/meta/main.yml index fa1f191..f1c01cb 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,13 +1,10 @@ galaxy_info: author: Andrea Dell'Amico - description: Systems Architect + namespace: adellam + role_name: bluecloud_ufish + description: Role that installs the Bluecloud ufish service 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.8" # To view available platforms and versions (or releases), visit: # https://galaxy.ansible.com/api/v1/platforms/ @@ -18,7 +15,7 @@ galaxy_info: - bionic - name: EL versions: - - 7 + - "7" galaxy_tags: - mei-generator diff --git a/tasks/main.yml b/tasks/main.yml index 04bd0eb..88a9484 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,45 +1,37 @@ --- - name: Manage the installation of the uFish configuration of the swarm service + run_once: true + when: docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool + tags: ['bc_ufish', 'bc_ufish_swarm'] block: - - name: Add the label that will be used as a constraint for the uFish DB - docker_node: - hostname: '{{ bc_ufish_db_docker_host }}' - labels: - ufish_db_data: 'bc_ufish' - labels_state: 'merge' - - name: Create the directory where the compose will be stored - file: + ansible.builtin.file: dest: '{{ bc_ufish_compose_dir }}' state: directory owner: root group: root - mode: '0755' + mode: 0755 - name: Install the docker compose file of the ufish stack - template: + ansible.builtin.template: src: bluecloud-ufish-docker-compose.yml.j2 dest: '{{ bc_ufish_compose_dir }}/docker-bluecloud-ufish-stack.yml' owner: root group: root - mode: '0400' + mode: 0400 - name: Install the docker compose file for the ufish db server and for phpmyadmin - template: + ansible.builtin.template: src: bluecloud-ufish-db-docker-compose.yml.j2 dest: '{{ bc_ufish_compose_dir }}/docker-bluecloud-ufish-stack-db.yml' owner: root group: root - mode: '0400' + mode: 0400 - name: Start the uFish stack - docker_stack: + community.docker.docker_stack: name: bluecloud-ufish state: present compose: - '{{ bc_ufish_compose_dir }}/docker-bluecloud-ufish-stack-db.yml' - '{{ bc_ufish_compose_dir }}/docker-bluecloud-ufish-stack.yml' - - run_once: True - when: docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool - tags: [ 'bc_ufish', 'bc_ufish_swarm' ] diff --git a/templates/bluecloud-ufish-db-docker-compose.yml.j2 b/templates/bluecloud-ufish-db-docker-compose.yml.j2 index bb1e0ff..66ce4b4 100644 --- a/templates/bluecloud-ufish-db-docker-compose.yml.j2 +++ b/templates/bluecloud-ufish-db-docker-compose.yml.j2 @@ -7,6 +7,11 @@ networks: volumes: {{ bc_ufish_db_volume }}: + driver: local + driver_opts: + type: nfs4 + o: "nfsvers=4,addr=146.48.123.250,rw" + device: ":/nfs/bluecloud_ufish_mysql_data" services: ufish-mysql: @@ -23,7 +28,6 @@ services: placement: constraints: - node.role == worker - - {{ bc_ufish_db_constraints }} restart_policy: condition: on-failure delay: 5s diff --git a/templates/bluecloud-ufish-docker-compose.yml.j2 b/templates/bluecloud-ufish-docker-compose.yml.j2 index 9bdaf6b..8a5a51a 100644 --- a/templates/bluecloud-ufish-docker-compose.yml.j2 +++ b/templates/bluecloud-ufish-docker-compose.yml.j2 @@ -7,9 +7,6 @@ networks: {% endif %} {{ bc_ufish_docker_network }}: -volumes: - {{ bc_ufish_db_volume }}: - services: {{ bc_ufish_docker_service_server_name }}: image: {{ bc_ufish_docker_server_image }} @@ -19,7 +16,7 @@ services: - haproxy-public {% endif %} environment: - MYSQL_HOST: {{ bc_ufish_db_host }} + MYSQL_HOST: {{ bc_ufish_docker_stack_name }}_{{ bc_ufish_db_host }} MYSQL_PORT: 3306 MYSQL_PASSWORD: {{ bc_ufish_db_pwd }} MYSQL_USER: {{ bc_ufish_db_user }}