Hello guys!
I want to share with you my problem which is pretty strange in my point of view.
My playbook looks as follows:
- name:fetch configuration
gather_facts: true
hosts: ‘{{ h }}’
sudo: true
sudo_user: admin
tasks: - shell: tar czf /tmp/tomcat-conf.tar.gz /var/test/conf/*
- fetch: src=/tmp/tomcat-conf.tar.gz dest=/tmp/tomcat-conf-{{ ansible_hostname }} flat=yes
I run this as:
ansible-playbook fetch-conf.yml -e {“h”:“hostname”}
I got error:
ERROR: Expecting property name: line 1 column 1 (char 1)
I don’t have error when I change hosts variable hosts: ‘hostname’ instead of hosts: ‘{{ h }}’
I want to execute this on group of servers that’s why I have to use variable {{ h }}
Anyone can advice/help in this case?
Best Regards,
Marcel