我正在运行以下ansible脚本,以便能够通过ansible部署我的Java项目:
ansible-playbook -u ansible -i inventory/test-env release.yml
我在ansible的callback_plugins目录下添加了this plugin。 问题是,每当我运行 ansible-playbook 脚本时,此插件中的日志记录最后都会运行多次,并且不一致。有时我会两次获得日志,有时三次。
您知道为什么会发生这种情况以及为什么每次更改日志的数量吗?
我已阅读到,如果插件的命名与ansible本身中的现有插件相同,则可能会导致此问题。因此,我在项目中将此插件的名称更改为其他名称。
请注意,我的旁白版本是:2.4.2
这是我得到的输出:
PLAY RECAP *********************************************************************
def1.test1.domain.com : ok=101 changed=31 unreachable=0 failed=0
def2.test1.domain.com : ok=70 changed=20 unreachable=0 failed=0
abc1.test1.domain.com : ok=6 changed=0 unreachable=0 failed=0
abc2.test1.domain.com : ok=6 changed=0 unreachable=0 failed=0
copy domain to managed servers ----------------------------------------- 97.00s
start managed servers -------------------------------------------------- 82.62s
wait for admin server to start ----------------------------------------- 31.64s
create domain ---------------------------------------------------------- 25.97s
Playbook finished: Wed Jan 30 11:09:04 2019, 114 total tasks. 0:06:17 elapsed.
copy domain to managed servers ----------------------------------------- 97.00s
start managed servers -------------------------------------------------- 82.62s
wait for admin server to start ----------------------------------------- 31.64s
create domain ---------------------------------------------------------- 25.97s
Playbook finished: Wed Jan 30 11:09:04 2019, 114 total tasks. 0:06:17 elapsed.
copy domain to managed servers ----------------------------------------- 97.00s
start managed servers -------------------------------------------------- 82.62s
wait for admin server to start ----------------------------------------- 31.64s
create domain ---------------------------------------------------------- 25.97s
Playbook finished: Wed Jan 30 11:09:04 2019, 114 total tasks. 0:06:17 elapsed.
在日志开头,我发现了这一点:
setting up inventory plugins
Parsed /var/go/pipelines/abc/inventory/test inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc
Loading callback plugin unnamed of type old, v1.0 from /usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc
Loading callback plugin unnamed of type old, v1.0 from /usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc
Loading callback plugin unnamed of type old, v1.0 from /usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc
PLAYBOOK: release.yml **********************************************************
11 plays in release.yml
PLAY [install weblogic] ********************************************************
答案 0 :(得分:0)
问题是我的IntelliJ IDEA中的git插件。即使我已经从IDE中删除了该文件,也没有将其添加到git commit中,并且在pull请求中也没有意识到这一点。
因此,“ profile_tasks.py”被调用了两次,因为它是ansible中的预定义插件,如果您使用相同名称的插件,则ansible会有重复的日志。此外,第三个日志来自重命名的插件,总共打印了3个重复的日志。从项目中手动删除“ profile_tasks.py”后,其中两个被删除,并且日志仅按预期方式打印一次。