我试过很多方法来做这个。我有一些防火墙规则,比ufw模块支持的要复杂一些。不过,如果真的有必要的话,我可能会用到这个模块。
到目前为止,我已经尝试了以下方法: 1.将规则放入shell脚本并异步执行。似乎有些时候起作用了。规则被应用了,但是ansible挂起。
- name: Apply firewall rules
shell: iptables.sh
async: 45
poll: 5有人在这方面取得过成功吗?
发布于 2022-04-08 17:07:34
使用一个规则文件,然后像这样使用iptables还原:
- name: Do not wait for a response
shell: >
iptables-restore /tmp/rules.v4
become: true
async: 10
poll: 0https://stackoverflow.com/questions/30270301
复制相似问题