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 %}