ansible 修改firewalld_ansible 常用模块:firewalld 使用

- name: Manage arbitrary ports/services with firewalld

firewalld:

icmp_block: # The ICMP block you would like to add/remove to/from a zone in firewalld.

icmp_block_inversion: # Enable/Disable inversion of ICMP blocks for a zone in firewalld.

immediate: # Should this configuration be applied immediately, if set as permanent.

interface: # The interface you would like to add/remove to/from a zone in firewalld.

masquerade: # The masquerade setting you would like to enable/disable to/from zones within firewalld.

offline: # Whether to run this module even when firewalld is offline.

permanent: # Should this configuration be in the running firewalld configuration or persist across reboots. As of Ansible 2.3, permanent

operations can operate on firewalld configs when it is not running (requires firewalld >= 3.0.9).

Note that if this is `no', immediate is assumed `yes'.

port: # Name of a port or port range to add/remove to/from firewalld. Must be in the form PORT/PROTOCOL or PORT-PORT/PROTOCOL for port

ranges.

rich_rule: # Rich rule to add/remove to/from firewalld.

service: # Name of a service to add/remove to/from firewalld. The service must be listed in output of firewall-cmd --get-services.

source: # The source/network you would like to add/remove to/from firewalld.

state: # (required) Enable or disable a setting. For ports: Should this port accept (enabled) or reject (disabled) connections. The states

`present' and `absent' can only be used in zone level operations (i.e. when no other parameters but

zone and state are set).

timeout: # The amount of time the rule should be in effect for when non-permanent.

zone: # The firewalld zone to add/remove to/from. Note that the default zone can be configured per system but `public' is default from

upstream. Available choices can be extended based on per-system configs, listed here are "out of the

box" defaults. Possible values include `block', `dmz', `drop', `external', `home', `internal',

`public', `trusted', `work'.

例子:允许 HTTP访问

- name: the firewall port for http is open

firewalld:

service: http

permanent: true

immediate: true

state: enabled

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值