Omar BISTAMI
Omar BISTAMI

Reputation: 850

ansible 2.4 (python 2.7.5) and ansible 2.6 (python 3.6.3) dictionary syntax difference?

On server 1 i have ansible 2.4.2.0 with python version = 2.7.5 :

On server 2 i have ansible 2.6.0 with python version = 3.6.3 :

on Server 1, this works fine , by calling a dictionary roles/webapp/defaults/main.yml inside roles/webapp/vars/main.yml:

nexus_download_url: '{{ nexus_redirect_base_url }}?r={{ nexus_repo_name }}&g={{ apps[application_name].artifact_group_id }}&a={{ application_name }}&v={{ application_version }}&c=exec&e=jar'

While on server 2 i get following error :

{"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute...}

The issue is linked to :

&g={{ apps[application_name].artifact_group_id }}

Is there any modifications done between the two ansible version on dictionary syntax , i didn't find anything on ansible changelog for both version 2.5 and 2.6 ?

Upvotes: 0

Views: 268

Answers (1)

Omar BISTAMI
Omar BISTAMI

Reputation: 850

I have tried two things and it worked :

  1. Adding the dictionary directly inside /role/test/vars/main.yml
  2. add to the ansible config file (ansible.cfg)

    hash_behaviour = merge

Upvotes: 1

Related Questions