From 8b10f40edddefc2d8070e2b303923a53b5a51a98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Fri, 15 Mar 2019 12:38:36 +0100 Subject: [PATCH] Add portainer. --- playbook.yml | 1 + roles/docker/defaults/main.yml | 4 ++++ roles/docker/tasks/services/portainer.yml | 23 +++++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 roles/docker/tasks/services/portainer.yml diff --git a/playbook.yml b/playbook.yml index 18a33bc5..49b352ff 100644 --- a/playbook.yml +++ b/playbook.yml @@ -25,6 +25,7 @@ - websites - ouroboros - mailu + - portainer smtp_host: "postfix" smtp_port: "587" diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 1660a0d2..566ababa 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -65,3 +65,7 @@ mailu: subnet: 192.168.203.0/24 volume_folder: "{{ volume_root_folder }}/mailu" +portainer: + domain: "portainer.{{ base_domain }}" + volume_folder: "{{ volume_root_folder }}/portainer" + diff --git a/roles/docker/tasks/services/portainer.yml b/roles/docker/tasks/services/portainer.yml new file mode 100644 index 00000000..b13dcff7 --- /dev/null +++ b/roles/docker/tasks/services/portainer.yml @@ -0,0 +1,23 @@ +--- + +- name: create portainer volume folder + file: + name: "{{ portainer.volume_folder }}" + state: directory + +- name: run portainer + docker_container: + name: portainer + image: portainer/portainer + restart_policy: always + networks: + - name: external_services + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - "{{ portainer.volume_folder }}:/data" + published_ports: + - 9001:9000 + env: + VIRTUAL_HOST: "{{ portainer.domain }}" + LETSENCRYPT_HOST: "{{ portainer.domain }}" + LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"