ansible-role-shinyproxy/tasks/shinyproxy_docker_service.yml

94 lines
3.5 KiB
YAML

---
- name: shinyproxy_docker_service | Manage the composition of shinyproxy as a docker (non swarm) service
when: shinyproxy_container_backend == 'docker'
tags: ['shinyproxy', 'shinyproxy_docker', 'docker']
block:
- name: shinyproxy_docker_service | Create the directory where the dockerfile and the configuration file will be copied into
ansible.builtin.file:
dest: "{{ shinyproxy_as_docker_src_dir }}"
state: directory
owner: root
group: root
mode: "0750"
- name: shinyproxy_docker_service | Install the shinyproxy configuration file when using version 2.x
ansible.builtin.template:
src: shinyproxy-2-conf.yml.j2
dest: "{{ shinyproxy_as_docker_src_dir }}/application.yml"
owner: root
group: root
mode: "0400"
- name: shinyproxy_docker_service | Install the shinyproxy docker file
ansible.builtin.template:
src: Dockerfile.j2
dest: "{{ shinyproxy_as_docker_src_dir }}/Dockerfile"
owner: root
group: root
mode: "0444"
- name: shinyproxy_docker_service | Install the docker compose file
ansible.builtin.template:
src: shinyproxy-docker-compose.yml.j2
dest: "{{ shinyproxy_as_docker_src_dir }}/docker-compose.yml"
owner: root
group: root
mode: "0400"
- name: shinyproxy_docker_service | Run the docker compose file to start the service
community.docker.docker_compose:
project_src: '{{ shinyproxy_as_docker_src_dir }}'
build: true
- name: shinyproxy_docker_service | Manage the installation of the shinyproxy configuration of the swarm service
when:
- shinyproxy_container_backend == 'docker-swarm'
- shinyproxy_docker_mount_conf_file
tags: ['shinyproxy', 'shinyproxy_swarm', 'docker']
block:
- name: shinyproxy_docker_service | Create the directory where the dockerfile and the configuration file will be copied into
ansible.builtin.file:
dest: "{{ shinyproxy_as_docker_src_dir }}"
state: directory
owner: root
group: root
mode: "0700"
- name: shinyproxy_docker_service | Install the shinyproxy configuration file
ansible.builtin.template:
src: shinyproxy-2-conf.yml.j2
dest: "{{ shinyproxy_as_docker_src_dir }}/application.yml"
owner: root
group: root
mode: "0400"
- name: shinyproxy_docker_service | Manage the docker stack
when:
- docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool
- shinyproxy_container_backend == 'docker-swarm'
tags: ['shinyproxy', 'shinyproxy_swarm', 'docker']
run_once: true
block:
- name: shinyproxy_docker_service | Create the directory where the dockerfile and the configuration file will be copied into
ansible.builtin.file:
dest: "{{ shinyproxy_as_docker_src_dir }}"
state: directory
owner: root
group: root
mode: "0700"
- name: shinyproxy_docker_service | Install the docker compose file
ansible.builtin.template:
src: shinyproxy-docker-compose.yml.j2
dest: "{{ shinyproxy_as_docker_src_dir }}/docker-shinyproxy-stack.yml"
owner: root
group: root
mode: "0400"
- name: shinyproxy_docker_service | Start the shinyproxy stack
community.docker.docker_stack:
name: '{{ shinyproxy_as_docker_stack_name }}'
state: present
compose:
- '{{ shinyproxy_as_docker_src_dir }}/docker-shinyproxy-stack.yml'