On Fri, 19 May 2023 at 07:21, Narmada Karthika <chittur...@gmail.com> wrote:
> I am getting error saying I am using 2 var_files. What is that error exactly? > ERROR! failed at splitting arguments, either an unbalanced jinja2 block or > quotes: This is another error then? > I also tried using include_vars which gave me same error, the values in these > 2 files need to be replace at diff locations at play book > some one please suggest what is the best way for this > name: post call to get servergroup > hosts: localhost > become: true > gather_facts: no > tasks: > - name: set the facts per host > set_fact: > access_token: "{{ hostvars.localhost.output.stdout }}" # this is the > output of the above play > - name: Make a post call to get server details > shell: | > cd /var/output/ > curl --location --request GET "{{ serverlist }}" \--header > 'Authorization: Bearer "{{ access_token }}" > /var/output/"{{ item }}".json > jq -r '.[]|.serverData[].servers[]' "{{ item }}".json > > /home/deploy-user/ansible/group_vars/"{{ item }}".yml > # item and server list from one file and Instead of having ansible execute several shell commands piped together, you should use native modules, like https://docs.ansible.com/ansible/latest/collections/ansible/builtin/uri_module.html, register the result, and then operate/make decisions based on that. > register: data > - debug: msg="data , {{ repo }}" # this need to replaced from one var file > loop: > - dev > - uat > - stg2 "replaced from" is unclear - you usually replace something with something, or by something. Rather than guessing what you might mean, please try to be more clear. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAF8BbLYO7Y3KeBw-NXLj%2BsraAAZZSx91si%2BRHTthXX1vKrx-9g%40mail.gmail.com.