You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.7 KiB
YAML

---
- name: Manage the installation of the MEI Generator configuration of the swarm service
block:
- name: Create the compose file destination directory
file:
dest: '{{ mei_generator_compose_dir }}'
state: 'directory'
- name: Fetch the compose file that will be used as a template
become: False
get_url:
url: '{{ mei_generator_compose_url }}'
dest: '/tmp/docker-{{ mei_generator_docker_stack_name }}-stack.yml.j2'
delegate_to: localhost
- name: Install the docker compose file
template:
src: '/tmp/docker-{{ mei_generator_docker_stack_name }}-stack.yml.j2'
dest: '{{ mei_generator_compose_dir }}/docker-{{ mei_generator_docker_stack_name }}-stack.yml'
owner: root
group: root
mode: '0400'
- name: Remove the local copy of the template compose
become: False
file:
dest: '/tmp/docker-{{ mei_generator_docker_stack_name }}-stack.yml.j2'
state: absent
delegate_to: localhost
- name: Add the label that will be used as a constraint for the MySQL DB
docker_node:
hostname: '{{ mei_generator_db_executor }}'
labels:
mei_generator_db_data: 'bc_mei_generator'
labels_state: 'merge'
when: mei_generator_db_executor is defined
- name: Start the MEI Generator stack
docker_stack:
name: '{{ mei_generator_docker_stack_name }}'
state: present
compose:
- '{{ mei_generator_compose_dir }}/docker-{{ mei_generator_docker_stack_name }}-stack.yml'
run_once: True
when: docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool
tags: [ 'mei_generator', 'mei_generator_swarm' ]