【解决】firewalld 模块未识别
问题 | firewalld 模块 未被 ansible-playbook 识别
[root@pubserver cluster]# ansible-playbook firewalld.yml
ERROR! couldn't resolve module/action 'firewalld'. This often indicates a misspelling, missing collection, or incorrect module path.The error appears to be in '/root/cluster/firewalld.yml': line 5, column 7, but may
be elsewhere in the file depending on the exact syntax problem.The offending line appears to be:tasks:- name: try to disble^ here
源码 | yml 剧本
[root@pubserver ansible]# vim firewalld.yml
---
- name: firewalld testhosts: webserverstasks:- name: firewall enabledfirewalld:port: 20permanent: trueimmediate: truestate: enabled
解决方法 | 你可能使用的是 ansible-core 精简版
[root@pubserver ansible]# ansible-doc -l | grep -l
89
或
[root@pubserver ansible]# rpm -qa | grep -E '^ansible(-core)?'
ansible-core
的体量低于 ansible
完整版,除基础模块外,firewalld 这些隶属其他模块。
因此需要重新获取 ansible.rpm
。