2023-09-26 11:40:59 +02:00
---
# tasks file for is-registry
2023-10-03 16:32:13 +02:00
- name : Create the directory where the compose file will be installed
ansible.builtin.file :
2023-10-06 12:21:36 +02:00
dest : '{{ is_registry_compose_dir }}'
2023-10-03 16:32:13 +02:00
state : directory
mode : 0750
owner : root
group : root
2023-12-22 10:51:52 +01:00
# - name: Set gcube security keys variables properly according to the environment
# set_fact:
# gcube_security_keys: "{{ gcube_prod_security_keys if infra == 'prod' else gcube_preprod_security_keys if infra == 'pre' else gcube_dev_security_keys }}"
# gcube_security_key_legacy: "{{ gcube_prod_security_key_legacy if infra == 'prod' else gcube_preprod_security_key_legacy if infra == 'pre' else gcube_dev_security_key_legacy }}"
2023-12-15 17:09:42 +01:00
2023-10-03 16:32:13 +02:00
- name : Install the docker compose file
ansible.builtin.template :
src : docker-compose.yml.j2
2023-10-06 12:21:36 +02:00
dest : '{{ is_registry_compose_dir }}/is-registry-docker-compose.yml'
2023-10-03 16:32:13 +02:00
owner : root
group : root
mode : 0400
- name : Install the GHNConfig.xml
ansible.builtin.template :
src : GHNConfig.xml.j2
2023-10-06 12:21:36 +02:00
dest : "{{ is_registry_compose_dir }}/GHNConfig.xml"
2023-10-03 16:32:13 +02:00
owner : root
group : root
mode : 0400
- name : Install the jndi-config.xml
ansible.builtin.template :
src : jndi-config.xml.j2
2023-10-06 12:21:36 +02:00
dest : "{{ is_registry_compose_dir }}/jndi-config.xml"
2023-10-03 16:32:13 +02:00
owner : root
group : root
mode : 0400
- name : Install the server-config.wsdd
ansible.builtin.template :
src : server-config.wsdd.j2
2023-10-06 12:21:36 +02:00
dest : "{{ is_registry_compose_dir }}/server-config.wsdd"
2023-10-03 16:32:13 +02:00
owner : root
group : root
mode : 0400
2023-11-28 10:39:05 +01:00
- name : Install the ServiceMap.xml
ansible.builtin.template :
src : ServiceMap.xml.j2
dest : "{{ is_registry_compose_dir }}/ServiceMap_{{ start_scopes }}.xml"
owner : root
group : root
mode : 0400
2023-10-03 16:32:13 +02:00
- name : Create the secret for GHNConfig.xml
community.docker.docker_secret :
2023-11-17 13:18:45 +01:00
name : "{{ service_prefix }}-ghn-config-{{ scope_name }}"
2023-10-06 12:21:36 +02:00
data_src : '{{ is_registry_compose_dir }}/GHNConfig.xml'
2023-10-03 16:32:13 +02:00
state : present
- name : Create the secret for jndi-config.xml
community.docker.docker_secret :
2023-11-17 13:18:45 +01:00
name : "{{ service_prefix }}-jndi-config-{{ scope_name }}"
2023-10-06 12:21:36 +02:00
data_src : '{{ is_registry_compose_dir }}/jndi-config.xml'
2023-10-03 16:32:13 +02:00
state : present
- name : Create the secret for server-config.wsdd
community.docker.docker_secret :
2023-11-17 13:18:45 +01:00
name : "{{ service_prefix }}-server-config-{{ scope_name }}"
2023-10-06 12:21:36 +02:00
data_src : '{{ is_registry_compose_dir }}/server-config.wsdd'
2023-10-03 16:32:13 +02:00
state : present
2023-11-28 10:39:05 +01:00
- name : Create the secret for ServiceMap.xml
community.docker.docker_secret :
name : "{{ service_prefix }}-ServiceMap-{{ scope_name }}"
data_src : "{{ is_registry_compose_dir }}/ServiceMap_{{ start_scopes }}.xml"
state : present
2023-12-14 15:16:49 +01:00
- name : Install the gcube keys
2023-11-02 13:55:50 +01:00
get_url : url={{ item.url }} dest={{ is_registry_compose_dir }}/{{ item.name }} owner=root group=root mode=0600
2023-12-15 17:09:42 +01:00
with_items : "{{ gcube_security_keys }}"
2023-11-02 13:55:50 +01:00
2023-12-14 15:16:49 +01:00
- name : Create the the gcube keys
2023-11-02 13:55:50 +01:00
community.docker.docker_secret :
name : "{{ item.name }}"
data_src : '{{ is_registry_compose_dir }}/{{ item.name }}'
state : present
2023-12-15 17:09:42 +01:00
with_items : "{{ gcube_security_keys }}"
2023-11-02 13:55:50 +01:00
2023-12-14 15:16:49 +01:00
- name : Install the legacy gcube key
2023-11-02 13:55:50 +01:00
get_url : url={{ item.url }} dest={{ is_registry_compose_dir }}/{{ item.name }} owner=root group=root mode=0600
2023-12-15 17:09:42 +01:00
with_items : "{{ gcube_security_key_legacy }}"
2023-11-02 13:55:50 +01:00
2023-12-14 15:16:49 +01:00
- name : Create the the legacy gcube keys
2023-11-02 13:55:50 +01:00
community.docker.docker_secret :
2023-12-14 15:16:49 +01:00
name : gcube-legacy-security-key
2023-11-02 13:55:50 +01:00
data_src : '{{ is_registry_compose_dir }}/{{ item.name }}'
state : present
2023-12-15 17:09:42 +01:00
with_items : "{{ gcube_security_key_legacy }}"
2023-11-02 13:55:50 +01:00
2023-10-03 16:32:13 +02:00
- name : Start the project stack on Docker Swarm
community.docker.docker_stack :
2023-10-06 12:21:36 +02:00
name : '{{ is_registry_docker_stack_name }}'
2023-10-03 16:32:13 +02:00
state : present
compose :
2024-01-23 19:52:30 +01:00
- '{{ is_registry_compose_dir }}/is-registry-docker-compose.yml'
register : result
tags :
- deploy
- name : Print info on stack
ansible.builtin.debug :
msg : "{{ result.stdout }}"
tags :
- deploy
- name : Print URL to portainer
ansible.builtin.debug :
msg : |
You can access the stack at :
https://portainer.cloud.d4science.org/#!/1/docker/stacks/{{ is_registry_docker_stack_name }}?type=1®ular=false&external=true&orphaned=false"
tags :
- deploy