![如何使用 Ansible ufw 模块设置 UFW DEFAULT_FORWARD_POLICY?](https://linux22.com/image/692363/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20Ansible%20ufw%20%E6%A8%A1%E5%9D%97%E8%AE%BE%E7%BD%AE%20UFW%20DEFAULT_FORWARD_POLICY%EF%BC%9F.png)
答案1
这篇文章似乎很老了,但对于正在寻找这个问题的人来说,下面的任务对我有用
- name: 'Allow docker DEFAULT_FORWARD_POLICY=ACCEPT'
ufw: direction=routed default=allow route=yes
希望对某人有帮助
答案2
ufw
在发布使用该模块的解决方案之前,以下是我目前lineinfile
为遇到类似问题的人提供的解决方案:
---
- name: docker
hosts: docker
become: true
become_user: root
handlers:
- name: reload ufw
command: ufw reload
tasks:
- name: set UFW default forward policy to ACCEPT
lineinfile:
dest: /etc/default/ufw
line: DEFAULT_FORWARD_POLICY="ACCEPT"
regexp: "^DEFAULT_FORWARD_POLICY\\="
notify: reload ufw