Vendor Galaxy Roles and Collections
This commit is contained in:
parent
c1e1897cda
commit
2aed20393f
15 changed files with 387444 additions and 2 deletions
19
ansible_collections/debops/debops/roles/minio/COPYRIGHT
Normal file
19
ansible_collections/debops/debops/roles/minio/COPYRIGHT
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
debops.minio - Install MinIO, Amazon S3 Compatible Object Storage
|
||||
|
||||
Copyright (C) 2019 Maciej Delmanowski <drybjed@gmail.com>
|
||||
Copyright (C) 2019 DebOps <https://debops.org/>
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
This Ansible role is part of DebOps.
|
||||
|
||||
DebOps is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 3, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
DebOps is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DebOps. If not, see https://www.gnu.org/licenses/.
|
||||
503
ansible_collections/debops/debops/roles/minio/defaults/main.yml
Normal file
503
ansible_collections/debops/debops/roles/minio/defaults/main.yml
Normal file
|
|
@ -0,0 +1,503 @@
|
|||
---
|
||||
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
|
||||
|
||||
# .. Copyright (C) 2019 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# .. Copyright (C) 2019 DebOps <https://debops.org/>
|
||||
# .. SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
# .. _minio__ref_defaults:
|
||||
|
||||
# debops.minio default variables
|
||||
# ==============================
|
||||
|
||||
# .. contents:: Sections
|
||||
# :local:
|
||||
#
|
||||
# .. include:: ../../../../includes/global.rst
|
||||
|
||||
|
||||
# UNIX environment [[[
|
||||
# --------------------
|
||||
|
||||
# .. envvar:: minio__user [[[
|
||||
#
|
||||
# The name of the UNIX system account used by the MinIO service.
|
||||
minio__user: 'minio'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__group [[[
|
||||
#
|
||||
# The name of the UNIX system group used by the MinIO service.
|
||||
minio__group: 'minio'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__additional_groups [[[
|
||||
#
|
||||
# List of additional UNIX groups to add to the MinIO UNIX account, required for
|
||||
# access to additional resources.
|
||||
minio__additional_groups: '{{ ["ssl-cert"] if minio__pki_enabled | bool else [] }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__home [[[
|
||||
#
|
||||
# The absolute path of the MinIO UNIX account home directory.
|
||||
minio__home: '{{ (ansible_local.fhs.home | d("/var/local"))
|
||||
+ "/" + minio__user }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__shell [[[
|
||||
#
|
||||
# The UNIX shell used by the MinIO account.
|
||||
minio__shell: '/usr/sbin/nologin'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__comment [[[
|
||||
#
|
||||
# The GECOS field set on the MinIO UNIX account.
|
||||
minio__comment: 'MinIO'
|
||||
# ]]]
|
||||
# ]]]
|
||||
# Go application deployment [[[
|
||||
# -----------------------------
|
||||
|
||||
# These variables control how the :command:`minio` binary is installed on the
|
||||
# host. The installation is performed by the :ref:`debops.golang` role, refer
|
||||
# to its documentation for details. The installation definition can be found in
|
||||
# the :envvar:`minio__golang__dependent_packages` variable.
|
||||
|
||||
# .. envvar:: minio__upstream_gpg_key [[[
|
||||
#
|
||||
# The fingerprint of the GPG key which is used to sign the MinIO releases. It
|
||||
# will be used to verify the downloaded signature file as well as the
|
||||
# :command:`git` tags in the source repository.
|
||||
minio__upstream_gpg_key: '4405 F3F0 DDBA 1B9E 68A3 1D25 12C7 4390 F9AA C728'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__upstream_type [[[
|
||||
#
|
||||
# Specify the method which should be used to install MinIO binary. Either
|
||||
# ``url`` to download the configured binary directly and virify it using the
|
||||
# specified GPG key, or ``git`` to clone the MinIO :command:`git` repository
|
||||
# and build the specified version from source.
|
||||
minio__upstream_type: 'url'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__upstream_upgrade [[[
|
||||
#
|
||||
# Enable or disable automatic upgrades of MinIO downloaded from upstream.
|
||||
# This does not affect installations built from the :command:`git` repository.
|
||||
#
|
||||
# MinIO is updated quite frequently. Remember that already downloaded MinIO
|
||||
# releases are not removed automatically; check the download directory (by
|
||||
# default :file:`/var/local/_golang/go/src/releases/linux-amd64/minio/` ) and
|
||||
# remove old releases.
|
||||
minio__upstream_upgrade: False
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__upstream_url_mirror [[[
|
||||
#
|
||||
# The base URL of the MinIO download page, should end with the ``/`` character.
|
||||
minio__upstream_url_mirror: 'https://dl.min.io/server/minio/release/'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__upstream_platform [[[
|
||||
#
|
||||
# Specify the OS type and platform architecture to use for installation. The
|
||||
# list of supported architectures and OS types can be found on the
|
||||
# https://dl.min.io/server/minio/release/ page.
|
||||
minio__upstream_platform: 'linux-amd64'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__upstream_url_release [[[
|
||||
#
|
||||
# The version of MinIO to download from upstream on a given host. You should
|
||||
# specify the ``RELEASE.YYYY-MM-DDTHH-MM-SSZ`` tagged release number.
|
||||
#
|
||||
# Available MinIO releases: https://github.com/minio/minio/releases
|
||||
minio__upstream_url_release: '{{ minio__env_upstream_url_release }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__upstream_url_binary [[[
|
||||
#
|
||||
# The path to the MinIO binary on the upstream HTTPS server, relative to the OS
|
||||
# type and platform directory.
|
||||
minio__upstream_url_binary: '{{ "archive/minio." + minio__upstream_url_release }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__upstream_git_repository [[[
|
||||
#
|
||||
# The URL of the upstream :command:`git` repository which contains MinIO source
|
||||
# code.
|
||||
minio__upstream_git_repository: 'https://github.com/minio/minio'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__upstream_git_release [[[
|
||||
#
|
||||
# The version of MinIO to build from source on a given host. The build version
|
||||
# depends on the availability of a specific Golang version and other factors.
|
||||
# Latest MinIO versions which can be built on a given OS distribution release
|
||||
# are preferable.
|
||||
minio__upstream_git_release: '{{ "RELEASE.2019-03-27T22-35-21Z"
|
||||
if (ansible_distribution_release in
|
||||
["stretch", "buster", "xenial", "bionic"])
|
||||
else ("RELEASE.2019-09-05T23-24-38Z"
|
||||
if (ansible_distribution_release in
|
||||
["bullseye"])
|
||||
else minio__upstream_url_release) }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__binary [[[
|
||||
#
|
||||
# Absolute path to the :command:`minio` Go binary installed on the host.
|
||||
# See the :ref:`debops.golang` role for more details.
|
||||
minio__binary: '{{ ansible_local.golang.binaries["minio"]
|
||||
if (ansible_local.golang.binaries | d() and
|
||||
ansible_local.golang.binaries.minio | d())
|
||||
else "" }}'
|
||||
# ]]]
|
||||
# ]]]
|
||||
# Filesystem layout [[[
|
||||
# ---------------------
|
||||
|
||||
# .. envvar:: minio__config_dir [[[
|
||||
#
|
||||
# The directory which contains MinIO tenant configuration files with
|
||||
# environment variables for each MinIO instance.
|
||||
minio__config_dir: '/etc/minio'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__volumes_dir [[[
|
||||
#
|
||||
# The directory which contains MinIO volumes. If not specified otherwise, each
|
||||
# MinIO tenant will have its volume subdirectory created in this directory.
|
||||
minio__volumes_dir: '/srv/minio'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__volumes [[[
|
||||
#
|
||||
# List of directories in the filesystem which should be created to contain
|
||||
# MinIO volumes, defined on all hosts in the Ansible inventory.
|
||||
# You can specify a relative path which will be created under
|
||||
# the :envvar:`minio__volumes_dir` directory, or an absolute filesystem path.
|
||||
minio__volumes: []
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__group_volumes [[[
|
||||
#
|
||||
# List of directories in the filesystem which should be created to contain
|
||||
# MinIO volumes, defined on hosts in a specific Ansible inventory group.
|
||||
# You can specify a relative path which will be created under
|
||||
# the :envvar:`minio__volumes_dir` directory, or an absolute filesystem path.
|
||||
minio__group_volumes: []
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__host_volumes [[[
|
||||
#
|
||||
# List of directories in the filesystem which should be created to contain
|
||||
# MinIO volumes, defined on specific hosts in the Ansible inventory.
|
||||
# You can specify a relative path which will be created under
|
||||
# the :envvar:`minio__volumes_dir` directory, or an absolute filesystem path.
|
||||
minio__host_volumes: []
|
||||
# ]]]
|
||||
# ]]]
|
||||
# DNS configuration [[[
|
||||
# ---------------------
|
||||
|
||||
# .. envvar:: minio__fqdn [[[
|
||||
#
|
||||
# The Fully Qualified Domain Name of a host on which MinIO is installed. This
|
||||
# variable is used in the :command:`nginx` configuration to point the upstream
|
||||
# to the local MinIO service when TLS support is enabled, due to the X.509
|
||||
# certificate requirements. If you want to change the FQDN on which
|
||||
# a particular MinIO instance is accessible via :command:`nginx`, use the
|
||||
# ``item.fqdn`` parameter instead.
|
||||
minio__fqdn: '{{ ansible_fqdn }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__domain [[[
|
||||
#
|
||||
# This variable is used in the :command:`nginx` configuration to generate the
|
||||
# FQDN of the MinIO service based on the MinIO instance name and DNS domain
|
||||
# specified here.
|
||||
minio__domain: '{{ ansible_domain }}'
|
||||
# ]]]
|
||||
# ]]]
|
||||
# Transport Layer Security (TLS) support [[[
|
||||
# ------------------------------------------
|
||||
|
||||
# These variables are used to configure the `TLS support in MinIO`__.
|
||||
# The :ref:`debops.pki` Ansible is used to manage the private keys and X.509
|
||||
# certificates.
|
||||
#
|
||||
# .. __: https://docs.min.io/docs/how-to-secure-access-to-minio-server-with-tls.html
|
||||
|
||||
# .. envvar:: minio__pki_enabled [[[
|
||||
#
|
||||
# Enable or disable support for encrypted communication between MinIO instances
|
||||
# via TLS. The support will be enabled in the :ref:`debops.pki` Ansible role is
|
||||
# configured on a host.
|
||||
minio__pki_enabled: '{{ ansible_local.pki.enabled
|
||||
if (ansible_local | d() and ansible_local.pki | d() and
|
||||
ansible_local.pki.enabled is defined)
|
||||
else False }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__pki_base_path [[[
|
||||
#
|
||||
# The absolute path to the directory which contains the PKI realm
|
||||
# subdirectories.
|
||||
minio__pki_base_path: '{{ ansible_local.pki.base_path | d("/etc/pki/realms") }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__pki_realm [[[
|
||||
#
|
||||
# Name of the PKI realm to use by the MinIO service.
|
||||
minio__pki_realm: '{{ ansible_local.pki.realm | d("domain") }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__pki_key [[[
|
||||
#
|
||||
# The name of the file which contains the private key used by the X.509
|
||||
# certificate, relative to the PKI realm directory.
|
||||
minio__pki_key: '{{ ansible_local.pki.key | d("default.key") }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__pki_crt [[[
|
||||
#
|
||||
# The name of the file which contains the X.509 certificate chain used by
|
||||
# MinIO, relative to the PKI realm directory.
|
||||
#
|
||||
# MinIO requires a full X.509 chain with the intermediate CA and the Root
|
||||
# Certificate Authority included. Otherwise you will see the error message
|
||||
# "Unable to load the TLS configuration: Invalid TLS certificate".
|
||||
minio__pki_crt: 'public/full.pem'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__tls_certs_dir [[[
|
||||
#
|
||||
# Absolute path to the directory where the :ref:`debops.minio` role will create
|
||||
# symlinks to the private key and X.509 certificate chain used by MinIO for TLS
|
||||
# connections.
|
||||
minio__tls_certs_dir: '{{ minio__home + "/.minio/certs" }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__tls_private_key [[[
|
||||
#
|
||||
# Absolute path to the private key used by MinIO which will be symlinked as the
|
||||
# :file:`private.key` file inside of the :file:`certs/` directory.
|
||||
minio__tls_private_key: '{{ minio__pki_base_path + "/" + minio__pki_realm + "/" + minio__pki_key }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__tls_public_crt [[[
|
||||
#
|
||||
# Absolute path to the X.509 certificate chain used by MinIO which will be
|
||||
# symlinked as the :file:`public.crt` file inside of the :file:`certs/`
|
||||
# directory.
|
||||
minio__tls_public_crt: '{{ minio__pki_base_path + "/" + minio__pki_realm + "/" + minio__pki_crt }}'
|
||||
# ]]]
|
||||
# ]]]
|
||||
# MinIO instance configuration [[[
|
||||
# --------------------------------
|
||||
|
||||
# The variables below define a list of MinIO instances to manage on
|
||||
# a particular host. See :ref:`minio__ref_instances` for more details.
|
||||
|
||||
# .. envvar:: minio__default_instances [[[
|
||||
#
|
||||
# The list of the default MinIO instances defined by the role.
|
||||
minio__default_instances:
|
||||
|
||||
# This instance configuration overrides the nginx configuration to use the
|
||||
# host's FQDN instead of the instance name. It also supports using host
|
||||
# subdomains as the bucket names.
|
||||
- name: 'main'
|
||||
port: '9000'
|
||||
console_port: '19000'
|
||||
fqdn: '{{ minio__fqdn }}'
|
||||
domain: '{{ minio__fqdn }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__instances [[[
|
||||
#
|
||||
# The list of the MinIO instances which should be defined on all hosts in the
|
||||
# Ansible inventory.
|
||||
minio__instances: []
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__group_instances [[[
|
||||
#
|
||||
# The list of the MinIO instances which should be defined on hosts in
|
||||
# a specific Ansible inventory group.
|
||||
minio__group_instances: []
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__host_instances [[[
|
||||
#
|
||||
# The list of the MinIO instances which should be defined on specific hosts in
|
||||
# the Ansible inventory.
|
||||
minio__host_instances: []
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__combined_instances [[[
|
||||
#
|
||||
# The variable which combines all other MinIO instance variables and is used in
|
||||
# the role tasks and templates.
|
||||
minio__combined_instances: '{{ minio__default_instances
|
||||
+ minio__instances
|
||||
+ minio__group_instances
|
||||
+ minio__host_instances }}'
|
||||
# ]]]
|
||||
# ]]]
|
||||
# Configuration for other Ansible roles [[[
|
||||
# -----------------------------------------
|
||||
|
||||
# .. envvar:: minio__golang__dependent_packages [[[
|
||||
#
|
||||
# Configuration for the :ref:`debops.golang` Ansible role.
|
||||
minio__golang__dependent_packages:
|
||||
|
||||
- name: 'minio'
|
||||
upstream_type: '{{ minio__upstream_type }}'
|
||||
gpg: '{{ minio__upstream_gpg_key }}'
|
||||
url:
|
||||
|
||||
- src: '{{ minio__upstream_url_mirror + minio__upstream_platform + "/" + minio__upstream_url_binary }}'
|
||||
dest: 'releases/{{ minio__upstream_platform }}/minio/minio.{{ minio__upstream_url_release }}'
|
||||
checksum: 'sha256:{{ minio__upstream_url_mirror + minio__upstream_platform + "/" + minio__upstream_url_binary }}.sha256sum'
|
||||
|
||||
- src: '{{ minio__upstream_url_mirror + minio__upstream_platform + "/" + minio__upstream_url_binary + ".asc" }}'
|
||||
dest: 'releases/{{ minio__upstream_platform }}/minio/minio.{{ minio__upstream_url_release }}.asc'
|
||||
gpg_verify: True
|
||||
|
||||
url_binaries:
|
||||
- src: 'releases/{{ minio__upstream_platform }}/minio/minio.{{ minio__upstream_url_release }}'
|
||||
dest: 'minio'
|
||||
notify: 'Restart minio'
|
||||
git:
|
||||
- repo: '{{ minio__upstream_git_repository }}'
|
||||
version: '{{ minio__upstream_git_release }}'
|
||||
build_script: |
|
||||
make clean build
|
||||
git_binaries:
|
||||
- src: '{{ minio__upstream_git_repository.split("://")[1] + "/minio" }}'
|
||||
dest: 'minio'
|
||||
notify: 'Restart minio'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__etc_services__dependent_list [[[
|
||||
#
|
||||
# Configuration for the :ref:`debops.etc_services` Ansible role, generated
|
||||
# dynamically based on the MinIO instance configuration.
|
||||
minio__etc_services__dependent_list: '{{ minio__env_etc_services_dependent_list }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__sysctl__dependent_parameters [[[
|
||||
#
|
||||
# Configuration for the :ref:`debops.sysctl` Ansible role.
|
||||
minio__sysctl__dependent_parameters:
|
||||
|
||||
# Ref: https://github.com/minio/minio/tree/master/docs/deployment/kernel-tuning
|
||||
- name: 'minio'
|
||||
weight: '80'
|
||||
options:
|
||||
|
||||
- name: 'net.ipv4.tcp_fin_timeout'
|
||||
comment: |
|
||||
A socket left in memory takes approximately 1.5Kb of memory. It makes
|
||||
sense to close the unused sockets preemptively to ensure no memory
|
||||
leakage. This way, even if a peer doesn't close the socket due to
|
||||
some reason, the system itself closes it after a timeout.
|
||||
|
||||
The "tcp_fin_timeout" variable defines this timeout and tells kernel
|
||||
how long to keep sockets in the state FIN-WAIT-2. We recommend
|
||||
setting it to 30.
|
||||
value: 30
|
||||
|
||||
- name: 'net.ipv4.tcp_keepalive_probes'
|
||||
comment: |
|
||||
This variable defines the number of unacknowledged probes to be sent
|
||||
before considering a connection dead.
|
||||
value: 5
|
||||
|
||||
- name: 'net.core.wmem_max'
|
||||
comment: |
|
||||
This parameter sets the max OS send buffer size for all types of
|
||||
connections.
|
||||
value: 540000
|
||||
|
||||
- name: 'net.core.rmem_max'
|
||||
comment: |
|
||||
This parameter sets the max OS receive buffer size for all types of
|
||||
connections.
|
||||
value: 540000
|
||||
|
||||
- name: 'vm.swappiness'
|
||||
comment: |
|
||||
This parameter controls the relative weight given to swapping out
|
||||
runtime memory, as opposed to dropping pages from the system page
|
||||
cache. It takes values from 0 to 100, both inclusive. We recommend
|
||||
setting it to 10.
|
||||
value: 10
|
||||
|
||||
- name: 'vm.dirty_background_ratio'
|
||||
comment: |
|
||||
This is the percentage of system memory that can be filled with dirty
|
||||
pages, i.e. memory pages that still need to be written to disk. We
|
||||
recommend writing the data to the disk as soon as possible. To do
|
||||
this, set the dirty_background_ratio to 1.
|
||||
value: 1
|
||||
|
||||
- name: 'vm.dirty_ratio'
|
||||
comment: |
|
||||
This defines is the absolute maximum amount of system memory that can
|
||||
be filled with dirty pages before everything must get committed to
|
||||
disk.
|
||||
value: 1
|
||||
|
||||
- name: 'kernel.sched_min_granularity_ns'
|
||||
comment: |
|
||||
This parameter decides the minimum time a task will be be allowed to
|
||||
run on CPU before being preempted out. We recommend setting it to
|
||||
10ms.
|
||||
value: 10000000
|
||||
|
||||
- name: 'kernel.sched_wakeup_granularity_ns'
|
||||
comment: |
|
||||
Lowering this parameter improves wake-up latency and throughput for
|
||||
latency critical tasks, particularly when a short duty cycle load
|
||||
component must compete with CPU bound components.
|
||||
value: 15000000
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__sysfs__dependent_attributes [[[
|
||||
#
|
||||
# Configuration for the :ref:`debops.sysfs` Ansible role.
|
||||
minio__sysfs__dependent_attributes:
|
||||
|
||||
- role: 'minio'
|
||||
config:
|
||||
- name: 'transparent_hugepages'
|
||||
state: 'present'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__ferm__dependent_rules [[[
|
||||
#
|
||||
# Configuration for the :ref:`debops.ferm` Ansible role, generated dynamically
|
||||
# based on the MinIO instance configuration.
|
||||
minio__ferm__dependent_rules: '{{ minio__env_ferm_dependent_rules }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__nginx__dependent_upstreams [[[
|
||||
#
|
||||
# Upstream configuration for the :ref:`debops.nginx` Ansible role, generated
|
||||
# dynamically based on the MinIO instance configuration.
|
||||
minio__nginx__dependent_upstreams: '{{ minio__env_nginx_dependent_upstreams }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: minio__nginx__dependent_servers [[[
|
||||
#
|
||||
# Server configuration for the :ref:`debops.nginx` Ansible role, generated
|
||||
# dynamically based on the MinIO instance configuration.
|
||||
minio__nginx__dependent_servers: '{{ minio__env_nginx_dependent_servers }}'
|
||||
# ]]]
|
||||
# ]]]
|
||||
32
ansible_collections/debops/debops/roles/minio/meta/main.yml
Normal file
32
ansible_collections/debops/debops/roles/minio/meta/main.yml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
# Copyright (C) 2019 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2019 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
# Ensure that custom Ansible plugins and modules included in the main DebOps
|
||||
# collection are available to roles in other collections.
|
||||
collections: [ 'debops.debops' ]
|
||||
|
||||
dependencies: []
|
||||
|
||||
galaxy_info:
|
||||
|
||||
author: 'Maciej Delmanowski'
|
||||
description: 'Install and manage MinIO, an S3 compatible storage service'
|
||||
company: 'DebOps'
|
||||
license: 'GPL-3.0-only'
|
||||
min_ansible_version: '2.7.0'
|
||||
platforms:
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- xenial
|
||||
- bionic
|
||||
- name: Debian
|
||||
versions:
|
||||
- stretch
|
||||
- buster
|
||||
- bullseye
|
||||
galaxy_tags:
|
||||
- s3
|
||||
- storage
|
||||
- minio
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
# Copyright (C) 2019 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2019 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
# Role: minio
|
||||
# Package: minio
|
||||
# Version: master
|
||||
|
||||
version=4
|
||||
https://github.com/minio/minio/tags .*/(RELEASE\..+)\.tar\.gz
|
||||
174
ansible_collections/debops/debops/roles/minio/tasks/main.yml
Normal file
174
ansible_collections/debops/debops/roles/minio/tasks/main.yml
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
---
|
||||
# Copyright (C) 2019 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2019 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
- name: Import custom Ansible plugins
|
||||
ansible.builtin.import_role:
|
||||
name: 'ansible_plugins'
|
||||
|
||||
- name: Import DebOps global handlers
|
||||
ansible.builtin.import_role:
|
||||
name: 'global_handlers'
|
||||
|
||||
- name: Import DebOps secret role
|
||||
ansible.builtin.import_role:
|
||||
name: 'secret'
|
||||
|
||||
- name: Create required UNIX system group
|
||||
ansible.builtin.group:
|
||||
name: '{{ minio__group }}'
|
||||
state: 'present'
|
||||
system: True
|
||||
|
||||
- name: Create required UNIX system account
|
||||
ansible.builtin.user:
|
||||
name: '{{ minio__user }}'
|
||||
group: '{{ minio__group }}'
|
||||
groups: '{{ minio__additional_groups }}'
|
||||
append: True
|
||||
home: '{{ minio__home }}'
|
||||
comment: '{{ minio__comment }}'
|
||||
shell: '{{ minio__shell }}'
|
||||
state: 'present'
|
||||
system: True
|
||||
|
||||
- name: Create required application directories
|
||||
ansible.builtin.file:
|
||||
path: '{{ item.path }}'
|
||||
state: 'directory'
|
||||
owner: '{{ minio__user }}'
|
||||
group: '{{ minio__group }}'
|
||||
mode: '{{ item.mode }}'
|
||||
loop:
|
||||
|
||||
- path: '{{ minio__config_dir }}'
|
||||
mode: '0750'
|
||||
|
||||
- path: '{{ minio__volumes_dir }}'
|
||||
mode: '0750'
|
||||
|
||||
- path: '{{ minio__tls_certs_dir }}'
|
||||
mode: '0700'
|
||||
|
||||
- name: Create volume directories
|
||||
ansible.builtin.file:
|
||||
path: '{{ (""
|
||||
if ((item.path | d(item)).startswith("/"))
|
||||
else (minio__volumes_dir + "/"))
|
||||
+ (item.path | d(item)) }}'
|
||||
state: 'directory'
|
||||
owner: '{{ minio__user }}'
|
||||
group: '{{ minio__group }}'
|
||||
mode: '0750'
|
||||
loop: '{{ minio__volumes + minio__group_volumes + minio__host_volumes }}'
|
||||
when: item.state | d('present') not in ['absent', 'ignore', 'init']
|
||||
|
||||
- name: Symlink TLS files to MinIO home directory
|
||||
ansible.builtin.file:
|
||||
path: '{{ item.path }}'
|
||||
src: '{{ item.src }}'
|
||||
mode: '{{ item.mode }}'
|
||||
state: 'link'
|
||||
loop:
|
||||
- path: '{{ minio__tls_certs_dir + "/private.key" }}'
|
||||
src: '{{ minio__tls_private_key }}'
|
||||
mode: '0640'
|
||||
|
||||
- path: '{{ minio__tls_certs_dir + "/public.crt" }}'
|
||||
src: '{{ minio__tls_public_crt }}'
|
||||
mode: '0644'
|
||||
when: minio__pki_enabled | bool
|
||||
|
||||
- name: Install systemd configuration files
|
||||
ansible.builtin.template:
|
||||
src: '{{ item }}.j2'
|
||||
dest: '/{{ item }}'
|
||||
mode: '0644'
|
||||
loop:
|
||||
- 'etc/systemd/system/minio.service'
|
||||
- 'etc/systemd/system/minio@.service'
|
||||
notify: [ 'Reload service manager' ]
|
||||
|
||||
- name: Reload systemd daemon if required
|
||||
ansible.builtin.meta: 'flush_handlers'
|
||||
|
||||
- name: Stop and disable MinIO instances if requested
|
||||
ansible.builtin.systemd:
|
||||
name: 'minio@{{ item.name }}.service'
|
||||
state: 'stopped'
|
||||
enabled: False
|
||||
loop: '{{ minio__combined_instances | debops.debops.parse_kv_items }}'
|
||||
when: ansible_service_mgr == 'systemd' and
|
||||
item.name | d() and item.state | d('present') in ['absent']
|
||||
no_log: '{{ debops__no_log | d(True) }}'
|
||||
|
||||
- name: Remove MinIO instance configuration files if requested
|
||||
ansible.builtin.file:
|
||||
path: '{{ minio__config_dir + "/" + item.name }}'
|
||||
state: 'absent'
|
||||
loop: '{{ minio__combined_instances | debops.debops.parse_kv_items }}'
|
||||
when: item.name | d() and item.state | d('present') in ['absent']
|
||||
no_log: '{{ debops__no_log | d(True) }}'
|
||||
|
||||
- name: Generate MinIO instance configuration files
|
||||
ansible.builtin.template:
|
||||
src: 'etc/minio/instance.j2'
|
||||
dest: '{{ minio__config_dir + "/" + item.name }}'
|
||||
owner: '{{ minio__user }}'
|
||||
group: '{{ minio__group }}'
|
||||
mode: '0640'
|
||||
loop: '{{ minio__combined_instances | debops.debops.parse_kv_items }}'
|
||||
register: minio__register_instance_config
|
||||
when: item.name | d() and item.port | d() and
|
||||
item.state | d('present') not in ['absent', 'ignore', 'init']
|
||||
no_log: '{{ debops__no_log | d(True) }}'
|
||||
|
||||
- name: Start and enable MinIO instances
|
||||
ansible.builtin.systemd:
|
||||
name: 'minio@{{ item.name }}.service'
|
||||
state: 'started'
|
||||
enabled: True
|
||||
loop: '{{ minio__combined_instances | debops.debops.parse_kv_items }}'
|
||||
when: ansible_service_mgr == 'systemd' and
|
||||
item.name | d() and item.port | d() and
|
||||
item.state | d('present') not in ['absent', 'ignore', 'init']
|
||||
no_log: '{{ debops__no_log | d(True) }}'
|
||||
|
||||
- name: Start and enable MinIO service
|
||||
ansible.builtin.systemd:
|
||||
name: 'minio.service'
|
||||
state: 'started'
|
||||
enabled: True
|
||||
when: ansible_service_mgr == 'systemd'
|
||||
|
||||
- name: Restart MinIO instances if configuration was modified
|
||||
ansible.builtin.systemd: # noqa no-handler
|
||||
name: 'minio@{{ item.item.name }}.service'
|
||||
state: 'restarted'
|
||||
loop: '{{ minio__register_instance_config.results }}'
|
||||
when: item is changed
|
||||
|
||||
- name: Install PKI hook script
|
||||
ansible.builtin.template:
|
||||
src: 'etc/pki/hooks/minio.j2'
|
||||
dest: '/etc/pki/hooks/minio'
|
||||
mode: '0755'
|
||||
when: ansible_service_mgr == 'systemd' and minio__pki_enabled | bool
|
||||
|
||||
- name: Make sure that Ansible local facts directory exists
|
||||
ansible.builtin.file:
|
||||
path: '/etc/ansible/facts.d'
|
||||
state: 'directory'
|
||||
mode: '0755'
|
||||
|
||||
- name: Save MinIO local facts
|
||||
ansible.builtin.template:
|
||||
src: 'etc/ansible/facts.d/minio.fact.j2'
|
||||
dest: '/etc/ansible/facts.d/minio.fact'
|
||||
mode: '0755'
|
||||
notify: [ 'Refresh host facts' ]
|
||||
tags: [ 'meta::facts' ]
|
||||
|
||||
- name: Update Ansible facts if they were modified
|
||||
ansible.builtin.meta: 'flush_handlers'
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
# Copyright (C) 2019 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2019 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
- name: Prepare minio environment
|
||||
ansible.builtin.set_fact:
|
||||
minio__env_upstream_url_release: '{{ ansible_local.minio.release_tag
|
||||
if (ansible_local.minio.release_tag | d() and
|
||||
ansible_local.minio.release_tag.startswith("RELEASE.") and
|
||||
not minio__upstream_upgrade | bool)
|
||||
else (lookup("url",
|
||||
(minio__upstream_url_mirror + minio__upstream_platform
|
||||
+ "/minio.sha256sum"))
|
||||
| regex_search("minio\.RELEASE\..+$")
|
||||
| regex_replace("^minio\.", "")) }}'
|
||||
minio__env_etc_services_dependent_list: '{{ lookup("template",
|
||||
"lookup/minio__env_etc_services_dependent_list.j2",
|
||||
convert_data=False) | from_yaml }}'
|
||||
minio__env_ferm_dependent_rules: '{{ lookup("template",
|
||||
"lookup/minio__env_ferm_dependent_rules.j2",
|
||||
convert_data=False) | from_yaml }}'
|
||||
minio__env_nginx_dependent_upstreams: '{{ lookup("template",
|
||||
"lookup/minio__env_nginx_dependent_upstreams.j2",
|
||||
convert_data=False) | from_yaml }}'
|
||||
minio__env_nginx_dependent_servers: '{{ lookup("template",
|
||||
"lookup/minio__env_nginx_dependent_servers.j2",
|
||||
convert_data=False) | from_yaml }}'
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
#!{{ ansible_python['executable'] }}
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (C) 2019 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2019 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
# {{ ansible_managed }}
|
||||
|
||||
from __future__ import print_function
|
||||
from json import loads, dumps
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
|
||||
def cmd_exists(cmd):
|
||||
return any(
|
||||
os.access(os.path.join(path, cmd), os.X_OK)
|
||||
for path in os.environ["PATH"].split(os.pathsep)
|
||||
)
|
||||
|
||||
|
||||
output = {'installed': cmd_exists('minio')}
|
||||
|
||||
try:
|
||||
minio_version_stdout = subprocess.check_output(
|
||||
["minio", "--version"]
|
||||
).decode('utf-8').strip()
|
||||
except Exception:
|
||||
try:
|
||||
minio_version_stdout = subprocess.check_output(
|
||||
["minio", "version"]
|
||||
).decode('utf-8').strip()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if minio_version_stdout:
|
||||
for line in minio_version_stdout.split('\n'):
|
||||
if line.lower().startswith('minio version '):
|
||||
output['version'] = line.split()[2]
|
||||
output['release_tag'] = line.split()[2]
|
||||
elif line.lower().startswith('version: '):
|
||||
output['version'] = line.split()[1]
|
||||
elif line.lower().startswith('release-tag: '):
|
||||
output['release_tag'] = line.split()[1]
|
||||
elif line.lower().startswith('commit-id: '):
|
||||
output['commit_id'] = line.split()[1]
|
||||
|
||||
print(dumps(output, sort_keys=True, indent=4))
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
{# Copyright (C) 2019-2022 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2019-2022 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#}
|
||||
# {{ ansible_managed }}
|
||||
|
||||
# Configuration for the '{{ item.name }}' MinIO instance
|
||||
|
||||
{% if item.comment | d() %}
|
||||
{{ item.comment | regex_replace('\n$','') | comment(prefix='',postfix='') }}
|
||||
{% endif %}
|
||||
MINIO_TYPE="{{ item.type | d('server') }}"
|
||||
{% if item.volumes is undefined or item.volumes | d() %}
|
||||
MINIO_VOLUMES="{{ (( [ item.volumes ] if (item.volumes is string) else item.volumes) | join(' ')) if item.volumes | d() else (minio__volumes_dir + '/' + item.name) }}"
|
||||
{% endif %}
|
||||
MINIO_SERVER_URL="{{ item.server_url | d('https://' + minio__fqdn + '/') }}"
|
||||
MINIO_OPTS="{{ '--address ' + (item.bind | d('')) + ':' + item.port | string + ' --console-address ' + (item.console_bind | d('')) + ':' + item.console_port | string + ((' ' + item.minio_options) if item.minio_options | d() else '') }}"
|
||||
{% if not (item.standalone | d(False)) | bool %}
|
||||
MINIO_ROOT_USER="{{ item.root_user | d(lookup('password', secret + '/minio/distributed/' + item.name + '/root_user length=20 chars=ascii_letters,digits')) }}"
|
||||
MINIO_ROOT_PASSWORD="{{ item.root_password | d(lookup('password', secret + '/minio/distributed/' + item.name + '/root_password length=32')) }}"
|
||||
{% else %}
|
||||
MINIO_ROOT_USER="{{ item.root_user | d(lookup('password', secret + '/minio/standalone/' + inventory_hostname + '/' + item.name + '/root_user length=20 chars=ascii_letters,digits')) }}"
|
||||
MINIO_ROOT_PASSWORD="{{ item.root_password | d(lookup('password', secret + '/minio/standalone/' + inventory_hostname + '/' + item.name + '/root_password length=32')) }}"
|
||||
{% endif %}
|
||||
{% if item.browser is defined %}
|
||||
MINIO_BROWSER="{{ 'on' if item.browser | bool else 'off' }}"
|
||||
{% endif %}
|
||||
{% if item.domain | d() or item.domains | d() %}
|
||||
MINIO_DOMAIN="{{ ((([ item.domain ] if (item.domain is string) else item.domain) if item.domain | d() else []) + (([ item.domains ] if (item.domains is string) else item.domains) if item.domains | d() else [])) | join(',') }}"
|
||||
{% endif %}
|
||||
{% if item.environment | d() %}
|
||||
{% for key, value in item.environment.items() %}
|
||||
{{ '{}="{}"'.format(key | upper, (value if (value is string) else (value | join(',')))) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (C) 2019 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2019 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
# {{ ansible_managed }}
|
||||
|
||||
# Reload or restart MinIO instances on a certificate state change
|
||||
|
||||
set -o nounset -o pipefail -o errexit
|
||||
|
||||
pki_script_realm="${PKI_SCRIPT_REALM:-}"
|
||||
minio_pki_realm="{{ minio__pki_realm }}"
|
||||
|
||||
# Get list of current realm states
|
||||
read -r -a states <<< "$(echo "${PKI_SCRIPT_STATE:-}" | tr "," " ")"
|
||||
|
||||
if [ -n "${pki_script_realm}" ] && [ -n "${minio_pki_realm}" ] \
|
||||
&& [ "${pki_script_realm}" = "${minio_pki_realm}" ] \
|
||||
&& [[ ${states[*]} ]] ; then
|
||||
|
||||
for state in "${states[@]}" ; do
|
||||
|
||||
if [ "${state}" = "changed-certificate" ] || [ "${state}" = "changed-dhparam" ] ; then
|
||||
|
||||
# Check if current init is systemd
|
||||
if pidof systemd > /dev/null 2>&1 ; then
|
||||
|
||||
minio_state="$(systemctl is-active minio.service)"
|
||||
if [ "${minio_state}" = "active" ] ; then
|
||||
systemctl restart minio.service
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
printf "Warning: sysvinit is not supported\\n"
|
||||
|
||||
fi
|
||||
|
||||
break
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
fi
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
{# Copyright (C) 2019 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2019 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#}
|
||||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description=MinIO service
|
||||
After=network-online.target
|
||||
Documentation=https://docs.min.io
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
ConditionPathExists={{ minio__config_dir }}
|
||||
AssertFileIsExecutable={{ minio__binary }}
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/true
|
||||
ExecReload=/bin/true
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
{# Copyright (C) 2019 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2019 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#}
|
||||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description=MinIO '%i' instance
|
||||
Documentation=https://docs.min.io
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
ConditionPathExists={{ minio__config_dir }}/%i
|
||||
AssertFileIsExecutable={{ minio__binary }}
|
||||
PartOf=minio.service
|
||||
ReloadPropagatedFrom=minio.service
|
||||
Before=minio.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory={{ minio__home }}
|
||||
|
||||
User={{ minio__user }}
|
||||
Group={{ minio__group }}
|
||||
|
||||
EnvironmentFile=-{{ minio__config_dir }}/%i
|
||||
|
||||
ExecStart={{ minio__binary }} $MINIO_TYPE $MINIO_OPTS $MINIO_VOLUMES
|
||||
|
||||
# Let systemd restart this service always
|
||||
Restart=always
|
||||
|
||||
# Specifies the maximum file descriptor number that can be opened by this process
|
||||
LimitNOFILE=65536
|
||||
|
||||
SyslogIdentifier=minio-%i
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=minio.service
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
{# Copyright (C) 2019-2022 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2019-2022 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#}
|
||||
{% set minio__tpl_etc_services_dependent_list = [] %}
|
||||
{% for element in minio__combined_instances | debops.debops.parse_kv_items %}
|
||||
{% if (element.name | d() and element.port | d() and element.state | d('present') not in [ 'ignore', 'init' ]) %}
|
||||
{% set rule = {'name': ('minio-' + element.name),
|
||||
'port': element.port,
|
||||
'protocol': [ 'tcp' ],
|
||||
'state': element.state} %}
|
||||
{% set _ = minio__tpl_etc_services_dependent_list.append(rule) %}
|
||||
{% endif %}
|
||||
{% if (element.name | d() and element.console_port | d() and element.state | d('present') not in [ 'ignore', 'init' ]) %}
|
||||
{% set rule = {'name': ('minio-' + element.name + '-console'),
|
||||
'port': element.console_port,
|
||||
'protocol': [ 'tcp' ],
|
||||
'state': element.state} %}
|
||||
{% set _ = minio__tpl_etc_services_dependent_list.append(rule) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ minio__tpl_etc_services_dependent_list | to_yaml }}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
{# Copyright (C) 2019-2022 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2019-2022 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#}
|
||||
{% set minio__tpl_ferm_dependent_rules = [] %}
|
||||
{% for element in minio__combined_instances | debops.debops.parse_kv_items %}
|
||||
{% if (element.name | d() and element.port | d() and element.state | d('present') not in [ 'ignore', 'init' ]) %}
|
||||
{% set rule = {'type': 'accept',
|
||||
'rule_state': element.state,
|
||||
'dport': [ element.port | string ],
|
||||
'saddr': (( [ element.allow ] if (element.allow is string) else element.allow) if element.allow | d() else []),
|
||||
'accept_any': True,
|
||||
'weight': '50',
|
||||
'by_role': 'debops.minio',
|
||||
'name': ('minio-' + element.name)} %}
|
||||
{% set _ = minio__tpl_ferm_dependent_rules.append(rule) %}
|
||||
{% endif %}
|
||||
{% if (element.name | d() and element.console_port | d() and element.state | d('present') not in [ 'ignore', 'init' ]) %}
|
||||
{% set rule = {'type': 'accept',
|
||||
'rule_state': element.state,
|
||||
'dport': [ element.console_port | string ],
|
||||
'saddr': (( [ element.allow ] if (element.allow is string) else element.allow) if element.allow | d() else []),
|
||||
'accept_any': True,
|
||||
'weight': '50',
|
||||
'by_role': 'debops.minio',
|
||||
'name': ('minio-' + element.name + '-console')} %}
|
||||
{% set _ = minio__tpl_ferm_dependent_rules.append(rule) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ minio__tpl_ferm_dependent_rules | to_yaml }}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
{# Copyright (C) 2019 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2019 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#}
|
||||
{% set minio__tpl_nginx_dependent_servers = [] %}
|
||||
{% for element in minio__combined_instances | debops.debops.parse_kv_items %}
|
||||
{% if (element.name | d() and element.port | d() and element.state | d('present') not in [ 'ignore', 'init' ]) %}
|
||||
{% set server = {'name': [ (element.fqdn | d(element.name + '.' + minio__domain)) ]
|
||||
+ ((( ( [ element.domain ] if (element.domain is string) else element.domain)
|
||||
| map('regex_replace', '^(.*)$', '*.\\1')) | list)
|
||||
if element.domain | d() else [])
|
||||
+ ((( ( [ element.domains ] if (element.domains is string) else element.domains)
|
||||
| map('regex_replace', '^(.*)$', '*.\\1')) | list)
|
||||
if element.domains | d() else []),
|
||||
'filename': 'minio-' + element.name,
|
||||
'state': element.state,
|
||||
'type': 'proxy',
|
||||
'options': 'ignore_invalid_headers off;\nclient_max_body_size 0;\nproxy_buffering off;',
|
||||
'proxy_pass': ('https' if minio__pki_enabled | bool else 'http') + '://minio-' + element.name,
|
||||
'proxy_options': 'proxy_http_version 1.1;\nproxy_read_timeout 15m;\nproxy_send_timeout 15m;\nproxy_request_buffering off;'} %}
|
||||
{% set _ = minio__tpl_nginx_dependent_servers.append(server) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ minio__tpl_nginx_dependent_servers | to_yaml }}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
{# Copyright (C) 2019 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2019 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#}
|
||||
{% set minio__tpl_nginx_dependent_upstreams = [] %}
|
||||
{% for element in minio__combined_instances | debops.debops.parse_kv_items %}
|
||||
{% if (element.name | d() and element.port | d() and element.state | d('present') not in [ 'ignore', 'init' ]) %}
|
||||
{% set upstream = {'name': 'minio-' + element.name,
|
||||
'state': element.state,
|
||||
'server': (minio__fqdn if minio__pki_enabled | bool else '127.0.0.1') + ':' + element.port | string} %}
|
||||
{% set _ = minio__tpl_nginx_dependent_upstreams.append(upstream) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ minio__tpl_nginx_dependent_upstreams | to_yaml }}
|
||||
Loading…
Reference in a new issue