Closed iamtrump closed 7 years ago
Jinja2 should be wrapped with quotes (See "Gotchas" on this page http://docs.ansible.com/ansible/YAMLSyntax.html). What occurs when you change your notify line to the following?
notify: "restart {{ item }}"
OK, I tried this way and I've got the same:
ERROR! The requested handler 'restart [u'/tmp/ntp-4.2.6p5-22.el7.centos.2.x86_64.rpm']' was not found in either the main handlers list nor in the listening handlers list
I'm absolutely sure that it is a yum module bug: I tried the same with copy module and it works as expected:
- name: Copy packages with handlers
copy: src=/opt/repository/project/7/x86_64/{{ item }} dest=/tmp/{{ item }}
notify: restart {{ item }}
with_items:
- ntp-4.2.6p5-22.el7.centos.2.x86_64.rpm
Output:
TASK [Copy packages with handlers] ******************************************
changed: [hostname] => (item=ntp-4.2.6p5-22.el7.centos.2.x86_64.rpm)
RUNNING HANDLER [restart ntp-4.2.6p5-22.el7.centos.2.x86_64.rpm] ***************
changed: [hostname]
This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible
Please read through the repomerge page in the dev guide.
ISSUE TYPE
COMPONENT NAME
yum module
ANSIBLE VERSION
2.2.0.0.
CONFIGURATION
Default configuration.
OS / ENVIRONMENT
Ansible host: Ubuntu 16.10. Managed host: CentOS 7.
SUMMARY
yum can append unwanted data to variable {{ item }} after using.
STEPS TO REPRODUCE
I tried to run something like this:
EXPECTED RESULTS
I expected to see something like this:
ACTUAL RESULTS
But actually I've got the following:
As you can see "/tmp/" has been appended after first call {{ item }} variable.