Birendra Kumar
Birendra Kumar

Reputation: 441

Migrating ansible version 1.5.4 to latest ansible version

I have been using ansible 1.5.4 for 8 month. Yesterday I found that login_port of mysql_repilcation module is not supported in 1.5.4 version.

It is a bug in that version, but they supported in latest version (>= 1.8 I think). But I already have more than 50 ansible script running in 1.5.4 which has been used in production side

What is the best possible scenario:

  1. If I move 1.5.4 to latest version , will it impact on any existing ansible script

  2. Is it possible to achieve the desire outout by shell command.

I am stuck in the middle of ocean. please help me to out of this problem

Upvotes: 0

Views: 467

Answers (2)

Birendra Kumar
Birendra Kumar

Reputation: 441

Since login_port of mysql_repilcation module is not supported in ansible 1.7 version. I found a way to achieve the result.

-  name: "stop slaves of existing database server"
   shell: >
      mysql -uroot -p{{ mysql_exist_slave_database_password }} \
        -P{{ default_port }} -h{{ default_host }}  -e "stop slave" -s


- name: "Retrieve the Position and binary file number using slave 
         status"
  shell: >
       mysql -uroot -p{{ mysql_exist_slave_database_password }} \
            -P{{ default_port }} -h{{ default_host }}  -e "show slave 
            status\G" -s
  register: output



- name: "start slaves of existing database server"
 shell: >
        mysql -uroot -p{{ mysql_exist_slave_database_password }} -P{{    
        default_port }} -h{{ default_host }}  -e "start slave" -s

Upvotes: 0

udondan
udondan

Reputation: 59989

  1. If I move 1.5.4 to latest version , will it impact on any existing ansible script

This highly depends on your playbook/roles, but I'm pretty sure it won't just work without changes. For example I read many times now that users have problems with sudo on role level:

- roles:
   - role: whatever
     sudo: yes

That was broken in 1.9.1. Officially it is fixed but I have read users have still problems. Generally sudo has been replaced with become. Even though the documentation claims sudo is still supported, it clearly isn't completely.

Another change I remember was related to ssh transport but you should only stumble about this issue if you reboot your host during play with Ansible.

I think the sudo/become change was the biggest one. If you want to avoid the hassle and do not necessarily need the very recent version you might just upgrade to a version before 1.9 and will have better chances of getting through without changes.

If you have the time though, I recommend you make your play compatible with the recent version. The Ansible 2.0 release is ahead and will introduce many new very useful features.

  1. Is it possible to achieve the desire outout by shell command.

You mean to automatically convert your playbook/roles? No, not unless you find out exactly about the problems and write that script yourself. :)

I am stuck in the middle of ocean. please help me to out of this problem

Generally you should test every new version of Ansible on a testing/staging environment first. If you do not have testing hosts you can set up local VM's. There you can test and fix your play.

Upvotes: 1

Related Questions