From b65e18cfb411584a0ec7cd1e0168ed3abf94f381 Mon Sep 17 00:00:00 2001 From: Sean Demura Date: Thu, 1 Feb 2018 11:18:42 -0500 Subject: [PATCH 1/2] Add more config options Adds some more config options to make this role more useable - config dir support - region support - create data directories with proper permissions --- defaults/main.yml | 4 ++++ tasks/main.yml | 8 ++++++++ templates/minio.env.j2 | 8 ++++++++ 3 files changed, 20 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index ea7ab71..4853c4f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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: "" + # Minio access and secret keys minio_access_key: "" minio_secret_key: "" diff --git a/tasks/main.yml b/tasks/main.yml index 449aaab..c613f44 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -27,6 +27,14 @@ group: "{{ minio_group }}" shell: /bin/bash +- name: create minio config dir + file: + path: /etc/minio + owner: "{{ minio_user }}" + group: "{{ minio_group }}" + state: directory + when: minio_config_dir is defined + - include: server.yml when: not skip_server diff --git a/templates/minio.env.j2 b/templates/minio.env.j2 index 4ad10be..4b464bd 100644 --- a/templates/minio.env.j2 +++ b/templates/minio.env.j2 @@ -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. @@ -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 %} From 1d5809f6eb06a394271ed3d053a880ebc3bc7a49 Mon Sep 17 00:00:00 2001 From: Sean Demura Date: Thu, 1 Feb 2018 11:35:38 -0500 Subject: [PATCH 2/2] Add more server options Adds more server options to make this role a bit more useable - config dir support - region support - create data dirs with permissions --- defaults/main.yml | 4 ++++ tasks/main.yml | 8 ++++++++ tasks/server.yml | 9 +++++++++ templates/minio.env.j2 | 8 ++++++++ 4 files changed, 29 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index ea7ab71..4853c4f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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: "" + # Minio access and secret keys minio_access_key: "" minio_secret_key: "" diff --git a/tasks/main.yml b/tasks/main.yml index 449aaab..27b04c1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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 + - include: server.yml when: not skip_server diff --git a/tasks/server.yml b/tasks/server.yml index 0555c08..a32e051 100644 --- a/tasks/server.yml +++ b/tasks/server.yml @@ -27,6 +27,15 @@ mode: 0755 when: ansible_service_mgr != "systemd" +- name: create the minio data directory + 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 diff --git a/templates/minio.env.j2 b/templates/minio.env.j2 index 4ad10be..4b464bd 100644 --- a/templates/minio.env.j2 +++ b/templates/minio.env.j2 @@ -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. @@ -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 %}