Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More config options #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ minio_server_addr: ":9091"
minio_server_datadirs: [ ]

# Additional minio server CLI options
# To set config dir, see minio_config_dir
minio_server_opts: ""

# Directory to store minio config. Will default to minio_user/.minio if not defined
minio_config_dir: ""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be also added to README.md with a short explanaition.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's set a default to /etc/minio.


# Minio access and secret keys
minio_access_key: ""
minio_secret_key: ""
Expand Down
8 changes: 8 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
group: "{{ minio_group }}"
shell: /bin/bash

- name: create minio config dir
file:
path: "{{ minio_config_dir }}"
owner: "{{ minio_user }}"
group: "{{ minio_group }}"
state: directory
when: minio_config_dir is defined
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minio_config_dir is always defined (defined in defaults/main.yml). better would be to check if variable is an empty string or not.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This when won't work because it's defined as "" in the defaults. Let's just set a sane default.


- include: server.yml
when: not skip_server

Expand Down
9 changes: 9 additions & 0 deletions tasks/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
mode: 0755
when: ansible_service_mgr != "systemd"

- name: create the minio data directory
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was superseded by #4.

file:
path: "{{ item }}"
owner: "{{ minio_user }}"
group: "{{ minio_group }}"
mode: 0755
state: directory
with_items: "{{ minio_server_datadirs }}"

- name: enable and start the minio service
service:
name: minio
Expand Down
8 changes: 8 additions & 0 deletions templates/minio.env.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
# Minio local/remote volumes.
MINIO_VOLUMES="{{ minio_server_datadirs | join(' ') }}"
# Minio cli options.
{% if minio_config_dir %}
MINIO_OPTS="--config-dir {{ minio_config_dir}} --address {{ minio_server_addr }} {{ minio_server_opts }}"
{% else %}
MINIO_OPTS="--address {{ minio_server_addr }} {{ minio_server_opts }}"
{% endif %}

{% if minio_access_key %}
# Access Key of the server.
Expand All @@ -13,3 +17,7 @@ MINIO_ACCESS_KEY="{{ minio_access_key }}"
# Secret key of the server.
MINIO_SECRET_KEY="{{ minio_secret_key }}"
{% endif %}
{% if minio_region %}
# Region to use
MINIO_REGION="{{ minio_region }}"
{% endif %}