From cae118683d2690a775da1fc3979a9f8f4d9d53f0 Mon Sep 17 00:00:00 2001 From: khaledk2 Date: Fri, 19 Jan 2024 22:56:15 +0000 Subject: [PATCH 1/4] update to rocky linux 9 --- .github/workflows/molecule.yml | 8 ++++---- meta/main.yml | 4 ++-- molecule/default/Dockerfile.j2 | 22 ---------------------- molecule/default/molecule.yml | 12 +++++++++--- tasks/main.yml | 9 +++++---- tasks/minio-client.yml | 14 +++++++------- 6 files changed, 27 insertions(+), 42 deletions(-) delete mode 100644 molecule/default/Dockerfile.j2 diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index 96f977b..543b1e7 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -10,7 +10,7 @@ on: jobs: list-scenarios: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 outputs: matrix: ${{ steps.listscenarios.outputs.scenarios }} steps: @@ -22,7 +22,7 @@ jobs: name: Test needs: - list-scenarios - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: # Keep running so we can see if other tests pass fail-fast: false @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: '3.9' - name: Install Ansible & Molecule run: | pip install "ansible<8" "ansible-lint<6.13" flake8 @@ -46,7 +46,7 @@ jobs: if: startsWith(github.ref, 'refs/tags') needs: - test - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - name: Read the role name diff --git a/meta/main.yml b/meta/main.yml index 01f0969..4dff9f1 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -4,11 +4,11 @@ galaxy_info: description: Minio S3 gateway with additional restricted users company: Open Microscopy Environment license: BSD - min_ansible_version: 2.6 + min_ansible_version: 2.10 platforms: - name: EL versions: - - 7 + - 9 namespace: ome role_name: minio_s3_gateway galaxy_tags: [] diff --git a/molecule/default/Dockerfile.j2 b/molecule/default/Dockerfile.j2 deleted file mode 100644 index 0de39e6..0000000 --- a/molecule/default/Dockerfile.j2 +++ /dev/null @@ -1,22 +0,0 @@ -# Molecule managed - -{% if item.registry is defined %} -FROM {{ item.registry.url }}/{{ item.image }} -{% else %} -FROM {{ item.image }} -{% endif %} - -{% if item.env is defined %} -{% for var, value in item.env.items() %} -{% if value %} -ENV {{ var }} {{ value }} -{% endif %} -{% endfor %} -{% endif %} - -RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates iproute2 && apt-get clean; \ - elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \ - elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash iproute && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ - elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml iproute2 && zypper clean -a; \ - elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ - elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates iproute2 && xbps-remove -O; fi diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index ae79274..05932c7 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -11,11 +11,17 @@ lint: | flake8 platforms: - name: minio - image: centos/systemd:latest - privileged: true + image: eniocarboni/docker-rockylinux-systemd:9 + image_version: latest command: /sbin/init + privileged: true + cgroupns_mode: host + tmpfs: + - /sys/fs/cgroup groups: - - docker_hosts + - extra_options + - docker_hosts + provisioner: name: ansible lint: diff --git a/tasks/main.yml b/tasks/main.yml index 70fcc37..175549d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -6,20 +6,21 @@ - name: Install docker-py become: true - yum: + ansible.builtin.dnf: + update_cache: true name: docker-python state: present - name: Create docker network become: true - docker_network: + ansible.builtin.docker_network: name: "{{ minio_s3_gateway_docker_network }}" # Etcd required for multiple users on the S3 gateway # https://github.com/minio/minio/blob/master/docs/sts/etcd.md - name: Minio etcd become: true - docker_container: + ansible.builtin.docker_container: image: "{{ minio_s3_gateway_etcd_image }}" # Workaround problem with etcd docker directory permissions # Breaking change going from 3.4.9 → 3.4.10 @@ -49,7 +50,7 @@ # https://github.com/minio/minio/blob/master/docs/gateway/s3.md - name: Minio s3 gateway become: true - docker_container: + ansible.builtin.docker_container: image: "{{ minio_s3_gateway_minio_image }}" command: gateway s3 {{ minio_s3_gateway_remote_endpoint }} name: minio-s3-gateway-minio diff --git a/tasks/minio-client.yml b/tasks/minio-client.yml index 00f7157..82f6ffb 100644 --- a/tasks/minio-client.yml +++ b/tasks/minio-client.yml @@ -2,7 +2,7 @@ - name: Download minio client become: true - get_url: + ansible.builtin.get_url: # Downloads the latest client, can't find a way to download a particular # version url: @@ -14,14 +14,14 @@ - name: Copy minio-user.sh become: true - template: + ansible.builtin.template: src: minio-user.sh dest: /usr/local/bin/minio-user.sh mode: u=rwx,g=rx,o=rx - name: Create config directories become: true - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0755 @@ -31,21 +31,21 @@ - name: Copy policy-readwrite-subdir.json.template become: true - copy: + ansible.builtin.copy: src: policy-readwrite-subdir.json.template dest: /etc/minio-s3-gateway/policy-readwrite-subdir.json.template mode: 0644 - name: Create placeholder text file become: true - copy: + ansible.builtin.copy: content: "{{ minio_s3_gateway_placeholder_content }}" dest: /etc/minio-s3-gateway/README.txt mode: 0644 - name: Create root mc config become: true - template: + ansible.builtin.template: src: mc-config-json.j2 dest: /root/.mc/config.json backup: true @@ -54,7 +54,7 @@ # Needed so that it appears in the sudo PATH - name: Symlink minio client and script to /usr/bin become: true - file: + ansible.builtin.file: path: /usr/bin/{{ item }} src: /usr/local/bin/{{ item }} state: link From ce38dca32fb989ffa8cb29e6658ace6ada3d1594 Mon Sep 17 00:00:00 2001 From: khaledk2 Date: Mon, 22 Jan 2024 14:23:47 +0000 Subject: [PATCH 2/4] Fix install docker --- tasks/main.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 175549d..2d2c47f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -4,11 +4,10 @@ # minio S3 gateway with custom users in front of an external S3 store # https://github.com/minio/minio/issues/8045 -- name: Install docker-py +- name: Install docker become: true - ansible.builtin.dnf: - update_cache: true - name: docker-python + ansible.builtin.pip: + name: docker state: present - name: Create docker network From a997d429c8fd10c74a8af434d8bd89396007c97b Mon Sep 17 00:00:00 2001 From: khaledk2 Date: Thu, 25 Jan 2024 21:20:25 +0000 Subject: [PATCH 3/4] add docker version as a vraiable --- defaults/main.yml | 1 + tasks/main.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 3611b02..462aca3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -13,6 +13,7 @@ minio_s3_gateway_placeholder_content: "Hello!" minio_s3_gateway_port: 9000 +docker_version: 7.0.0 ###################################################################### # Expert users only! diff --git a/tasks/main.yml b/tasks/main.yml index 2d2c47f..4e7f8c9 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -8,6 +8,7 @@ become: true ansible.builtin.pip: name: docker + version: "{{ docker_version }}" state: present - name: Create docker network From f3801d9548cddeb634f7a9ae66b559aa4b080a13 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Thu, 25 Jan 2024 21:53:35 +0000 Subject: [PATCH 4/4] add docker_version variable to README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8e069ca..01c7b95 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ Optional: - `minio_s3_gateway_bucket`: The bucket to use in the helper scripts if `minio_s3_gateway_install_client` is enabled, default `test` - `minio_s3_gateway_placeholder_content`: Content of a `README.txt` file that is copied to a new subdirectory if `minio_s3_gateway_install_client` is enabled - `minio_s3_gateway_port`: Listen on this port, default `9000` +- `docker_version`: The version of Python library for the Docker Engine API, default `7.0.0` Example Playbook