[ansible][on-fire-within] minio
change
commit 29e6e6c77da5a7d42fbe25f0cc759db96e423ad3
author Alpha Chen <alpha@kejadlen.dev>
date
parent 7c85f31c
diff --git a/ansible/.gitattributes b/ansible/.gitattributes
new file mode 100644
index 00000000..718e013b
--- /dev/null
+++ b/ansible/.gitattributes
@@ -0,0 +1,2 @@
+docker/minio/minio filter=lfs diff=lfs merge=lfs -text
+docker/mc/mc filter=lfs diff=lfs merge=lfs -text
diff --git a/ansible/docker/mc/Dockerfile b/ansible/docker/mc/Dockerfile
new file mode 100644
index 00000000..7185ca37
--- /dev/null
+++ b/ansible/docker/mc/Dockerfile
@@ -0,0 +1,5 @@
+FROM arm32v7/alpine:latest
+
+COPY mc /usr/sbin
+
+ENTRYPOINT [ "mc" ]
diff --git a/ansible/docker/mc/mc b/ansible/docker/mc/mc
new file mode 100755
index 00000000..aec3ae6f
--- /dev/null
+++ b/ansible/docker/mc/mc
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a06054d2ee1b866b6d3265276dc3dca075f82af07685c2152fbe3f3492be2276
+size 19679192
diff --git a/ansible/docker/minio/Dockerfile b/ansible/docker/minio/Dockerfile
index f3103350..1bc9a1e5 100644
--- a/ansible/docker/minio/Dockerfile
+++ b/ansible/docker/minio/Dockerfile
@@ -1,11 +1,6 @@
-FROM armhf/alpine
+FROM arm32v7/alpine:latest
 
-RUN apk update && apk upgrade && \
-    apk add curl
-
-RUN curl --location --remote-name https://dl.min.io/server/minio/release/linux-arm/minio && \
-    chmod +x minio && \
-    mv minio /usr/sbin
+COPY minio /usr/sbin
 
 EXPOSE 9000
 VOLUME /data
diff --git a/ansible/docker/minio/minio b/ansible/docker/minio/minio
new file mode 100755
index 00000000..3abbaefa
--- /dev/null
+++ b/ansible/docker/minio/minio
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:63bb361b869e6b87725f4e20dda202a07dfc93875668f6cbb52bfede61fc8ebe
+size 53025034
diff --git a/ansible/on-fire-within/main.yml b/ansible/on-fire-within/main.yml
index f4e91a4d..c43db517 100644
--- a/ansible/on-fire-within/main.yml
+++ b/ansible/on-fire-within/main.yml
@@ -29,6 +29,7 @@
         state: directory
       with_items:
         - /etc/ddclient
+        - /etc/minio
         - /etc/traefik
         - /mnt/mushu/minio
         - /mnt/mushu/syncthing
@@ -86,32 +87,16 @@
         dest: /etc/traefik/traefik.toml
         mode: 0600
 
-    # TODO This should really go after the docker_compose task, since it
-    # depends on the network that docker-compose makes. We should create the
-    # network first so we can do this, and set the services to use that network
-    # specifically.
-    - name: Route Home Assistant through Traefik
-      block:
-        # - shell: ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+' | head -n 1
-        - shell: docker network inspect on-fire-within_default | jq --raw-output .[0].IPAM.Config[0].Gateway
-          register: docker_ip_result
-        - set_fact:
-            docker_ip: "{{ docker_ip_result.stdout | trim }}"
-        - copy:
-            content: |
-              [http.routers]
-                [http.routers.hassio]
-                  rule = "Host(`{{ traefik.host_rules.hassio }}`)"
-                  service = "hassio"
-                  [http.routers.hassio.tls]
-                    certResolver = "le"
-
-              [http.services]
-                [http.services.hassio.loadBalancer]
-                  [[http.services.hassio.loadBalancer.servers]]
-                    url = "http://{{ docker_ip }}:8123/"
-            dest: /etc/traefik/dynamic_conf.toml
-            mode: 0600
+    # The docker_compose module overwrites our existing variables, so this is a
+    # workaround to save off ones that we need later on in the playbook.
+    #
+    # https://github.com/ansible/ansible/issues/33960
+    - name: Save original host facts
+      set_fact:
+        "{{ item }}_original": "{{ lookup('vars', item) }}"
+      with_items:
+        - minio
+        - traefik
 
     - name: Docker ALL the things!
       docker_compose:
@@ -129,12 +114,11 @@
             minio:
               image: kejadlen/minio:latest
               container_name: minio
-              ports:
-                - 9000:9000/tcp
               environment:
                 MINIO_ACCESS_KEY: "{{ minio.access_key }}"
                 MINIO_SECRET_KEY: "{{ minio.secret_key }}"
               volumes:
+                - /etc/minio:/root/.minio
                 - /mnt/mushu/minio:/data
               user: 0:0 # root
               labels:
@@ -202,6 +186,29 @@
                 - traefik.http.routers.traefik.service=api@internal
               restart: unless-stopped
 
+    - name: Route Home Assistant through Traefik
+      block:
+        # - shell: ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+' | head -n 1
+        - shell: docker network inspect on-fire-within_default | jq --raw-output .[0].IPAM.Config[0].Gateway
+          register: docker_ip_result
+        - set_fact:
+            docker_ip: "{{ docker_ip_result.stdout | trim }}"
+        - copy:
+            content: |
+              [http.routers]
+                [http.routers.hassio]
+                  rule = "Host(`{{ traefik_original.host_rules.hassio }}`)"
+                  service = "hassio"
+                  [http.routers.hassio.tls]
+                    certResolver = "le"
+
+              [http.services]
+                [http.services.hassio.loadBalancer]
+                  [[http.services.hassio.loadBalancer.servers]]
+                    url = "http://{{ docker_ip }}:8123/"
+            dest: /etc/traefik/dynamic_conf.toml
+            mode: 0600
+
   handlers:
     - name: Restart ddclient
       docker_container: