Skip to content

Commit

Permalink
Add variables to allow for rpm deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
scollazo committed Dec 14, 2023
1 parent 86e9c2b commit e3dc920
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 57 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ minio_server_release: ""
minio_client_release: ""
```
Install using RPM packages. The value can be set to the package name (minio/mcli) if an already configured repository provides it, or to the full url to the rpm package.
```yaml
minio_server_install_rpm: ""
minio_client_install_rpm: ""
```
Release to install for both server and client; lastest if the default.
Can be 'RELEASE.2019-06-27T21-13-50Z' for instance.
Expand Down
6 changes: 6 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ minio_client_bin: /usr/local/bin/mc
minio_server_release: ""
minio_client_release: ""

# RPM install
# The value can be set to the package name (minio/mcli) if an already configured repository provides it, or to the full url to the rpm package.
minio_server_install_rpm: ""
minio_client_install_rpm: ""
minio_rpm_gpg_check_enabled: true

# Runtime user and group for the Minio server service
minio_user: minio
minio_group: minio
Expand Down
74 changes: 44 additions & 30 deletions tasks/install-client.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,46 @@
---

- name: Compose the Minio client download base url
set_fact:
_minio_client_download_base_url: "https://dl.minio.io/client/mc/release/linux-{{ go_arch }}"

- name: Compose the Minio client download url with lastest release
set_fact:
_minio_client_download_url: "{{ _minio_client_download_base_url }}/mc"
when: minio_client_release | length == 0

- name: "Compose the Minio client download url with release {{ minio_client_release }}"
set_fact:
_minio_client_download_url: "{{ _minio_client_download_base_url }}/archive/mc.{{ minio_client_release }}"
when: minio_client_release | length > 0

- name: "Get the Minio client checksum for {{ go_arch }} architecture"
set_fact:
_minio_client_checksum: "{{ lookup('url', _minio_client_download_url + '.sha256sum').split(' ')[0] }}"

- name: Download the Minio client
get_url:
url: "{{ _minio_client_download_url }}"
dest: "{{ minio_client_bin }}"
owner: "root"
group: "root"
mode: 0755
checksum: "sha256:{{ _minio_client_checksum }}"
register: _download_client
until: _download_client is succeeded
retries: 5
delay: 2
- name: "Install the Minio client from binaries"
block:

- name: Compose the Minio client download base url
set_fact:
_minio_client_download_base_url: "https://dl.minio.io/client/mc/release/linux-{{ go_arch }}"

- name: Compose the Minio client download url with lastest release
set_fact:
_minio_client_download_url: "{{ _minio_client_download_base_url }}/mc"
when: minio_client_release | length == 0

- name: "Compose the Minio client download url with release {{ minio_client_release }}"
set_fact:
_minio_client_download_url: "{{ _minio_client_download_base_url }}/archive/mc.{{ minio_client_release }}"
when: minio_client_release | length > 0

- name: "Get the Minio client checksum for {{ go_arch }} architecture"
set_fact:
_minio_client_checksum: "{{ lookup('url', _minio_client_download_url + '.sha256sum').split(' ')[0] }}"

- name: Download the Minio client
get_url:
url: "{{ _minio_client_download_url }}"
dest: "{{ minio_client_bin }}"
owner: "root"
group: "root"
mode: 0755
checksum: "sha256:{{ _minio_client_checksum }}"
register: _download_client
until: _download_client is succeeded
retries: 5
delay: 2
when:
- not (minio_client_install_rpm|length > 0)


- name: "Install Minio client from rpm"
yum:
name: "{{ minio_client_install_rpm }}"
disable_gpg_check: "{{ not minio_rpm_gpg_check_enabled|bool }}"
state: "present"
when:
- minio_client_install_rpm|length > 0
68 changes: 41 additions & 27 deletions tasks/install-server.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
---
- name: Compose the Minio server download base url
set_fact:
_minio_server_download_base_url: "https://dl.minio.io/server/minio/release/linux-{{ go_arch }}"

- name: Compose the Minio server download url with lastest release
set_fact:
_minio_server_download_url: "{{ _minio_server_download_base_url }}/minio"
when: minio_server_release | length == 0
- name: "Install Minio server from binaries"
block:
- name: Compose the Minio server download base url
set_fact:
_minio_server_download_base_url: "https://dl.minio.io/server/minio/release/linux-{{ go_arch }}"

- name: "Compose the Minio server download url with release {{ minio_server_release }}"
set_fact:
_minio_server_download_url: "{{ _minio_server_download_base_url }}/archive/minio.{{ minio_server_release }}"
when: minio_server_release | length > 0
- name: Compose the Minio server download url with lastest release
set_fact:
_minio_server_download_url: "{{ _minio_server_download_base_url }}/minio"
when: minio_server_release | length == 0

- name: "Get the Minio server checksum for {{ go_arch }} architecture"
set_fact:
_minio_server_checksum: "{{ lookup('url', _minio_server_download_url + '.sha256sum').split(' ')[0] }}"
- name: "Compose the Minio server download url with release {{ minio_server_release }}"
set_fact:
_minio_server_download_url: "{{ _minio_server_download_base_url }}/archive/minio.{{ minio_server_release }}"
when: minio_server_release | length > 0

- name: Download the Minio server
get_url:
url: "{{ _minio_server_download_url }}"
dest: "{{ minio_server_bin }}"
owner: "root"
group: "root"
mode: 0755
checksum: "sha256:{{ _minio_server_checksum }}"
register: _download_server
until: _download_server is succeeded
retries: 5
delay: 2
notify: restart minio
- name: "Get the Minio server checksum for {{ go_arch }} architecture"
set_fact:
_minio_server_checksum: "{{ lookup('url', _minio_server_download_url + '.sha256sum').split(' ')[0] }}"

- name: Download the Minio server
get_url:
url: "{{ _minio_server_download_url }}"
dest: "{{ minio_server_bin }}"
owner: "root"
group: "root"
mode: 0755
checksum: "sha256:{{ _minio_server_checksum }}"
register: _download_server
until: _download_server is succeeded
retries: 5
delay: 2
notify: restart minio

when:
- not (minio_server_install_rpm|length > 0)

- name: "Install Minio server from rpm"
yum:
name: "{{ minio_server_install_rpm }}"
disable_gpg_check: "{{ not minio_rpm_gpg_check_enabled|bool }}"
state: "present"
notify: restart minio
when:
- minio_server_install_rpm|length > 0

0 comments on commit e3dc920

Please sign in to comment.