mailcow / mailcow-ansiblerole

The official ansible role to setup mailcow using Ansible
GNU General Public License v3.0
77 stars 52 forks source link

Installation infinitely stuck if not enough memory #38

Open jimboolio opened 1 year ago

jimboolio commented 1 year ago

Playbook main.yml calls generate_config.sh which checks the amount of available ram, if there is less than 2097152 (of some unit) the script will get infinitely stuck at row 105 and 125 on generate_config.sh

The play is currently like this:

- name: Generate mailcow.conf file
  shell: ./generate_config.sh
  environment:
    MAILCOW_HOSTNAME: "{{ mailcow__hostname }}"
    MAILCOW_TZ: "{{ mailcow__timezone }}"
    MAILCOW_BRANCH: "{{ mailcow__git_version }}"
  args:
    executable: /bin/bash
    chdir: "{{ mailcow__install_path }}"
    creates: mailcow.conf
  tags:
    - skip_ansible_lint

On Ansible role side I'd suggest for fixing it for example by adding a timeout, like below (didn't yet test) and additionally mentioning somewhere that the role does not support (yet) these cases where installed memory is less than x amount:

- name: Generate mailcow.conf file
  shell: ./generate_config.sh
  environment:
    MAILCOW_HOSTNAME: "{{ mailcow__hostname }}"
    MAILCOW_TZ: "{{ mailcow__timezone }}"
    MAILCOW_BRANCH: "{{ mailcow__git_version }}"
  args:
    executable: /bin/bash
    chdir: "{{ mailcow__install_path }}"
    creates: mailcow.conf
  tags:
    - skip_ansible_lint
  async: 60
  poll: 5

A proper fix would be to modify generate_config.sh to handle these situations without interactions.

Ayowel commented 7 months ago

Does the proposed change in mailcow/mailcow-dockerized#5804 look good to you ? Note that the ansiblerole would need a note in the README as both CLAMD and SOLR are enabled by default, which would give a hard time to the hosting server.