--- - name: Manage the installation of the ePASMed configuration of the swarm service block: - name: Create the directory where the DB init script is going to be installed file: dest={{ epasmed_compose_dir }} state=directory - name: Install the DB initialization script template: src=pg-create-user-db.sh.j2 dest={{ epasmed_compose_dir }}/pg-create-user-db.sh owner=root group=root mode='0555' when: - epasmed_dockerized_db - epas_docker_db_node == ansible_fqdn tags: [ 'epasmed', 'epasmed_swarm', 'epasmed_db' ] - name: Manage the installation of the ePASMed configuration of the swarm service block: - name: Add the label that will be used as a constraint for the postgresql DB docker_node: hostname: '{{ epasmed_docker_db_node }}' labels: epas_pg_data: 'epasmed_db' labels_state: 'merge' when: epasmed_dockerized_db - name: Create the directory where the compose file will be placed file: dest={{ epasmed_compose_dir }} state=directory owner=root group=root mode=0750 - name: Install the docker compose file template: src=epasmed-docker-compose.yml.j2 dest={{ epasmed_compose_dir }}/docker-epasmed-stack.yml owner=root group=root mode='0400' - name: Start the ePASMed stack docker_stack: name: '{{ epasmed_docker_stack_name }}' state: present with_registry_auth: True compose: - '{{ epasmed_compose_dir }}/docker-epasmed-stack.yml' when: docker_swarm_manager_node is defined and docker_swarm_manager_node tags: [ 'epasmed', 'epasmed_swarm', 'epasmed_server' ]