added minio salt state

This commit is contained in:
= 2021-01-02 10:35:49 +01:00
parent 7e2226b257
commit 2f632e8615
5 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,14 @@
[Unit]
Description=MinIO podman container
[Service]
Restart=on-failure
ExecStartPre=/usr/bin/rm -f /%t/%n-pid /%t/%n-cid
ExecStart=/usr/bin/podman run --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid --detach -p "9000:9000" -e "MINIO_ACCESS_KEY={{ pillar['minio']['accesskey'] }}" -v "/srv/minio:/data" -e "MINIO_SECRET_KEY={{ pillar['minio']['secretkey'] }}" minio/minio server /data
ExecStop=/usr/bin/sh -c "/usr/bin/podman rm -f `cat /%t/%n-cid`"
KillMode=none
Type=forking
PIDFile=/%t/%n-pid
[Install]
WantedBy=multi-user.target

3
minio/init.sls Normal file
View File

@ -0,0 +1,3 @@
include:
- minio.prereq
- minio.systemd

10
minio/prereq.sls Normal file
View File

@ -0,0 +1,10 @@
Create local MinIO storage:
file.directory:
- name: /srv/minio
- user: root
- group: root
- mode: "0755"
Install podman:
pkg.installed:
- name: podman

20
minio/systemd.sls Normal file
View File

@ -0,0 +1,20 @@
Create minio systemd service:
file.managed:
- name: /etc/systemd/system/minio.service
- source: salt://minio/files/minio.service.jinja
- template: jinja
- user: root
- group: root
- mode: "0660"
SystemD daemon reload:
cmd.run:
- name: systemctl --system daemon-reload
- onchanges:
- file: Create minio systemd service
start MinIO:
service.running:
- name: minio.service
- onchanges:
- cmd: SystemD daemon reload

View File

@ -15,3 +15,7 @@ base:
'k3s':
- match: nodegroup
- k3s
'minio:enabled:true':
- match: pillar
- minio