# Ansible Version Migration

**URL:** <https://forum.ansible.com/t/ansible-version-migration/31701>\
**Category:** Ansible Project\
**Created:** [November 21, 2019, 1:01pm UTC](https://forum.ansible.com/t/ansible-version-migration/31701 "2019-11-21T13:01:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![deva\_raju](https://avatars.discourse-cdn.com/v4/letter/d/ecc23a/32.png) [@deva\_raju](https://forum.ansible.com/u/deva_raju)\
**Post date:** [November 21, 2019, 1:01pm UTC](https://forum.ansible.com/t/ansible-version-migration/31701/1 "2019-11-21T13:01:31Z")

</div>

Hi Team,

We wrote YAML scripts under the version 1.5.3 and 2.1.1 (virtual environment).

Now, we would like to move to either ansible-2.4 or ansible-2.5

So, what is the way to migrate my code to latest version ? Or do i need write the complete code from scratch ?

Can anyone please suggest me on this ?

Thanks & Regards  
Devaraju Gedela

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [November 21, 2019, 2:02pm UTC](https://forum.ansible.com/t/ansible-version-migration/31701/2 "2019-11-21T14:02:48Z")

</div>

The answers are in the Porting guides.  
[https://docs.ansible.com/ansible/latest/porting\_guides/](https://docs.ansible.com/ansible/latest/porting_guides/)

Cheers,

&nbsp;&nbsp;-vlado

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [November 21, 2019, 2:11pm UTC](https://forum.ansible.com/t/ansible-version-migration/31701/3 "2019-11-21T14:11:25Z")

</div>

Usualy compatibility is quite good...  
When going from 1.9 to 2.1, I had quite some porting code to do  
From now, change between version is generally deprecated before being obsoleted.

So expect some work for your very old scripts using version 1.5...

Regards,

---

<div class="post-metadata">

**Author:** ![acozine1](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@acozine1](https://forum.ansible.com/u/acozine1)\
**Post date:** [November 22, 2019, 3:31pm UTC](https://forum.ansible.com/t/ansible-version-migration/31701/4 "2019-11-22T15:31:42Z")

</div>

Hi Devaraju,

It’s best to upgrade to a maintained version. We maintain 3 versions at all times - currently those versions are 2.9, 2.8, and 2.7 - see [https://docs.ansible.com/ansible/latest/reference\_appendices/release\_and\_maintenance.html](https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html).

We do not fix bugs in unmaintained versions, so if security vulnerabilities exist in version 2.4 or 2.5, they will not be fixed.

Best wishes,  
Alicia

---

<div class="post-metadata">

**Author:** ![deva\_raju](https://avatars.discourse-cdn.com/v4/letter/d/ecc23a/32.png) [@deva\_raju](https://forum.ansible.com/u/deva_raju)\
**Post date:** [November 27, 2019, 9:05am UTC](https://forum.ansible.com/t/ansible-version-migration/31701/5 "2019-11-27T09:05:01Z")

</div>

Thanks Alicia for letting us know about maintained versions.

But, While i’m upgrading my scripts from 1.5.3/2.1.1 to 2.9 , Some of the expressions were not getting evaluated successfully.

I found that “%{%d:%Y:%H:%m:%S}t” is not getting evaluated and throwing the error like “ERROR! failed at splitting arguments, either an unbalanced jinja2 block or quotes”

Finally, {%{%d} is not getting evaluated in ansible2.9 bit i’m not sure in rest of the maintained versions.

Could you please help me on this ?

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [November 27, 2019, 9:08am UTC](https://forum.ansible.com/t/ansible-version-migration/31701/6 "2019-11-27T09:08:00Z")

</div>

> Thanks Alicia for letting us know about maintained versions.
> 
> But, While i'm upgrading my scripts from 1.5.3/2.1.1 to 2.9 , Some of the expressions were not getting evaluated  
> successfully.
> 
> I found that "%{%d:%Y:%H:%m:%S}t" is not getting evaluated and throwing the error like "ERROR! failed at splitting  
> arguments, either an unbalanced jinja2 block or quotes"
> 
> Finally, {%{%d} is not getting evaluated in ansible2.9 bit i'm not sure in rest of the maintained versions.
> 
> Could you please help me on this ?

Please explain the context of this expressions and what you expect as outcome.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![deva\_raju](https://avatars.discourse-cdn.com/v4/letter/d/ecc23a/32.png) [@deva\_raju](https://forum.ansible.com/u/deva_raju)\
**Post date:** [November 27, 2019, 9:47am UTC](https://forum.ansible.com/t/ansible-version-migration/31701/7 "2019-11-27T09:47:03Z")

</div>

Hi Stefan,

FYI \>\>\>

vars.yml

apache\_log\_format: '[%{%d/%b/%Y:%H:%M:%S}t.%{msec\_frac}t %{%z}t] %a %h \“%r\” ’

- name: Standardize access log format  
shell:  
sed -i ‘/LogFormat/c LogFormat “rev\_proxy@{{ hostname }} {{ apache\_log\_format }}” common/’ /var/httpd/conf/httpd.conf;

Error:

TASK [Standardize access log format] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [test.local]: FAILED! =\> {“msg”: "An unhandled exception occurred while templating '\[%{%d\/%b\/%Y:%H:%M:%S}t\.%{msec\_frac}t %{%z}t\] %a %h \\"%r\\" '. Error was a \<class ‘ansible.errors.AnsibleError’\>, original message: template error while templating string: Encountered unknown tag ‘d’… String: \[%{%d\/%b\/%Y:%H:%M:%S}t\.%{msec\_frac}t %{%z}t\] %a %h \\"%r\\" "}

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [November 27, 2019, 10:00am UTC](https://forum.ansible.com/t/ansible-version-migration/31701/8 "2019-11-27T10:00:43Z")

</div>

> Hi Stefan,
> 
> FYI \>\>\>
> 
> vars.yml
> 
> apache\_log\_format: '\[%{%d\/%b\/%Y:%H:%M:%S}t\.%{msec\_frac}t %{%z}t\] %a %h \\"%r\\" '
> 
> - name: Standardize access log format  
> shell:  
> sed -i '/LogFormat/c LogFormat "rev\_proxy@{{ hostname }} {{ apache\_log\_format }}" common/'  
> /var/httpd/conf/httpd.conf;
> 
> Error:
> 
> TASK [Standardize access log format]  
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> fatal: [test.local]: FAILED! =\> {"msg": "An unhandled exception occurred while templating  
> '\\[%{%d\\/%b\\/%Y:%H:%M:%S}t\\.%{msec\_frac}t %{%z}t\\] %a %h \\\\\"%r\\\\\" '. Error was a \<class  
> 'ansible.errors.AnsibleError'\>, original message: template error while templating string: Encountered unknown tag 'd'..  
> String: \\[%{%d\\/%b\\/%Y:%H:%M:%S}t\\.%{msec\_frac}t %{%z}t\\] %a %h \\\\\"%r\\\\\" "}

Hello Deva,

please use lineinfile module or templating instead of the shell.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke
