aboutsummaryrefslogtreecommitdiff
path: root/ansible
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-12-21 10:59:27 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2018-12-21 10:59:27 +0100
commita4bcb2caba43bf10700025f936d21717fa737977 (patch)
tree6e789e75c48308277947a6f13748de38ac4269da /ansible
parent36183579aa48bd9207237ac69d666f0f222cfc1d (diff)
downloadinfra-a4bcb2caba43bf10700025f936d21717fa737977.tar.gz
infra-a4bcb2caba43bf10700025f936d21717fa737977.tar.bz2
infra-a4bcb2caba43bf10700025f936d21717fa737977.tar.xz
infra-a4bcb2caba43bf10700025f936d21717fa737977.zip
o Adding minio.
Diffstat (limited to 'ansible')
-rw-r--r--ansible/group_vars/all/minio.yml1
-rw-r--r--ansible/host_vars/birgitte/minio.yml1
-rw-r--r--ansible/host_vars/malabaricus/minio.yml1
-rw-r--r--ansible/minio.yml11
-rw-r--r--ansible/roles/minio-bin/defaults/main.yml11
-rw-r--r--ansible/roles/minio-bin/tasks/main.yml33
-rw-r--r--ansible/roles/minio-server/handlers/main.yml5
-rw-r--r--ansible/roles/minio-server/tasks/main.yml37
8 files changed, 100 insertions, 0 deletions
diff --git a/ansible/group_vars/all/minio.yml b/ansible/group_vars/all/minio.yml
new file mode 100644
index 0000000..4ea8e89
--- /dev/null
+++ b/ansible/group_vars/all/minio.yml
@@ -0,0 +1 @@
+minio_bin__mc_state: present
diff --git a/ansible/host_vars/birgitte/minio.yml b/ansible/host_vars/birgitte/minio.yml
new file mode 100644
index 0000000..0289be1
--- /dev/null
+++ b/ansible/host_vars/birgitte/minio.yml
@@ -0,0 +1 @@
+minio_bin__minio_state: present
diff --git a/ansible/host_vars/malabaricus/minio.yml b/ansible/host_vars/malabaricus/minio.yml
new file mode 100644
index 0000000..0289be1
--- /dev/null
+++ b/ansible/host_vars/malabaricus/minio.yml
@@ -0,0 +1 @@
+minio_bin__minio_state: present
diff --git a/ansible/minio.yml b/ansible/minio.yml
new file mode 100644
index 0000000..ceaa44d
--- /dev/null
+++ b/ansible/minio.yml
@@ -0,0 +1,11 @@
+- hosts:
+ - birgitte
+ - malabaricus
+ roles:
+ - minio-bin
+ - minio-server
+
+- hosts:
+ - all
+ roles:
+ - minio-bin
diff --git a/ansible/roles/minio-bin/defaults/main.yml b/ansible/roles/minio-bin/defaults/main.yml
new file mode 100644
index 0000000..1103b4b
--- /dev/null
+++ b/ansible/roles/minio-bin/defaults/main.yml
@@ -0,0 +1,11 @@
+minio_bin__minio_path: /usr/local/bin/minio
+minio_bin__minio_state: absent
+minio_bin__minio_version: RELEASE.2018-12-19T23-46-24Z
+minio_bin__minio_sha1: 0895a7270432350c9f5e3e6b0d3f8a049d786076
+
+minio_bin__mc_path: /usr/local/bin/mc
+minio_bin__mc_state: absent
+minio_bin__mc_version: RELEASE.2018-12-19T22-58-03Z
+minio_bin__mc_sha1: d13f5b335ab813cc21e6e7c1dc04a2ea858e6d95
+
+_minio_bin__platform: linux-{{ "amd64" if ansible_architecture == "x86_64" else "arm" }}
diff --git a/ansible/roles/minio-bin/tasks/main.yml b/ansible/roles/minio-bin/tasks/main.yml
new file mode 100644
index 0000000..98c16e9
--- /dev/null
+++ b/ansible/roles/minio-bin/tasks/main.yml
@@ -0,0 +1,33 @@
+- become: yes
+ tags: minio-bin
+ when: minio_bin__minio_state == 'present'
+ get_url:
+ url: "https://dl.minio.io/server/minio/release/{{ _minio_bin__platform }}/archive/minio.{{ minio_bin__minio_version }}"
+ checksum: "sha1:{{ minio_bin__minio_sha1 }}"
+ dest: "{{ minio_bin__minio_path }}"
+ remote_src: yes
+ mode: u=rwx,go=rx
+
+- become: yes
+ tags: minio-bin
+ when: minio_bin__minio_state != 'present'
+ file:
+ path: "{{ minio_bin__minio_path }}"
+ state: absent
+
+- become: yes
+ tags: minio-bin
+ when: minio_bin__mc_state == 'present'
+ get_url:
+ url: "https://dl.minio.io/client/mc/release/{{ _minio_bin__platform }}/archive/mc.{{ minio_bin__mc_version }}"
+ checksum: "sha1:{{ minio_bin__mc_sha1 }}"
+ dest: "{{ minio_bin__mc_path }}"
+ remote_src: yes
+ mode: u=rwx,go=rx
+
+- become: yes
+ tags: minio-bin
+ when: minio_bin__mc_state != 'present'
+ file:
+ path: "{{ minio_bin__mc_path }}"
+ state: absent
diff --git a/ansible/roles/minio-server/handlers/main.yml b/ansible/roles/minio-server/handlers/main.yml
new file mode 100644
index 0000000..77157cb
--- /dev/null
+++ b/ansible/roles/minio-server/handlers/main.yml
@@ -0,0 +1,5 @@
+- name: systemd restart minio
+ become: yes
+ systemd:
+ service: minio
+ state: restarted
diff --git a/ansible/roles/minio-server/tasks/main.yml b/ansible/roles/minio-server/tasks/main.yml
new file mode 100644
index 0000000..2b2602c
--- /dev/null
+++ b/ansible/roles/minio-server/tasks/main.yml
@@ -0,0 +1,37 @@
+- become: yes
+ tags:
+ - minio-server
+ block:
+ - name: /etc/minio directory
+ file:
+ dest: /etc/minio
+ state: directory
+
+ - name: environment file
+ no_log: yes
+ copy:
+ dest: /etc/minio/env
+ content: |
+ MINIO_ACCESS_KEY={{ minio__access_key }}
+ MINIO_SECRET_KEY={{ minio__secret_key }}
+
+ - name: Install systemd service
+ notify: systemd restart minio
+ copy:
+ dest: /etc/systemd/system/minio.service
+ content: |
+ [Unit]
+ After=network.target
+
+ [Service]
+ ExecStart=/usr/local/bin/minio server --config-dir /etc/minio /dropbox/minio
+
+ [Install]
+ WantedBy=multi-user.target
+
+ - name: systemd enable minio
+ become: yes
+ systemd:
+ service: minio
+ state: restarted
+ enabled: yes