ansible-role-open-asfa/tasks/main.yml

37 lines
1.6 KiB
YAML

---
- name: Manage the installation of the OpenASFA configuration of the swarm service
block:
- name: Create the directory where the DB init script is going to be installed
file: dest={{ open_asfa_compose_dir }} state=directory
- name: Install the DB initialization script
template: src=pg-create-user-db.sh.j2 dest={{ open_asfa_compose_dir }}/pg-create-user-db.sh owner=root group=root mode='0555'
run_once: True
when: open_asfa_docker_db_node is defined and open_asfa_docker_db_node
tags: [ 'open_asfa', 'open_asfa_swarm', 'open_asfa_db' ]
- name: Manage the installation of the OpenASFA configuration of the swarm service
block:
- name: Install the docker compose file
template: src=open-asfa-docker-compose.yml.j2 dest={{ open_asfa_compose_dir }}/docker-open-asfa-stack.yml owner=root group=root mode='0400'
- name: Start the OpenAsfa stack
docker_stack:
name: open-asfa
state: present
compose:
- '{{ open_asfa_compose_dir }}/docker-open-asfa-stack.yml'
- name: Connect the OpenASFA service to the haproxy-public network
command: docker service update --network-add {{ open_asfa_haproxy_public_net }} {{ item }} --update-delay 30s --update-parallelism 1
with_items:
- '{{ open_asfa_docker_stack_name }}_{{ open_asfa_docker_service_server_name }}'
- '{{ open_asfa_docker_stack_name }}_{{ open_asfa_docker_service_client_name }}'
ignore_errors: True
when: open_asfa_behind_haproxy
run_once: True
when: docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool
tags: [ 'open_asfa', 'open_asfa_swarm' ]