--- - name: 关闭防火墙 hosts: all # 或者指定特定的主机组 become: yes # 使用sudo权限 tasks: - name: 停止firewalld服务 systemd: name: firewalld state: stopped - name: 禁用firewalld服务 systemd: name: firewalld enabled: no
ansible-playbook disable_firewall.yml
--- - name: 关闭防火墙 hosts: all # 或者指定特定的主机组 become: yes # 使用sudo权限 tasks: - name: 停止firewalld服务 systemd: name: firewalld state: stopped - name: 禁用firewalld服务 systemd: name: firewalld enabled: no
ansible-playbook disable_firewall.yml