Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

kiwix-serve will no start if a ZIM failed to be installed. #2

@letompouce

Description

@letompouce
TASK [package_management : shell] **********************************************
 [WARNING]: Consider using the file module with state=link rather than running
ln.  If you need to use command because file is insufficient you can add
warn=False to this command task or set command_warnings=False in ansible.cfg to
get rid of this message.
failed: [localhost] (item=maths-et-tiques.fr) => {"changed": true, "cmd": "ln -s /mnt/kiwix/zim/other/la_chaine_de_maths_et_tiques_fr_all_2020-07.zim /var/ideascube/kiwix/maths-et-tiques.fr.zim\n kiwix-manage /var/ideascube/kiwix/library.xml add /var/ideascube/kiwix/maths-et-tiques.fr.zim", "delta": "0:00:00.750560", "end": "2020-09-01 19:24:41.525281", "item": "maths-et-tiques.fr", "msg": "non-zero return code", "rc": 1, "start": "2020-09-01 19:24:40.774721", "stderr": "Invalid /var/ideascube/kiwix/maths-et-tiques.fr.zim : Invalid magic number\nUnable to build or save library file '/var/ideascube/kiwix/library.xml'", "stderr_lines": ["Invalid /var/ideascube/kiwix/maths-et-tiques.fr.zim : Invalid magic number", "Unable to build or save library file '/var/ideascube/kiwix/library.xml'"], "stdout": "", "stdout_lines": []}
changed: [localhost] => (item=bouquineux.fr)
changed: [localhost] => (item=universcience-tv.fr)
changed: [localhost] => (item=biologie-tout-compris.fr)
changed: [localhost] => (item=wikipedia.fr)
changed: [localhost] => (item=cest-pas-sorcier.fr)
changed: [localhost] => (item=nota-bene.fr)
changed: [localhost] => (item=micmaths.fr)
changed: [localhost] => (item=mondial-tissus.fr)
...ignoring

The task reads:

    - shell: |
        ln -s /mnt/kiwix{{ Kiwix.all[item]['url'].split("download.kiwix.org")[-1] }} /var/ideascube/kiwix/{{ item }}.zim
        kiwix-manage /var/ideascube/kiwix/library.xml add /var/ideascube/kiwix/{{ item }}.zim
      with_items: "{{ device_kiwix_pkg }}"
      notify: Start kiwix serve
      ignore_errors: True

Because the task failed, the handler will not be called, and kiwix-serve will not be started.

According to the documentation:

When a task fails on a host, handlers which were previously notified will not be run on that host.

It doesn't explicitely talks about ignore_errors: true, so we can assume handlers will NEVER be called. Which is confirmed by the fact we don't have any HANDLER task at the end of the play.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions