简体   繁体   English

将Ansible版本1.5.4迁移到最新的Ansible版本

[英]Migrating ansible version 1.5.4 to latest ansible version

I have been using ansible 1.5.4 for 8 month. 我已经使用ansible 1.5.4 8个月了。 Yesterday I found that login_port of mysql_repilcation module is not supported in 1.5.4 version. 昨天我发现1.5.4版本不支持mysql_repilcation模块的login_port。

It is a bug in that version, but they supported in latest version (>= 1.8 I think). 那是该版本中的错误,但它们支持最新版本(我认为>> 1.8)。 But I already have more than 50 ansible script running in 1.5.4 which has been used in production side 但是我已经在1.5.4中运行了50多个ansible脚本,该脚本已在生产端使用

What is the best possible scenario: 最佳方案是什么?

  1. If I move 1.5.4 to latest version , will it impact on any existing ansible script 如果我将1.5.4迁移到最新版本,它将对任何现有的ansible脚本产生影响

  2. Is it possible to achieve the desire outout by shell command. 是否有可能通过shell命令实现期望输出。

I am stuck in the middle of ocean. 我被困在大海中间。 please help me to out of this problem 请帮助我解决这个问题

  1. If I move 1.5.4 to latest version , will it impact on any existing ansible script 如果我将1.5.4迁移到最新版本,它将对任何现有的ansible脚本产生影响

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: 例如,我现在多次阅读用户在角色级别上使用sudo问题:

- roles:
   - role: whatever
     sudo: yes

That was broken in 1.9.1. 这在1.9.1中已被打破。 Officially it is fixed but I have read users have still problems. 正式地,它是固定的,但是我已经阅读过用户仍然有问题。 Generally sudo has been replaced with become . 通常sudo已被替换为turn Even though the documentation claims sudo is still supported, it clearly isn't completely. 即使文档声称仍支持sudo,但显然并不完全。

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. 我记得另一个变化与ssh传输有关,但是只有在使用Ansible玩游戏时重新启动主机时,才应该迷失这个问题。

I think the sudo/become change was the biggest one. 我认为sudo / become变化是最大的变化。 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. 如果您想避免麻烦并且不一定需要最新版本,则可以将其升级到1.9之前的版本,并且无需更改即可获得通过的更多机会。

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. Ansible 2.0发行版即将推出,并将引入许多非常有用的新功能。

  1. Is it possible to achieve the desire outout by shell command. 是否有可能通过shell命令实现期望输出。

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. 通常,您应该首先在测试/临时环境上测试Ansible的每个新版本。 If you do not have testing hosts you can set up local VM's. 如果您没有测试主机,则可以设置本地VM。 There you can test and fix your play. 在那里您可以测试并修复您的游戏。

Since login_port of mysql_repilcation module is not supported in ansible 1.7 version. 由于ansible 1.7版本不支持mysql_repilcation模块的login_port。 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM