Skip to content

Instantly share code, notes, and snippets.

@rssnyder
Created August 14, 2020 00:15
Show Gist options
  • Save rssnyder/c8cf5fc8adba0e7a818895026dc9675d to your computer and use it in GitHub Desktop.
Save rssnyder/c8cf5fc8adba0e7a818895026dc9675d to your computer and use it in GitHub Desktop.
Ansible YAML to install minio on linux-amd64
---
- hosts: minio
become: yes
tasks:
- name: install ufw
apt:
name: ufw
state: latest
update_cache: yes
- name: Enable UFW
ufw:
state: enabled
- name: Set logging
ufw:
logging: 'on'
- name: Allow all access to tcp port 22
ufw:
rule: allow
port: '22'
proto: tcp
- name: Allow all access to minio
ufw:
rule: allow
port: "{{ port }}"
proto: tcp
- name: Deny all others
ufw:
default: deny
- name: Add the minio user
user:
name: minio-user
- name: Download minio
get_url:
url: https://dl.min.io/server/minio/release/linux-amd64/minio
dest: /usr/local/bin/minio
owner: minio-user
group: minio-user
mode: '0700'
- name: Generate minio access key
shell: head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16 ; echo ''
register: minio_key
- name: Generate minio access key
shell: head /dev/urandom | tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' | head -c 32 ; echo ''
register: minio_secret
- name: Set minio options
template:
src: templates/minio.conf.j2
dest: "/etc/default/minio"
owner: minio-user
group: minio-user
mode: '0600'
- name: Download minio service file
get_url:
url: https://raw.githubusercontent.com/minio/minio-service/master/linux-systemd/minio.service
dest: /etc/systemd/system/minio.service
owner: minio-user
group: minio-user
mode: '0700'
- name: Enable minio
systemd:
enabled: yes
name: minio
- name: Start minio
systemd:
state: started
name: minio
@rssnyder
Copy link
Author

You will need to set storage_dir and port as facts for your hosts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment