Ansible Version Migration

39 views
Skip to first unread message

deva raju

unread,
Nov 21, 2019, 8:01:31 AM11/21/19
to Ansible Project
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

Vladimir Botka

unread,
Nov 21, 2019, 9:03:03 AM11/21/19
to deva raju, ansible...@googlegroups.com
On Thu, 21 Nov 2019 05:01:31 -0800 (PST)
deva raju <saidev...@gmail.com> wrote:

> 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 ?

The answers are in the Porting guides.
https://docs.ansible.com/ansible/latest/porting_guides/

Cheers,

-vlado

Jean-Yves LENHOF

unread,
Nov 21, 2019, 9:12:17 AM11/21/19
to ansible...@googlegroups.com, deva raju
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,


--
--
Jean-Yves LENHOF
jean...@lenhof.eu.org
Tel: 06 50 95 41 26

alicia

unread,
Nov 22, 2019, 10:32:01 AM11/22/19
to ansible...@googlegroups.com, deva raju
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

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

--
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-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5929578ef56022131fd91074b4a5735e%40lenhof.eu.org.


deva raju

unread,
Nov 27, 2019, 4:05:01 AM11/27/19
to Ansible Project
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 ? 

Best wishes,
Alicia

To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.

Stefan Hornburg (Racke)

unread,
Nov 27, 2019, 4:08:22 AM11/27/19
to ansible...@googlegroups.com
On 11/27/19 10:05 AM, deva raju wrote:
> 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
Racke

> On Friday, 22 November 2019 21:02:01 UTC+5:30, alicia wrote:
>
> 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
>
>> On Nov 21, 2019, at 8:11 AM, Jean-Yves LENHOF <jean...@lenhof.eu.org <javascript:>> wrote:
>>
>> Le 2019-11-21 15:02, Vladimir Botka a écrit :
>>> On Thu, 21 Nov 2019 05:01:31 -0800 (PST)
>>> deva raju <saide...@gmail.com <javascript:>> wrote:
>>>> 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 ?
>>> The answers are in the Porting guides.
>>> https://docs.ansible.com/ansible/latest/porting_guides/ <https://docs.ansible.com/ansible/latest/porting_guides/>
>>> Cheers,
>>> -vlado
>>
>>
>> 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,
>>
>>
>> --
>> --
>> Jean-Yves LENHOF
>> jean...@lenhof.eu.org <javascript:>
>> Tel: 06 50 95 41 26
>>
>> --
>> 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...@googlegroups.com
>> <javascript:>.
>> <https://groups.google.com/d/msgid/ansible-project/5929578ef56022131fd91074b4a5735e%40lenhof.eu.org>.
>>
>
> --
> 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-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/b3dbfa54-5a89-4256-b8f0-bca25476ab41%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/b3dbfa54-5a89-4256-b8f0-bca25476ab41%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc

deva raju

unread,
Nov 27, 2019, 4:47:03 AM11/27/19
to Ansible Project
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\\\\\"  "}


Stefan Hornburg (Racke)

unread,
Nov 27, 2019, 5:01:11 AM11/27/19
to ansible...@googlegroups.com
Hello Deva,

please use lineinfile module or templating instead of the shell.

Regards
Racke

>
>
> --
> 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-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f5a33d00-98b7-41fc-a5a9-d6e52f925f49%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/f5a33d00-98b7-41fc-a5a9-d6e52f925f49%40googlegroups.com?utm_medium=email&utm_source=footer>.
signature.asc
Reply all
Reply to author
Forward
0 new messages