我使用 ansible 在 centos 7 中向 firewalld 添加了一些规则。但我必须重新加载 firewalld 守护进程,这样服务才能正常工作。有什么想法吗?
这是我的ansible代码:
- name: Add port to firewalld
firewalld:
port: "{{ item }}"
permanent: yes
state: enabled
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'
loop:
- 8080/tcp
- 8000/tcp
- 8090/tcp
- 8040/tcp
Run Code Online (Sandbox Code Playgroud)