From 0a48b027808dbff73b99e4b7924468cfd1b15cb7 Mon Sep 17 00:00:00 2001 From: rslllstefan <83702791+rslllstefan@users.noreply.github.com> Date: Wed, 1 Dec 2021 10:02:53 +0100 Subject: [PATCH] added support to configure the minio config directory (#9) --- README.md | 6 ++++++ defaults/main.yml | 4 ++++ tasks/install-server.yml | 13 +++++++++++++ 3 files changed, 23 insertions(+) diff --git a/README.md b/README.md index 2e899cf..257ab91 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,12 @@ Name and group of the user running the minio server. minio_server_envfile: /etc/default/minio ``` +You can specify the location of your existing config using --config-dir (default: ${HOME}/.minio) + +```yaml +minio_config_dir: "/etc/minio" +``` + Path to the file containing the minio server configuration ENV variables. ```yaml diff --git a/defaults/main.yml b/defaults/main.yml index bda0ef0..fbac730 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -16,9 +16,13 @@ minio_group: minio # Path to the file containing the ENV variables for the MinIO server minio_server_envfile: /etc/default/minio +# Directory to store minio config. Will default to minio_user/.minio if not defined +minio_config_dir: "" + # Minio server ip/fqdn and port. This makes up the server_addr below minio_server_ip: "" minio_server_port: "9091" + # MinIO server listen address minio_server_addr: "{{ minio_server_ip }}:{{ minio_server_port}}" diff --git a/tasks/install-server.yml b/tasks/install-server.yml index fa2f38e..544a23a 100644 --- a/tasks/install-server.yml +++ b/tasks/install-server.yml @@ -18,6 +18,11 @@ 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 }}" @@ -84,6 +89,14 @@ 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 + when: minio_config_dir is defined + - name: Enable and start the MinIO service service: name: minio