43 lines
1.4 KiB
YAML
43 lines
1.4 KiB
YAML
---
|
|
- name: Manage the installation of the Ephemera configuration of the swarm
|
|
block:
|
|
- name: Create the compose file destination directory
|
|
file:
|
|
dest: '{{ ephemera_compose_dir }}'
|
|
state: 'directory'
|
|
|
|
- name: Fetch the compose file that will be used as a template
|
|
become: false
|
|
get_url:
|
|
url: '{{ ephemera_compose_url }}'
|
|
dest: '/tmp/{{ ephemera_compose_file_prefix }}-stack.yml.j2'
|
|
delegate_to: localhost
|
|
when: ephemera_remote_compose_file
|
|
|
|
- name: Install the docker compose file
|
|
template:
|
|
src: '{% if ephemera_remote_compose_file %}/tmp/{% endif %}{{ ephemera_compose_file_prefix }}.yml.j2'
|
|
dest: '{{ ephemera_compose_dir }}/{{ ephemera_compose_file_prefix }}-stack.yml'
|
|
owner: root
|
|
group: root
|
|
mode: '0400'
|
|
|
|
- name: Remove the local copy of the template compose
|
|
become: false
|
|
file:
|
|
dest: '/tmp/{{ ephemera_compose_file_prefix }}-stack.yml.j2'
|
|
state: absent
|
|
delegate_to: localhost
|
|
when: ephemera_remote_compose_file
|
|
|
|
- name: Start the Ephemera stack
|
|
docker_stack:
|
|
name: '{{ ephemera_docker_stack_name }}'
|
|
state: present
|
|
compose:
|
|
- '{{ ephemera_compose_dir }}/{{ ephemera_compose_file_prefix }}-stack.yml'
|
|
|
|
run_once: true
|
|
when: docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool
|
|
tags: ['ephemera', 'ephemera_swarm']
|