From cc74bb44f12097a4a713e2364e97b92f59915019 Mon Sep 17 00:00:00 2001
From: Andrea Dell'Amico <adellam@isti.cnr.it>
Date: Fri, 15 Sep 2017 16:16:24 +0200
Subject: [PATCH] shinyproxy: add a task that pulls the new images.

---
 shinyproxy/tasks/main.yml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/shinyproxy/tasks/main.yml b/shinyproxy/tasks/main.yml
index 596ac193..574f13a4 100644
--- a/shinyproxy/tasks/main.yml
+++ b/shinyproxy/tasks/main.yml
@@ -20,7 +20,7 @@
     - name: Install the shinyproxy configuration file
       template: src=shinyproxy-conf.yml.j2 dest={{ shinyproxy_install_dir }}/application.yml owner=root group={{ shinyproxy_user }} mode=0640
       notify: Restart shinyproxy
-      tags: [ 'shinyproxy', 'shinyproxy_conf' ]
+      tags: [ 'shinyproxy', 'shinyproxy_conf', 'shinyproxy_images' ]
 
     - name: Install the shinyproxy logrotate configuration
       template: src=shinyproxy-logrotate.j2 dest=/etc/logrotate.d/shinyproxy owner=root group=root mode=0444
@@ -29,6 +29,12 @@
     - name: Ensure that the shinyproxy service is enabled and running
       service: name=shinyproxy state=started enabled=yes
 
+    - name: Pull the Docker images of shiny apps
+      docker_image: name={{ item.docker_image }} pull=yes state=present
+      with_items: '{{ shinyproxy_apps }}'
+      when: shinyproxy_apps is defined
+      tags: [ 'shinyproxy', 'shinyproxy_images' ]
+
   when: shinyproxy_install
   tags: shinyproxy