ansible-role-epasmed/tasks/main.yml

60 lines
2.3 KiB
YAML
Raw Normal View History

2020-10-23 16:00:26 +02:00
---
2020-10-26 15:48:35 +01:00
- name: Manage the installation of the ePAS configuration of the swarm service
block:
- name: Create the directory where the DB init script is going to be installed
file: dest={{ epas_compose_dir }} state=directory
- name: Install the DB initialization script
template: src=pg-create-user-db.sh.j2 dest={{ epas_compose_dir }}/pg-create-user-db.sh owner=root group=root mode='0555'
run_once: True
when:
- epas_dockerized_db
- epas_docker_db_node == ansible_fqdn
tags: [ 'epas', 'epas_swarm', 'epas_db' ]
- name: Manage the installation of the ePAS configuration of the swarm service
block:
- name: Add the label that will be used as a constraint for the attachments volume
docker_node:
hostname: '{{ epas_docker_attachments_node }}'
labels:
epas_storage: 'attachments'
2020-10-26 16:52:08 +01:00
labels_state: 'merge'
2020-10-26 15:48:35 +01:00
- name: Add the label that will be used as a constraint for the postgresql DB
docker_node:
hostname: '{{ epas_docker_db_node }}'
labels:
epas_pg_data: 'epas_db'
2020-10-26 16:52:08 +01:00
labels_state: 'merge'
2020-10-26 16:55:58 +01:00
when: epas_dockerized_db
2020-10-26 15:48:35 +01:00
- name: Create the directory where the compose file will be placed
file: dest={{ epas_compose_dir }} state=directory owner=root group=root mode=0750
2020-10-26 15:48:35 +01:00
- name: Install the docker compose file
template: src=epas-docker-compose.yml.j2 dest={{ epas_compose_dir }}/docker-epas-stack.yml owner=root group=root mode='0400'
- name: Login into the IIT registry
shell: docker login -u {{ epas_docker_registry_user }} -p {{ epas_docker_registry_pwd }} {{ epas_docker_registry }}
- name: Start the ePAS stack
docker_stack:
name: '{{ epas_docker_stack_name }}'
state: present
with_registry_auth: True
compose:
- '{{ epas_compose_dir }}/docker-epas-stack.yml'
# - name: Connect the ePAS service to the haproxy-public network
# command: docker service update --network-add {{ epas_haproxy_public_net }} {{ item }} --update-delay 30s --update-parallelism 1
# with_items:
# - '{{ epas_docker_stack_name }}_{{ epas_docker_service_server_name }}'
# ignore_errors: True
# when: epas_behind_haproxy
run_once: True
2020-10-26 16:50:06 +01:00
when: docker_swarm_manager_node is defined and docker_swarm_manager_node
2020-10-26 15:48:35 +01:00
tags: [ 'epas', 'epas_swarm', 'epas_server' ]