#!/usr/bin/env ansible-playbook
---
#==============================================================#
# File      :   minio.yml
# Desc      :   setup minio service
# Ctime     :   2022-11-10
# Mtime     :   2025-12-31
# Path      :   minio.yml
# Docs      :   https://pigsty.io/docs/minio/playbook
# License   :   Apache-2.0 @ https://pigsty.io/docs/about/license/
# Copyright :   2018-2026  Ruohang Feng / Vonng (rh@vonng.com)
#==============================================================#
- name: MINIO
  become: true
  hosts: all
  gather_facts: no
  roles:
    - { role: node_id ,tags: node-id ,when: minio_seq is defined } # get node identity (always)
    - { role: minio   ,tags: minio   ,when: minio_seq is defined }


#---------------------------------------------------------------
# Usage
#---------------------------------------------------------------
# 1. Make sure all nodes/disks are identical, and mounted properly
# 2. Define minio cluster in pigsty.yml
# 3. run ./minio.yml -l <cls> to deploy minio cluster
#
# WARN: re-run this playbook may restart the running minio server
# But it will not destroy or re-create minio data & cluster
#---------------------------------------------------------------
# Tasks
#---------------------------------------------------------------
# minio-id        : generate minio identity
# minio_install   : install minio software
#   - minio_os_user : create os user minio
#   - minio_pkg     : install minio/mcli packages
#   - minio_dir     : create minio directories
# minio_config    : generate minio config
#   - minio_conf    : minio main config
#   - minio_cert    : minio ssl cert
#   - minio_dns     : write minio dns records
# minio_launch    : launch minio service
# minio_register  : register minio target to victoria
# minio_provision : create minio aliases/buckets/users
#   - minio_alias   : create minio client alias
#   - minio_bucket  : create minio buckets
#   - minio_user    : create minio biz users
#---------------------------------------------------------------
...