aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles')
-rw-r--r--ansible/roles/minio-server/defaults/main.yml2
-rw-r--r--ansible/roles/minio-server/tasks/main.yml43
2 files changed, 40 insertions, 5 deletions
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