--- # Copyright Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # Deploy MinIO # # Deploys MinIO as an S3-compatible storage backend. # Creates namespace, PVC, Deployment, Service, Routes. # Bucket is created via mkdir in the container command. # # Output facts: # cifmw_deploy_minio_access_key: Root user (for OADP credentials) # cifmw_deploy_minio_secret_key: Root password (for OADP credentials) - name: Create temp directory for rendered templates ansible.builtin.tempfile: state: directory prefix: deploy-minio- register: _deploy_minio_rendered_dir - name: Render MinIO manifests ansible.builtin.template: src: minio.yaml.j2 dest: "{{ _deploy_minio_rendered_dir.path }}/minio.yaml" mode: "0644" - name: Apply MinIO manifests kubernetes.core.k8s: src: "{{ _deploy_minio_rendered_dir.path }}/minio.yaml" state: present - name: Wait for MinIO deployment to be ready kubernetes.core.k8s_info: api_version: apps/v1 kind: Deployment name: minio namespace: "{{ cifmw_deploy_minio_namespace }}" wait: true wait_timeout: 300 wait_condition: type: Available status: "True" - name: Export credentials for downstream roles ansible.builtin.set_fact: cifmw_deploy_minio_access_key: "{{ cifmw_deploy_minio_root_user }}" cifmw_deploy_minio_secret_key: "{{ cifmw_deploy_minio_root_password }}" - name: Get MinIO console route kubernetes.core.k8s_info: api_version: route.openshift.io/v1 kind: Route name: minio-console namespace: "{{ cifmw_deploy_minio_namespace }}" register: _minio_console_route - name: Get MinIO API route kubernetes.core.k8s_info: api_version: route.openshift.io/v1 kind: Route name: minio-api namespace: "{{ cifmw_deploy_minio_namespace }}" register: _minio_api_route - name: Print setup complete ansible.builtin.debug: msg: - "========================================" - "MinIO Setup Complete" - "========================================" - "Console: https://{{ _minio_console_route.resources[0].spec.host }}" - "API: https://{{ _minio_api_route.resources[0].spec.host }}" - "Buckets: {{ cifmw_deploy_minio_buckets | join(', ') }}" - name: Cleanup rendered templates ansible.builtin.file: path: "{{ _deploy_minio_rendered_dir.path }}" state: absent