From 020008071bfa526a580bb53108d20e833d6a58cb Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Tue, 21 Nov 2023 21:24:27 +0100 Subject: [PATCH] Add portfolio --- playbook.yml | 1 + roles/portfolio/tasks/base.yml | 22 +++++++++++++++ roles/portfolio/tasks/main.yml | 4 +++ roles/portfolio/templates/docker-compose.yml | 28 ++++++++++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 roles/portfolio/tasks/base.yml create mode 100644 roles/portfolio/tasks/main.yml create mode 100644 roles/portfolio/templates/docker-compose.yml diff --git a/playbook.yml b/playbook.yml index a6eaaab..0e7ac93 100644 --- a/playbook.yml +++ b/playbook.yml @@ -21,4 +21,5 @@ - { role: iptables, tags: ["iptables"] } - { role: borg, tags: ["borg"] } - { role: watchtower, tags: ["watchtower"] } + - { role: portfolio, tags: ["portfolio"] } - { role: clean, tags: ["clean"] } diff --git a/roles/portfolio/tasks/base.yml b/roles/portfolio/tasks/base.yml new file mode 100644 index 0000000..f4cd2c2 --- /dev/null +++ b/roles/portfolio/tasks/base.yml @@ -0,0 +1,22 @@ +--- + +- name: Check portfolio directory exist + ansible.builtin.file: + path: portfolio + state: directory + +- name: Copy template conf + ansible.builtin.template: + src: "{{ item.src }}" + dest: "portfolio/{{ item.dest }}" + loop: + - { src: 'docker-compose.yml', dest: 'docker-compose.yml' } + register: portfolio_copy_templates_results + +- name: Update and restart container + community.docker.docker_compose: + project_src: portfolio + state: present + pull: true + restarted: "{{ portfolio_copy_templates_results.changed }}" + become: true \ No newline at end of file diff --git a/roles/portfolio/tasks/main.yml b/roles/portfolio/tasks/main.yml new file mode 100644 index 0000000..c4e7ea2 --- /dev/null +++ b/roles/portfolio/tasks/main.yml @@ -0,0 +1,4 @@ +--- + +- ansible.builtin.import_tasks: base.yml + name: base diff --git a/roles/portfolio/templates/docker-compose.yml b/roles/portfolio/templates/docker-compose.yml new file mode 100644 index 0000000..4172875 --- /dev/null +++ b/roles/portfolio/templates/docker-compose.yml @@ -0,0 +1,28 @@ +version: "3" + +services: + portfolio: + image: gitea.mrdev023.fr/mrdev023/portfolio:latest + container_name: portfolio + restart: unless-stopped + networks: + - proxy + labels: + - traefik.enable=true + - traefik.docker.network=proxy + # HTTP Reverse proxy portfolio + - traefik.http.routers.portfolio-secure.entrypoints=https + - traefik.http.routers.portfolio-secure.rule=Host(`{{ server.domain }}`) + - traefik.http.routers.portfolio-secure.tls=true + - traefik.http.routers.portfolio-secure.tls.certresolver=sslResolver + - traefik.http.routers.portfolio-secure.service=portfolio + - traefik.http.services.portfolio.loadbalancer.server.port=8080 + logging: + driver: loki + options: + loki-url: "https://lokidoki:vEGH5Z5siWgcDkNknvCVzPCyqhHSBJCBjeBRZJvxUP8SdgfxJ6AqCGutCWugGsx5@loki.mrdev023.fr/loki/api/v1/push" + mode: non-blocking + +networks: + proxy: + external: true \ No newline at end of file