When i use ansible to execute yum to install something. but in fact ,The remote host auto update system, then it startup a yum Process .
So the ansible wait there forever ,How can I do something usefull ? I’m confused.
The other hand ,Can I see the real output of ansible ? I feel i am blind when the ansible is executing.
Hi,
The most usual cases would be that the remote system is prompting for some user input, are you using the yum module or yum directly in the commandline ? maybe if you are using sudo it is prompting for password or if using yum directly it is asking for confirmation
if shell module is executed running the playbook the debug and killing the ansible python process in the target system might give you some clues on what is happening.
I’m sorry for the late reply, I use the yum module and the shell module to install packages ,Sometimes i can encouter this problem . when the remote host is updating,the remote host startup a yum process . at the same time, I use yum module of ansible to install some packages,then the ansible wait there,no any feedback,
in fact the problem is easy to reappear,example: in the remote host ,start a yum process and don’t let it quit, then use yum module or shell module of ansible to install some packages in the controller host ,then the same problem will appear.
Hi,
What do you expect to happen (as in: should the yum task fail, wait, kill the other yum process, …)?
This is a safeguard from yum to keep you from shooting yourself in the foot. I personally would simply let the yum module wait until completed and if the task should be timeboxed use a wait_for before running the actual yum task (http://docs.ansible.com/wait_for_module.html).
One approach may be to move the “auto updater” to ansible too (it could be as simple as “yum: state=latest name=*”). That way you will have more control when updates happen, the drawback is that you will need to find another mechanism to run it regularly and if your control machine is down then no host will be updated.
The basic problem is that you have two systems fighting over the control of the system: the auto update and ansible. It’s a classic race condition where you just need to decide what is more important to you. Immediate runs from ansible or updates applied to the hosts independently.
Another possibility would also be to use async: http://docs.ansible.com/playbooks_async.html – but that could also add a lot of complexity.
/Martin
Hi,
What I expect to happen is that some notification about the execute status or result of remote hosts. I want to know what shoud I do next rather than wait there silly.
Maybe it’s diffcult to realize that,but i will look forward . I hope ansible can be more great and function . but now I will not tangle this problem any more.
在 2015年6月23日星期二 UTC+8下午6:23:14,Martin Marcher写道: