This commit is contained in:
Till! 2020-01-30 14:46:22 +01:00 committed by GitHub
commit 6725be21c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 6 deletions

View File

@ -7,6 +7,8 @@
- ansible_python_version is version_compare('2.6.0', '>=')
- ansible_python_version is version_compare('2.7.9', '<')
- import_tasks: preflight.yml
- include_tasks: install-server.yml
when: minio_install_server

26
tasks/preflight.yml Normal file
View File

@ -0,0 +1,26 @@
---
- name: Validate access key
fail:
msg: "minio_access_key is set but must be at least three characters"
when: minio_access_key|length < 3 and minio_access_key|length != 0
- name: Validate secret key
fail:
msg: "minio_secret_key is set but must be at least 8 characters"
when: minio_secret_key|length < 8 and minio_secret_key|length != 0
- name: Setup __minio_volumes (cluster context)
set_fact:
__minio_volumes: "{{ minio_server_cluster_nodes | join(' ') }}"
when:
minio_server_cluster_nodes|length > 0
- name: Setup __minio_volumes (single node)
set_fact:
__minio_volumes: "{{ minio_server_datadirs | join(' ') }}"
when: minio_server_datadirs|length > 0 and minio_server_cluster_nodes|length == 0
- name: Validate __minio_volumes
fail:
msg: "Please set minio_server_cluster_nodes or minio_server_datadirs"
when: __minio_volumes|length == 0

View File

@ -1,11 +1,8 @@
{{ ansible_managed | comment }}
# Minio local/remote volumes.
{% if minio_server_cluster_nodes | length > 0 %}
MINIO_VOLUMES="{{ minio_server_cluster_nodes | join(' ') }}"
{% else %}
MINIO_VOLUMES="{{ minio_server_datadirs | join(' ') }}"
{% endif %}
MINIO_VOLUMES="{{ __minio_volumes }}"
# Minio cli options.
MINIO_OPTS="--address {{ minio_server_addr }} {{ minio_server_opts }}"

View File

@ -20,7 +20,7 @@ Group={{ minio_group }}
PermissionsStartOnly=true
EnvironmentFile={{ minio_server_envfile }}
ExecStartPre=/bin/bash -c "[ -n \"${MINIO_VOLUMES}\" ] || echo \"Variable MINIO_VOLUMES not set in {{ minio_server_envfile }}\""
#ExecStartPre=/bin/bash -c "[ -n \"${MINIO_VOLUMES}\" ] || echo \"Variable MINIO_VOLUMES not set in {{ minio_server_envfile }}\""
ExecStart={{ minio_server_bin }} server $MINIO_OPTS $MINIO_VOLUMES