-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: handler 'restart redis 6379' was not found #193
Comments
I was using this role inside another role with module
I close the issue. |
It doesn't resolve the handler's name, but it works: RUNNING HANDLER [DavidWittman.redis : restart redis {{ redis_port }}] *********************************************
changed: [node-1] => {"changed": true, "name": "redis_6379", "state": "started", "status": {"ActiveEnterTimestampMonotonic": "0", "ActiveExitTimestampMonotonic": "0" ... However if I change the playbook from: - name: Configure a slave instance of Redis master
hosts: all
remote_user: root
vars:
- redis_slaveof: "{{ redis_cache_slave_of }}"
- redis_version: "{{ redis_cache_version }}"
- redis_port: 6379
roles:
- DavidWittman.redis to: - name: Configure a slave instance of Redis master
hosts: all
remote_user: root
vars:
- redis_slaveof: "{{ redis_cache_slave_of }}"
- redis_version: "{{ redis_cache_version }}"
- redis_port: "{{ redis_cache_port }}"
roles:
- DavidWittman.redis
# group_vars/all
redis_cache_port: 6379
TASK [DavidWittman.redis : create pid directory if it does not exist] *********************************************
skipping: [node-1] => {"changed": false, "skip_reason": "Conditional result was False"}
TASK [DavidWittman.redis : create redis config file] **************************************************************
ERROR! The requested handler 'restart redis 6379' was not found in either the main handlers list nor in the listening handlers list It won't work anymore. It's completely weird :( I reopen the issue. |
Works for me on Ansible version |
With Ansible 2.7.5, I see the same issue as @alibo -- if I use a fixed port number, then the handler is run fine, but if I provide the port number as another variable, the handler is not found. |
It seems it will never be allowed. Here's why:
|
Fixes DavidWittman#193. As stated here DavidWittman#193 (comment) variables in task name cannot rely on host vars.
Fixes DavidWittman#193. As stated here DavidWittman#193 (comment) variables in task name cannot rely on host vars.
Fixes DavidWittman#193. As stated here DavidWittman#193 (comment) variables in task name cannot rely on host vars.
* Fix handlers definitions Fixes #193. As stated here #193 (comment) variables in task name cannot rely on host vars. * Drop support for Ansible versions before 2.4
* Fix handlers definitions Fixes DavidWittman#193. As stated here DavidWittman#193 (comment) variables in task name cannot rely on host vars. * Drop support for Ansible versions before 2.4
Unfortunately, I get this error with Ansible 2.6.2:
Here is the playbook:
It seems Ansible doesn't pass the variable
redis_port
to the handler, so it can't find the handlerrestart redis 6379
:https://github.com/DavidWittman/ansible-redis/blob/1.2.5/handlers/main.yml#L2
Is there any workaround for this issue?
The text was updated successfully, but these errors were encountered: