From f7851fd616a9c55999b3d6536568953f7e169342 Mon Sep 17 00:00:00 2001 From: Antonio Calanducci Date: Tue, 10 Oct 2023 14:35:28 +0200 Subject: [PATCH] Make role parametric to provision several instanes of IS registry --- .../is_registry_devnext/is_registry_devnext.yml | 5 +++++ .../is_registry_devsec/is_registry_devsec.yml | 3 +++ inventory/hosts | 2 -- inventory/hosts.devnext | 6 ++++++ inventory/hosts.devsec | 6 ++++++ is-registry.yml | 12 ++++++++++++ is-registry/defaults/main.yml | 8 ++++---- is-registry/tasks/main.yml | 6 +++--- is-registry/templates/docker-compose.yml.j2 | 14 ++++++-------- site.yml | 6 ------ 10 files changed, 45 insertions(+), 23 deletions(-) create mode 100644 group_vars/is_registry_devnext/is_registry_devnext.yml create mode 100644 group_vars/is_registry_devsec/is_registry_devsec.yml delete mode 100644 inventory/hosts create mode 100644 inventory/hosts.devnext create mode 100644 inventory/hosts.devsec create mode 100644 is-registry.yml delete mode 100644 site.yml diff --git a/group_vars/is_registry_devnext/is_registry_devnext.yml b/group_vars/is_registry_devnext/is_registry_devnext.yml new file mode 100644 index 0000000..fb2d4f3 --- /dev/null +++ b/group_vars/is_registry_devnext/is_registry_devnext.yml @@ -0,0 +1,5 @@ +start_scopes: 'devNext' +complete_start_scope: '/gcube/devNext' +gcore_host: 'node14-d-d4s.d4science.org' + + diff --git a/group_vars/is_registry_devsec/is_registry_devsec.yml b/group_vars/is_registry_devsec/is_registry_devsec.yml new file mode 100644 index 0000000..a4900a9 --- /dev/null +++ b/group_vars/is_registry_devsec/is_registry_devsec.yml @@ -0,0 +1,3 @@ +start_scopes: 'devsec' +complete_start_scope: '/gcube/devsec' +gcore_host: 'node3.d.d4science.research-infrastructures.eu' \ No newline at end of file diff --git a/inventory/hosts b/inventory/hosts deleted file mode 100644 index 7ad9f46..0000000 --- a/inventory/hosts +++ /dev/null @@ -1,2 +0,0 @@ -[docker_swarm_test_cluster] -10.1.28.135 diff --git a/inventory/hosts.devnext b/inventory/hosts.devnext new file mode 100644 index 0000000..1f2b973 --- /dev/null +++ b/inventory/hosts.devnext @@ -0,0 +1,6 @@ +[is_registry_devnext] +10.1.28.135 + + + + diff --git a/inventory/hosts.devsec b/inventory/hosts.devsec new file mode 100644 index 0000000..5c97574 --- /dev/null +++ b/inventory/hosts.devsec @@ -0,0 +1,6 @@ +[is_registry_devsec] +10.1.28.135 + + + + diff --git a/is-registry.yml b/is-registry.yml new file mode 100644 index 0000000..3b76b09 --- /dev/null +++ b/is-registry.yml @@ -0,0 +1,12 @@ +--- +- name: Configurazione IS Registry + #hosts: is_registry_devsec:is_registry_devnext + hosts: all + # tasks: + # - name: + # debug: + # var: start_scopes + roles: + - { role: is-registry } + + diff --git a/is-registry/defaults/main.yml b/is-registry/defaults/main.yml index 02b27fc..20a3321 100644 --- a/is-registry/defaults/main.yml +++ b/is-registry/defaults/main.yml @@ -5,10 +5,10 @@ infrastructure: 'gcube' complete_start_scope: '/gcube/devNext' gcore_host: 'node14-d-d4s.d4science.org' config_dir: 'etc/is-registry-service' -is_registry_compose_dir: '/srv/is-registry_stack' -is_registry_docker_stack_name: 'is-registry-stack' -is_registry_docker_service_server_name: 'is-registry' +is_registry_compose_dir: '/srv/is-registry-stack-{{ start_scopes }}' +is_registry_docker_stack_name: 'is-registry-stack-{{ start_scopes }}' +is_registry_docker_service_server_name: 'is-registry-{{ start_scopes }}' is_registry_docker_server_image: 'd4science/gcore-is-registry:latest' is_registry_docker_network: 'is-registry-network' -is_registry_service_port: 8080 +#is_registry_service_port: 8080 is_registry_haproxy_public_net: 'haproxy-public' \ No newline at end of file diff --git a/is-registry/tasks/main.yml b/is-registry/tasks/main.yml index c0ce2d8..1306287 100644 --- a/is-registry/tasks/main.yml +++ b/is-registry/tasks/main.yml @@ -43,19 +43,19 @@ - name: Create the secret for GHNConfig.xml community.docker.docker_secret: - name: ghn-config + name: ghn-config-{{ start_scopes }} data_src: '{{ is_registry_compose_dir }}/GHNConfig.xml' state: present - name: Create the secret for jndi-config.xml community.docker.docker_secret: - name: jndi-config + name: jndi-config-{{ start_scopes }} data_src: '{{ is_registry_compose_dir }}/jndi-config.xml' state: present - name: Create the secret for server-config.wsdd community.docker.docker_secret: - name: server-config + name: server-config-{{ start_scopes }} data_src: '{{ is_registry_compose_dir }}/server-config.wsdd' state: present diff --git a/is-registry/templates/docker-compose.yml.j2 b/is-registry/templates/docker-compose.yml.j2 index 6c62763..1048684 100644 --- a/is-registry/templates/docker-compose.yml.j2 +++ b/is-registry/templates/docker-compose.yml.j2 @@ -6,29 +6,27 @@ networks: # external: true secrets: - ghn-config: + ghn-config-{{ start_scopes }}: external: true - jndi-config: + jndi-config-{{ start_scopes }}: external: true - server-config: + server-config-{{ start_scopes }}: external: true services: {{ is_registry_docker_service_server_name }}: image: {{ is_registry_docker_server_image }} - #ports: - # - "{{ is_registry_service_port }}:{{ is_registry_service_port }}" networks: - {{ is_registry_docker_network }} - {{ is_registry_haproxy_public_net }} secrets: - - source: ghn-config + - source: ghn-config-{{ start_scopes }} target: /home/gcube/gCore/config/GHNConfig.xml mode: 0444 - - source: jndi-config + - source: jndi-config-{{ start_scopes }} target: /home/gcube/gCore/etc/is-registry-service/jndi-config.xml mode: 0444 - - source: server-config + - source: server-config-{{ start_scopes }} target: /home/gcube/gCore/etc/globus_wsrf_core/server-config.wsdd mode: 0444 deploy: diff --git a/site.yml b/site.yml deleted file mode 100644 index c447585..0000000 --- a/site.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- hosts: docker_swarm_test_cluster - serial: 1 - roles: - - { role: is-registry } -