ansible-role-mei-generator/tasks/main.yml

49 lines
1.7 KiB
YAML
Raw Normal View History

2021-01-27 14:55:14 +01:00
---
2021-01-27 19:06:39 +01:00
- 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
2021-06-14 18:00:32 +02:00
- 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
2021-06-14 18:00:32 +02:00
2021-01-27 19:06:39 +01:00
- 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' ]