ansible-role-inception/tasks/inception.yml

49 lines
2.1 KiB
YAML

---
- name: Manage the installation of the Inception configuration of the swarm service
block:
- name: Create the data directory used by the inception service, and its subdirectories
file: dest={{ inception_project_service_volume }}/{{ item }} state=directory
with_items:
- 'repository/kb'
- 'plugins'
- name: Install the inception properties file
template: src=settings.properties.j2 dest={{ inception_project_service_volume }}/settings.properties owner=root group=root mode='0444'
when: inception_project_docker_data_node == ansible_fqdn
tags: ['inception_project', 'inception_project_swarm', 'inception_project_service']
- name: Manage the installation of the Inception project Docker stack
block:
- name: Create the directory where the compose file will be installed
file: dest={{ inception_project_compose_dir }} state=directory mode='0750' owner=root group=root
- name: Install the docker compose file
template: src=inception-project-docker-compose.yml.j2 dest={{ inception_project_compose_dir }}/docker-inception-project-stack.yml owner=root group=root mode='0400'
- name: Add the label that will be used as a constraint for the inception data volume
docker_node:
hostname: '{{ inception_project_docker_data_node }}'
labels:
service_data: 'inception_project'
labels_state: 'merge'
- name: Add the label that will be used as a constraint for the MySQL DB
docker_node:
hostname: '{{ inception_project_docker_db_node }}'
labels:
mysql_data: 'inception_project'
labels_state: 'merge'
when: inception_project_db_as_container
- name: Start the Inception project stack
docker_stack:
name: inception-project
state: present
compose:
- '{{ inception_project_compose_dir }}/docker-inception-project-stack.yml'
run_once: True
when: docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool
tags: ['inception_project', 'inception_project_swarm', 'inception_project_service']