From 82355e529a57eccb29275e5a8ebe96d897cee980 Mon Sep 17 00:00:00 2001 From: till Date: Wed, 9 Jan 2019 13:44:47 +0100 Subject: [PATCH] Feature: restart policy and labels - add support to define container's restart policy - add support to add labels to container (resolves: shelleg/ansible-role-portainer#4) --- defaults/main.yml | 2 ++ tasks/install.yml | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 9035ecd..31b0e8d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -5,6 +5,8 @@ configure_registry: false remove_persistent_data: false remove_existing_container: false persistent_data_path: /opt/portainer:/data +container_labels: {} +container_restart_policy: always auth_method: 1 # Portainer version diff --git a/tasks/install.yml b/tasks/install.yml index e097334..fd2d647 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -3,10 +3,11 @@ docker_container: name: portainer image: "portainer/portainer:{{ version }}" + labels: "{{ container_labels | default(omit) }}" state: started detach: true recreate: yes - restart_policy: always + restart_policy: "{{ container_restart_policy }}" published_ports: - "{{ host_port }}:9000" volumes: @@ -16,4 +17,4 @@ - name: Wait for container wait_for: port: "{{ host_port }}" - host: "{{ inventory_hostname }}" \ No newline at end of file + host: "{{ inventory_hostname }}"