解决一个ansible的filter找不到的问题

这两天在部署SONiC VS Testbed的时候,总是被下面这个报错困扰。

TASK [vm_set:Extract VM names from inventory] *********************************
task path: /var/johnar/sonic-mgmt/ansible/roles/vm_set/tasks.main.yml:184
fatal:[STR-ACS-VSERV-01]:FAILED!=>{
     ‘msg’:"template error while templating string:no filter named 'extract_by_prefix'. String:{{ group_names|extract_by_prefix('server_')}}
}

实际上,filter.py是可以找到的

johnar@9fa161155f72:~/sonic-mgmt/ansible$ cat ansible.cfg | grep filter
filter_plugins     = plugins/filter
johnar@9fa161155f72:~/sonic-mgmt/ansible$ ll plugins/filter/
total 24
drwxrwxr-x 2 johnar 1000 4096 Jul 21 09:04 ./
drwxrwxr-x 6 johnar 1000 4096 Jul 21 07:58 ../
-rw-r--r-- 1 johnar 1000 5919 Jul 21 07:58 filters.py
-rw-r--r-- 1 johnar 1000 6078 Jul 21 09:04 filters.pyc
johnar@9fa161155f72:~/sonic-mgmt/ansible$ 

最后试了一下

johnar@9fa161155f72:~/sonic-mgmt/ansible$ sudo mkdir /etc/ansible
johnar@9fa161155f72:~/sonic-mgmt/ansible$ sudo cp ansible.cfg /etc/ansible/

不再报错!!!!

如果还是不行,那么就修改/etc/ansible/ansible.cfg,将filter路径使用绝对路径

- filter_plugins     = plugins/filter
+ filter_plugins     = /var/johnar/sonic-mgmt/ansible/plugins/filter
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值