Giter Site home page Giter Site logo

Comments (4)

till avatar till commented on August 20, 2024 1

I think this is a general problem with Ansible, and/or maybe systemd. You can do a wait_for in a wrapping role — for the service to start up, and check based on this.

Otherwise, I've created a play to do this (I run 4 nodes, so adjust your output):

- hosts: minio
  gather_facts: no
  tasks:
    - name: Check systemd minio status
      command: systemctl status minio
      register: minio_status
      failed_when: not (minio_status.stdout_lines | select("match", "4 Online, 0 Offline."))

from ansible-minio.

atosatto avatar atosatto commented on August 20, 2024

Hi @katia-e, do you have any example of variables you used to configure the role to try to reproduce the issue?

from ansible-minio.

katia-e avatar katia-e commented on August 20, 2024

For example I set up the following config.yaml:

- name: "Install Minio"
  hosts: servers
  roles:
    - atosatto.minio
  vars:
    minio_server_datadirs:
      - "/mnt/vdb"
      - "/mnt/vdc"
      - "/mnt/vdd"

This config cannot succeed due to the number of minio_server_datadirs = 3 (should be 4+), so I expect minio to install correctly, but fail to start.
In result I see no failed tasks:

PLAY RECAP *************************************************************************************************************
195.134.212.39             : ok=13   changed=1    unreachable=0    failed=0    skipped=3    rescued=0    ignored=0

But MinIO service failed to start on the remote machine. With this issue I was wondering if it's possible to return error if MinIO failed to start. Otherwise Ansible reports success, while some tasks failed.

from ansible-minio.

fititnt avatar fititnt commented on August 20, 2024

I discovered this by accident when trying to change users and permissions are wrong.

One problem I found is that some issues actually the playbook may be returning OK because this check

- name: Enable and start the Minio service
service:
name: minio
state: started
enabled: true

Actually not fail. And this may happens because take some seconds to systemd actually report the minio as failed because minio may take some time to report as failed for real

I'm not very sure how to implement a check for this, but maybe one very simple way would be give at least a few seconds (for sure no less than 5 seconds) to check at at the end of the playbook if the service still working.

Note about molecule tests & check if services are running

These types of check are complicated to test with docker and may require much larger docker images that have systemd or equivalent. If the current docker images already not works with these checks, not enable such checks when running inside containers could still valid, since on real VPS they are likely to work fine.

from ansible-minio.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.