SUMMARY
I trynig to take backup of existing file. reported below error
ERROR! failed at splitting arguments, either an unbalanced jinja2 block or quotes: cp "{{file.stdout}" "{{file.stdout}}"_bkp
ansible-playbook pb_DBrename_deletefile.yml -i alertdbhost
ISSUE TYPE
[root@XXXXXX database]#
ERROR! failed at splitting arguments, either an unbalanced jinja2 block or quotes: cp "{{file.stdout}" "{{file.stdout}}"_bkp
Ansible Version:
[root@XXXXXX database]# ansible --version
ansible 2.8.5
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, Jun 11 2019, 12:19:05) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
OS / ENVIRONMENT / INSTALL METHOD
Red Hat Enterprise Linux Server release 7.6 (Maipo)
STEPS TO REPRODUCE
---
- name: Rename listener Trace file and Delete
hosts: dbhost
gather_facts: no
tasks:
- name: list file
shell: cd "{{item}}"; find *.log
with_items: "{{mount_points}}"
register: file
- debug:
var: file
- name: Rename file
shell: cp "{{file.stdout}" "{{file.stdout}}"_bkp
# with_items: "{{file.stdout}}"
register: file1
- debug:
var: file1
EXPECTED RESULTS
File created with bkp extension
ACTUAL RESULTS
ERROR! failed at splitting arguments, either an unbalanced jinja2 block or quotes: cp "{{file.stdout}" "{{file.stdout}}"_bkp
The error appears to be in '/etc/ansible/database/pb_DBrename_deletefile.yml': line 12, column 8, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
var: file
- name: Rename file
^ here