What's new
PGBlitz.com

Register Now! Find useful tips, Interact /w Community Members and join the part the Best Community on the Internet!

Minio (S3) app working but ...

SteveCliff

Junior Member
I've pulled together a custom container that deploys out minio correctly and it works fine but as part of the deploy I generate two random values for key credentials. In order to use the minio container you need to know these values (which are in /opt/appdata/minio/.minio.sys/config/config.json).

I've added a debug statement to the Ansible and I can see it displayed but obviously it's not very neat and you have to scroll back up the screen a bit to see it - so not ideal.

Is it possible to somehow display this information in a neater way, possibly by passing back to the calling Ansible module or something ? (My Ansible skills are somewhat limited - lol!)

Just in case, here is the yml:

YAML:
#!/bin/bash
#
# Title:      PGBlitz (Reference Title File)
# Author(s):  Gennavar
# URL:        https://pgblitz.com - http://github.pgblitz.com
# GNU:        General Public License v3.0
################################################################################
---
- hosts: localhost
  gather_facts: false
  tasks:
    # FACTS #######################################################################
    - name: 'Set Known Facts'
      set_fact:
        pgrole: 'minio'
        intport: '9000'
        extport: '9200'
        image: 'minio/minio'
        minio_command: 'server /data'
        minio_access: '{{ inventory_hostname | random | hash }}'
        minio_secret: '{{ pgrole | random | hash }}'

    # CORE (MANDATORY) ############################################################
    - name: 'Including cron job'
      include_tasks: '/opt/communityapps/apps/_core.yml'

    # LABELS ######################################################################
    - name: 'Adding Traefik'
      set_fact:
        pg_labels:
          traefik.frontend.auth.forward.address: '{{gauth}}'
          traefik.enable: 'true'
          traefik.port: '{{intport}}'
          traefik.frontend.rule: 'Host:{{pgrole}}.{{domain.stdout}},{{tldset}}'

    - name: 'Setting PG Volumes'
      set_fact:
        pg_volumes:
          - '/opt/appdata/{{pgrole}}:/data'
          - '/etc/localtime:/etc/localtime:ro'

    - name: 'Setting PG ENV'
      set_fact:
        pg_env:
          PUID: '1000'
          PGID: '1000'
          MINIO_ACCESS_KEY: '{{minio_access}}'
          MINIO_SECRET_KEY: '{{minio_secret}}'

    # MAIN DEPLOYMENT #############################################################
    - name: 'Deploying {{pgrole}}'
      docker_container:
        name: '{{pgrole}}'
        image: '{{image}}'
        pull: yes
        published_ports:
          - '{{ports.stdout}}{{extport}}:{{intport}}'
        volumes: '{{pg_volumes}}'
        env: '{{pg_env}}'
        restart_policy: unless-stopped
        command: '{{minio_command}}'
        networks:
          - name: plexguide
            aliases:
              - '{{pgrole}}'
        state: started
        labels: '{{pg_labels}}'

    # Display Secrets #############################################################
    - debug:
        msg:
        - "Minio generated credentials - ** you will need these to access Minio **"
        - ""
        - "Access key: {{minio_access}}"
        - "Secret key: {{minio_secret}}"
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads


Top NZB NewsGroups!

Members - Up To a 58% Discount!

Development Donations

 

Online statistics

Members online
7
Guests online
74
Total visitors
81
Top