121 lines
4.1 KiB
YAML
121 lines
4.1 KiB
YAML
---
|
|
- name: shinyproxy_vm | Shinyproxy as a standalone service
|
|
when:
|
|
- ansible_distribution_file_variety == "Debian"
|
|
- ansible_distribution_major_version < '16'
|
|
- shinyproxy_install | bool
|
|
tags: shinyproxy
|
|
block:
|
|
- name: shinyproxy_vm | Create the shinyproxy user
|
|
ansible.builtin.user:
|
|
name: "{{ shinyproxy_user }}"
|
|
home: "{{ shinyproxy_install_dir }}"
|
|
createhome: true
|
|
system: true
|
|
shell: /usr/sbin/nologin
|
|
|
|
- name: shinyproxy_vm | Download the shinyproxy jar
|
|
become: true
|
|
become_user: '{{ shinyproxy_user }}'
|
|
ansible.builtin.get_url:
|
|
url: "{{ shinyproxy_url }}"
|
|
dest: "{{ shinyproxy_install_dir }}"
|
|
mode: "0644"
|
|
|
|
- name: shinyproxy_vm | Set up a symlink to an unversioned app name
|
|
become: true
|
|
become_user: '{{ shinyproxy_user }}'
|
|
ansible.builtin.file:
|
|
src: "{{ shinyproxy_install_dir }}/{{ shinyproxy_file_name }}"
|
|
dest: "{{ shinyproxy_install_dir }}/{{ shinyproxy_app_name }}"
|
|
state: link
|
|
|
|
- name: shinyproxy_vm | Install the shinyproxy configuration file when using version 2.x
|
|
ansible.builtin.template:
|
|
src: shinyproxy-2-conf.yml.j2
|
|
dest: "{{ shinyproxy_install_dir }}/application.yml"
|
|
owner: root
|
|
group: "{{ shinyproxy_user }}"
|
|
mode: "0640"
|
|
notify: Restart shinyproxy
|
|
when: shinyproxy_major_ver == 2
|
|
tags: ['shinyproxy', 'shinyproxy_conf', 'shinyproxy_images']
|
|
|
|
- name: shinyproxy_vm | Install the shinyproxy logrotate configuration
|
|
ansible.builtin.template:
|
|
src: shinyproxy-logrotate.j2
|
|
dest: /etc/logrotate.d/shinyproxy
|
|
owner: root
|
|
group: root
|
|
mode: "0444"
|
|
tags: ['shinyproxy', 'shinyproxy_conf']
|
|
|
|
- name: shinyproxy_vm | Install the upstart init file
|
|
ansible.builtin.template:
|
|
src: upstart-shinyproxy.conf.j2
|
|
dest: /etc/init/shinyproxy.conf
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
when: ansible_service_mgr != 'systemd'
|
|
|
|
- name: shinyproxy_vm | Manage the deb packages installation
|
|
when:
|
|
- ansible_distribution_file_variety == "Debian"
|
|
- ansible_distribution_major_version >= '16'
|
|
- shinyproxy_install | bool
|
|
tags: shinyproxy
|
|
block:
|
|
- name: shinyproxy_vm | Install the shinyproxy deb package
|
|
ansible.builtin.apt:
|
|
pkg: "https://www.shinyproxy.io/downloads/shinyproxy_{{ shinyproxy_version }}_amd64.deb"
|
|
state: present
|
|
cache_valid_time: 1800
|
|
|
|
- name: shinyproxy_vm | Manage the EL packages installation
|
|
when:
|
|
- ansible_distribution_file_variety == "RedHat"
|
|
- shinyproxy_install | bool
|
|
tags: shinyproxy
|
|
block:
|
|
- name: shinyproxy_vm | Install the shinyproxy EL package
|
|
ansible.builtin.yum:
|
|
pkg: "https://www.shinyproxy.io/downloads/shinyproxy_{{ shinyproxy_version }}_x86_64.rpm"
|
|
state: present
|
|
|
|
- name: shinyproxy_vm | Manage the shinyproxy service
|
|
when: shinyproxy_install
|
|
tags: shinyproxy
|
|
block:
|
|
- name: shinyproxy_vm | Ensure that the shinyproxy service is enabled and running
|
|
ansible.builtin.service:
|
|
name: shinyproxy
|
|
state: started
|
|
enabled: true
|
|
|
|
- name: shinyproxy_vm | Create the directory where to install the custom templates, if we want to use them
|
|
ansible.builtin.file:
|
|
dest: "{{ shinyproxy_template_path }}"
|
|
state: directory
|
|
mode: "0755"
|
|
when: shinyproxy_custom_template | bool
|
|
|
|
- name: shinyproxy_vm | Create shinyproxy log directory
|
|
ansible.builtin.file:
|
|
dest: "{{ shinyproxy_log_dir }}"
|
|
state: directory
|
|
owner: shinyproxy
|
|
mode: "0750"
|
|
|
|
- name: shinyproxy_vm | Pull the Docker images for the Shiny apps, when using Docker standalone
|
|
community.docker.docker_image:
|
|
name: "{{ item.docker_image }}"
|
|
pull: true
|
|
state: "{{ item.image_state | default('present') }}"
|
|
force: true
|
|
loop: '{{ shinyproxy_apps }}'
|
|
when:
|
|
- shinyproxy_apps is defined
|
|
- shinyproxy_container_backend == 'docker'
|
|
tags: ['shinyproxy', 'shinyproxy_images']
|