migrated to rustfs, working ansible role
This commit is contained in:
parent
45f604a72a
commit
0ea32c7200
35
compose.yml
35
compose.yml
@ -1,35 +0,0 @@
|
||||
services:
|
||||
minio:
|
||||
image: quay.io/minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
command: server /data
|
||||
networks:
|
||||
- proxy
|
||||
environment:
|
||||
MINIO_ROOT_USER: "${MINIO_USER}"
|
||||
MINIO_ROOT_PASSWORD: "${MINIO_PASSWORD}"
|
||||
healthcheck:
|
||||
test: ["CMD", "mc", "ready", "local"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
volumes:
|
||||
- data:/data
|
||||
labels:
|
||||
traefik.enable: true
|
||||
traefik.http.routers.minio.rule: "Host(`s3.urmel.de`)"
|
||||
traefik.http.routers.minio.tls: true
|
||||
traefik.http.routers.minio.tls.certResolver: hetzner
|
||||
traefik.http.services.minio-https.loadbalancer.server.port: 9000
|
||||
|
||||
|
||||
volumes:
|
||||
data:
|
||||
driver_opts:
|
||||
type: nfs4
|
||||
o: addr=217.100.0.2,rw,noatime,tcp
|
||||
device: ":/mnt/Main/servicesData/s3"
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
name: traefik_exposed
|
||||
external: true
|
||||
15
defaults/main.yml
Normal file
15
defaults/main.yml
Normal file
@ -0,0 +1,15 @@
|
||||
path: /srv/{{ role_name }}
|
||||
|
||||
minio_override: {}
|
||||
minio_defaults:
|
||||
version: "latest"
|
||||
url: ""
|
||||
admin_url: ""
|
||||
user: ""
|
||||
password: ""
|
||||
data_path: ""
|
||||
networkmount:
|
||||
host: ""
|
||||
host_path: ""
|
||||
args: ""
|
||||
type: ""
|
||||
8
handlers/main.yml
Normal file
8
handlers/main.yml
Normal file
@ -0,0 +1,8 @@
|
||||
- name: restart container
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ path }}"
|
||||
project_name: "{{ role_name }}"
|
||||
recreate: "always"
|
||||
services: ["minio"]
|
||||
state: "restarted"
|
||||
when: not _minio_already_restarted
|
||||
20
meta/main.yml
Normal file
20
meta/main.yml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
galaxy_info:
|
||||
author: "Niklas Freese <niklas@urmel.de>"
|
||||
description: minio
|
||||
company: "Urmel Services"
|
||||
license: AGPL-3.0-or-later
|
||||
min_ansible_version: 2.1
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies:
|
||||
- role: traefik
|
||||
32
tasks/main.yml
Normal file
32
tasks/main.yml
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
- name: "set local variables from overrides and defaults"
|
||||
set_fact:
|
||||
minio: "{{ (minio_defaults | combine(minio_override, recursive=True)) if minio_override else minio_defaults }}"
|
||||
|
||||
- name: ensure that path exists
|
||||
file:
|
||||
path: "{{ path }}/config/minio"
|
||||
state: directory
|
||||
|
||||
- name: template docker compose
|
||||
template:
|
||||
src: compose.yml.j2
|
||||
dest: "{{ path }}/compose.yml"
|
||||
|
||||
- import_role:
|
||||
name: storage_mount
|
||||
vars:
|
||||
storage_mount_override:
|
||||
host: "{{ minio.networkmount.host }}"
|
||||
host_path: "{{ minio.networkmount.host_path }}"
|
||||
type: "{{ minio.networkmount.type }}"
|
||||
args: "{{ minio.networkmount.args }}"
|
||||
dest_path: "{{ minio.data_path }}"
|
||||
when: minio.networkmount.host | length > 1
|
||||
|
||||
- name: ensure everything is up
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ path }}"
|
||||
project_name: "{{ role_name }}"
|
||||
recreate: always
|
||||
state: "present"
|
||||
51
templates/compose.yml.j2
Normal file
51
templates/compose.yml.j2
Normal file
@ -0,0 +1,51 @@
|
||||
services:
|
||||
rustfs_perms:
|
||||
image: alpine
|
||||
user: root
|
||||
volumes:
|
||||
- "{{ minio.data_path }}:/fix_path"
|
||||
command: chown -R 10001:10001 /fix_path
|
||||
|
||||
rustfs:
|
||||
image: "rustfs/rustfs:{{ minio.version }}"
|
||||
networks:
|
||||
- proxy
|
||||
environment:
|
||||
RUSTFS_VOLUMES: /data
|
||||
RUSTFS_ADDRESS: 0.0.0.0:9000
|
||||
RUSTFS_CONSOLE_ENABLE: true
|
||||
RUSTFS_CONSOLE_ADDRESS: 0.0.0.0:9001
|
||||
RUSTFS_ACCESS_KEY: "{{ minio.user }}"
|
||||
RUSTFS_SECRET_KEY: "{{ minio.password }}"
|
||||
volumes:
|
||||
- "{{ minio.data_path }}:/data"
|
||||
|
||||
depends_on:
|
||||
rustfs_perms:
|
||||
condition: service_completed_successfully
|
||||
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:9000/health"]
|
||||
interval: 1m30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 20s
|
||||
|
||||
labels:
|
||||
traefik.enable: true
|
||||
traefik.http.routers.rustfs.rule: "Host(`{{ minio.url }}`)"
|
||||
traefik.http.routers.rustfs.tls: true
|
||||
traefik.http.routers.rustfs.tls.certResolver: hetzner
|
||||
traefik.http.routers.rustfs.service: rustfs-https
|
||||
traefik.http.services.rustfs-https.loadbalancer.server.port: 9000
|
||||
|
||||
traefik.http.routers.rustfs-admin.rule: "Host(`{{ minio.admin_url }}`)"
|
||||
traefik.http.routers.rustfs-admin.tls: true
|
||||
traefik.http.routers.rustfs-admin.tls.certResolver: hetzner
|
||||
traefik.http.routers.rustfs-admin.service: rustfs-admin-https
|
||||
traefik.http.services.rustfs-admin-https.loadbalancer.server.port: 9001
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
name: traefik_exposed
|
||||
external: true
|
||||
Loading…
x
Reference in New Issue
Block a user