Create data directories

Create data directories automatically.
* Add flag to disable automatic creation.
This commit is contained in:
Ben Kochie 2018-06-23 19:07:04 +02:00
parent b373160051
commit 341e3003a8
Failed to extract signature
4 changed files with 26 additions and 2 deletions

View File

@ -16,6 +16,7 @@ minio_server_addr: ":9091"
# Minio server data directories
minio_server_datadirs: [ ]
minio_server_make_datadirs: true
# Additional minio server CLI options
minio_server_opts: ""

View File

@ -3,4 +3,4 @@
- hosts: all
roles:
- { role: ansible-minio,
minio_server_datadirs: [ "/tmp" ] }
minio_server_datadirs: [ "/minio-test" ] }

View File

@ -24,9 +24,20 @@
template:
src: minio.init.j2
dest: "{{ initd_conf_dir }}/minio"
mode: 0755
mode: 0750
when: ansible_service_mgr != "systemd"
- name: create data storage directories
file:
path: "{{ item }}"
state: directory
recurse: true
owner: "{{ minio_user }}"
group: "{{ minio_group }}"
mode: 0750
when: minio_server_make_datadirs
with_items: "{{ minio_server_datadirs }}"
- name: enable and start the minio service
service:
name: minio

View File

@ -25,6 +25,18 @@ def test_minio_installed(File, AnsibleDefaults, minio_bin_var):
assert oct(f.mode) == '0755'
@pytest.mark.parametrize("dirs", [
"/test-minio"
])
def test_directories(host, dirs):
d = host.file(dirs)
assert d.is_directory
assert d.exists
assert d.user == AnsibleDefaults['minio_user']
assert d.group == AnsibleDefaults['minio_group']
assert oct(d.mode) == '0750'
def test_minio_service(Service):
s = Service('minio')