question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

stable-2.2: purports to run on Ansible 2.1, but uses block name and listen in handlers

See original GitHub issue

http://docs.ceph.com/ceph-ansible/master/ says:

stable-2.2 Support for ceph versions jewel and kraken. This branch supports ansible versions 2.1 and 2.2.2

… but in the stable-2.2 branch, roles/ceph-common/handlers/main.yml contains:

- block:
  - name: copy mon restart script
    template:
      src: restart_mon_daemon.sh.j2
      dest: /tmp/restart_mon_daemon.sh
      owner: root
      group: root
      mode: 0750
    listen: "restart ceph mons"

  - name: restart ceph mon daemon(s)
    command: /tmp/restart_mon_daemon.sh
    listen: "restart ceph mons"

  when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
    - socket.rc == 0
    - ceph_current_fsid.rc == 0
    - mon_group_name in group_names

# This does not just restart OSDs but everything else too. Unfortunately
# at this time the ansible role does not have an OSD id list to use
# for restarting them specifically.
- block:
  - name: copy osd restart script
    template:
      src: restart_osd_daemon.sh.j2
      dest: /tmp/restart_osd_daemon.sh
      owner: root
      group: root
      mode: 0750
    listen: "restart ceph osds"

  - name: restart ceph osds daemon(s)
    command: /tmp/restart_osd_daemon.sh
    listen: "restart ceph osds"
    when: handler_health_osd_check

  when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
    - socket.rc == 0
    - ceph_current_fsid.rc == 0
    - osd_group_name in group_names
# See https://github.com/ceph/ceph-ansible/issues/1457 for the condition below
    - inventory_hostname in play_hosts
  • Support for name in blocks was added in Ansible 2.3, so this breaks on any prior Ansible version. See ansible/ansible#18985.
  • listen was added in Ansible 2.2, so that does not work on Ansible 2.1 either.

However, stable-2.2 deploys just fine with Ansible 2.3, so I’m not sure why the documentation seems to state you’re not supposed to use it.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
fghaascommented, Sep 21, 2017

@andrewschoen Any thoughts on this so I can send a patch? Dropping name is trivial, getting rid of listen, not so much (this was introduced as part of a refactoring in 5bec62ba7c8ecbc91ede05297dadb639c530f597, back in April). I could simply send a doc patch saying that stable-2.2 requires Ansible 2.2, at a minimum. (Now that Ansible 2.4 is out, requiring at least 2.2 doesn’t strike me as unreasonable at all.)

0reactions
guitscommented, May 10, 2019

Closed due to inactivity, feel free to re-open if needed. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handlers: running operations on change
Ansible uses handlers to address this use case. Handlers are tasks that only run when notified. Handler example. Notifying handlers. Naming handlers.
Read more >
Using block for handlers in Ansible - Medium
In my case, a handler was designed to restart a main service, but with few conditions: ... block: - name: message 1 debug:...
Read more >
Handler with block not found · Issue #77461 · ansible ... - GitHub
Summary If a handler is a block task containing multiple sub-tasks, Ansible says it cannot find that handler, so the play fails.
Read more >
Ansible: Handlers - 2020 - BogoToBogo
A Handler is exactly the same as a Task, but it will run when called by another Task. A Handler will take an...
Read more >
How do I write an Ansible handler with multiple tasks?
This use makes it much easier to trigger multiple handlers. ... listen: Restart processes - name: Restart conditionally step 2 service: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found