3.4. 创建新 playbook 以自动化防火墙配置
创建新 playbook,并使用 RHEL 系统角色集合来自动化 Red Hat Enterprise Linux 防火墙配置。
-
在 Dev Spaces 实例中,点
。 -
为文件名输入
firewall.yml,然后单击 OK 将其保存到根目录中。 在您的
firewall.yml文件中添加以下行:--- - name: Open HTTPS and SSH on firewall hosts: rhel become: true tasks: - name: Use rhel system roles to allow https and ssh traffic vars: firewall: - service: https state: enabled permanent: true immediate: true zone: public - service: ssh state: enabled permanent: true immediate: true zone: public ansible.builtin.include_role: name: redhat.rhel_system_roles.firewall
注意
您可以将 Ansible Lightspeed 与 IBM watsonx Code Assistant 搭配使用,以帮助您生成 playbook。如需更多信息,请参阅使用 IBM watsonx Code Assistant 用户指南的 Ansible Lightspeed。