Skip to content
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
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,22 @@ Example:

```yaml
minio_server_datadirs:
- '/minio-data'

minio_server_args:
- 'https://server{1...4}/minio-data'
- '/mnt/disk1'
- '/mnt/disk2'
- '/mnt/disk3'
- '/mnt/disk4'

minio_server_pools:
-
- 'https://server-example-pool1:9000/mnt/disk{1...4}/'
- 'https://server{1...2}-pool1:9000/mnt/disk{1...4}/'
- 'https://server3-pool1:9000/mnt/disk{1...4}/'
- 'https://server4-pool1:9000/mnt/disk{1...4}/'
-
- 'https://server-example-pool2:9000/mnt/disk{1...4}/'
- 'https://server{1...2}-pool2:9000/mnt/disk{1...4}/'
- 'https://server3-pool2:9000/mnt/disk{1...4}/'
- 'https://server4-pool2:9000/mnt/disk{1...4}/'
```

Additional environment variables to be set in MinIO server environment
Expand Down
16 changes: 14 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ minio_client_bin: /usr/local/bin/mc
minio_hostname: "{{ ansible_fqdn }}"

# MinIO release to install.
minio_server_release: "RELEASE.2022-08-25T07-17-05Z"
minio_server_release: "RELEASE.2024-01-05T22-17-24Z"

# MinIO client release to install.
minio_client_release: "RELEASE.2022-08-23T05-45-20Z"
minio_client_release: "RELEASE.2024-01-05T05-04-32Z"

# Runtime user and group for the MinIO server service
minio_user: minio
Expand All @@ -22,6 +22,9 @@ minio_server_envfile: /etc/default/minio
# Directory to store minio config. Will default to minio_user/.minio if not defined
minio_config_dir: "/etc/minio"

# Minio configuration file
minio_server_config_file: "{{ minio_config_dir }}/config.yml"

# Minio server ip/fqdn and port. This makes up the server_addr below
minio_server_ip: ""
minio_server_port: "9000"
Expand All @@ -43,6 +46,14 @@ minio_server_make_datadirs: true
minio_server_args:
- /var/lib/minio

# MinIO server pools list.
minio_server_pools:
-
- 'https://server-example-pool1:9000/mnt/disk{1...4}/'
- 'https://server{1...2}-pool1:9000/mnt/disk{1...4}/'
- 'https://server3-pool1:9000/mnt/disk{1...4}/'
- 'https://server4-pool1:9000/mnt/disk{1...4}/'

# Additional environment variables to be set in minio server environment
minio_server_env_extra: |
MINIO_SITE_REGION=""
Expand All @@ -61,3 +72,4 @@ minio_install_client: true

# TODO: in future
minio_enable_ssl: false
minio_cert_dir: "{{ minio_config_dir }}/certs"
37 changes: 18 additions & 19 deletions tasks/install-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@
_minio_server_download_url: "{{ _minio_server_download_base_url }}/archive/minio.{{ minio_server_release }}"
when: minio_server_release | length > 0

- name: "Append the MinIO console addr to minio_server_opts variable"
set_fact:
minio_server_opts: "--console-address {{ minio_console_addr }} {{ minio_server_opts }}"
when: minio_console_addr | length > 1

- name: "Append the MinIO config directory var to minio_server_opts"
set_fact:
minio_server_opts: "--config-dir {{ minio_config_dir }} {{ minio_server_opts }}"
when: minio_config_dir | length > 0

- name: Create MinIO group
group:
name: "{{ minio_group }}"
Expand Down Expand Up @@ -68,6 +58,24 @@
mode: 0640
notify: restart minio

- name: Create the MinIO config dir
file:
path: "{{ minio_config_dir }}"
owner: "{{ minio_user }}"
group: "{{ minio_group }}"
state: directory
mode: 0755
when: minio_config_dir is defined

- name: Generate the MinIO server config file
template:
src: minio.config.j2
dest: "{{ minio_server_config_file }}"
owner: "{{ minio_user }}"
group: "{{ minio_group }}"
mode: 0640
notify: restart minio

- name: Create the MinIO server systemd config
template:
src: minio.service.j2
Expand All @@ -90,15 +98,6 @@
when: ansible_service_mgr != "systemd"
notify: restart minio

- name: Create the MinIO config dir
file:
path: "{{ minio_config_dir }}"
owner: "{{ minio_user }}"
group: "{{ minio_group }}"
state: directory
mode: 0755
when: minio_config_dir is defined

- name: Enable and start the MinIO service
service:
name: minio
Expand Down
8 changes: 8 additions & 0 deletions templates/minio.config.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: v1
address: '{{ minio_server_addr }}'
rootUser: '{{ minio_root_username }}'
rootPassword: '{{ minio_root_password }}'
console-address: '{{ minio_console_addr }}'
certs-dir: '{{ minio_cert_dir }}'
pools:
{{ minio_server_pools | to_nice_yaml(indent=2) }}
18 changes: 0 additions & 18 deletions templates/minio.env.j2
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
{{ ansible_managed | comment }}

# MinIO local/remote volumes.
{% if minio_server_args | length > 0 %}
MINIO_VOLUMES="{{ minio_server_args | join(' ') }}"
{% endif %}

# MinIO CLI options.
MINIO_OPTS="--address {{ minio_server_addr }} {{ minio_server_opts }}"

{% if minio_root_username %}
# Root User of the server.
MINIO_ROOT_USER="{{ minio_root_username }}"
{% endif %}

{% if minio_root_password %}
# Root Password of the server.
MINIO_ROOT_PASSWORD="{{ minio_root_password }}"
{% endif %}

{{ minio_server_env_extra }}
2 changes: 1 addition & 1 deletion templates/minio.init.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ USER="{{ minio_user }}"
[ -r "{{ minio_server_envfile }}" ] && . {{ minio_server_envfile }}

# Set the DAEMON_ARGS variable
DAEMON_ARGS="server $MINIO_OPTS"
DAEMON_ARGS="server --config {{ minio_server_config_file }}"

# Specifies the maximum file descriptor number that can be opened by this process
ulimit -n 65536
Expand Down
3 changes: 1 addition & 2 deletions templates/minio.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ User={{ minio_user }}
Group={{ minio_group }}

EnvironmentFile=-{{ minio_server_envfile }}
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in {{ minio_server_envfile }}\"; exit 1; fi"
ExecStart={{ minio_server_bin }} server $MINIO_OPTS $MINIO_VOLUMES
ExecStart={{ minio_server_bin }} server --config {{ minio_server_config_file }}

# Let systemd always restart this service, in limits defined by StartLimitIntervalSec and StartLimitBurst.
Restart=always
Expand Down