Handler not found in included role when using variable in name and variable is defined in inventory or host_vars #48466
Labels
affects_2.7
This issue/PR affects Ansible v2.7
bug
This issue/PR relates to a bug.
python3
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
SUMMARY
If a role is included and it defines a handler that is using a variable in the handler's name, the handler is not found in some situations, it depends on where the variable is defined.
ISSUE TYPE
COMPONENT NAME
handlers
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Control machine Arch linux
Targets: all
STEPS TO REPRODUCE
Run the bug.yml playbook from this repository: https://github.com/Pitmairen/ansbile-handlers-bug
If the variables are defined in the hosts file or the host_vars file (service3 in example) the play crashes with the error: ERROR! The requested handler '...' was not found:
ansible-playbook -i hosts bug.yml
If the variables are defined in the playbook file or on the command line it works fine.
ansible-playbook -i hosts bug.yml --extra-vars service3_name=service3
EXPECTED RESULTS
All handlers are found
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: