From 9325449dbe8c9590d6391bb1603f8f6377c181ae Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 21 Dec 2018 13:11:52 +0100 Subject: minio malabaricus --- ansible/roles/minio-server/defaults/main.yml | 2 ++ ansible/roles/minio-server/tasks/main.yml | 43 ++++++++++++++++++++++++---- 2 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 ansible/roles/minio-server/defaults/main.yml (limited to 'ansible/roles') diff --git a/ansible/roles/minio-server/defaults/main.yml b/ansible/roles/minio-server/defaults/main.yml new file mode 100644 index 0000000..fd2b966 --- /dev/null +++ b/ansible/roles/minio-server/defaults/main.yml @@ -0,0 +1,2 @@ +minio_server__user: minio +minio_server__group: minio diff --git a/ansible/roles/minio-server/tasks/main.yml b/ansible/roles/minio-server/tasks/main.yml index 2b2602c..f2df91d 100644 --- a/ansible/roles/minio-server/tasks/main.yml +++ b/ansible/roles/minio-server/tasks/main.yml @@ -1,19 +1,47 @@ - become: yes tags: - minio-server + vars: + config_dir: /etc/minio + env_path: /etc/minio/env + user: "{{ minio_server__user }}" + group: "{{ minio_server__group }}" block: - name: /etc/minio directory file: - dest: /etc/minio + dest: "{{ env_path | dirname }}" state: directory - name: environment file no_log: yes copy: - dest: /etc/minio/env + dest: "{{ env_path }}" content: | - MINIO_ACCESS_KEY={{ minio__access_key }} - MINIO_SECRET_KEY={{ minio__secret_key }} + MINIO_ACCESS_KEY={{ minio_server__access_key }} + MINIO_SECRET_KEY={{ minio_server__secret_key }} + + - file: + path: "{{ config_dir }}/certs" + owner: "{{ user }}" + group: "{{ group }}" + state: directory + recurse: yes + + - group: + name: "{{ group }}" + system: yes + + - user: + name: "{{ user }}" + group: "{{ group }}" + system: yes + + - file: + path: "{{ item }}" + owner: "{{ user }}" + group: "{{ group }}" + state: directory + with_items: "{{ minio_server__data }}" - name: Install systemd service notify: systemd restart minio @@ -24,10 +52,14 @@ After=network.target [Service] - ExecStart=/usr/local/bin/minio server --config-dir /etc/minio /dropbox/minio + ExecStart=/usr/local/bin/minio server --config-dir {{ config_dir }} {{ minio_server__data | join(' ') }} + EnvironmentFile={{ env_path }} + User={{ user }} + Group={{ group }} [Install] WantedBy=multi-user.target +# ' - name: systemd enable minio become: yes @@ -35,3 +67,4 @@ service: minio state: restarted enabled: yes + daemon_reload: yes -- cgit v1.2.3