重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1695|回复: 0
打印 上一主题 下一主题

[认证考试] ansible 常用模块:firewalld 使用

[复制链接]
跳转到指定楼层
楼主
发表于 2019-12-10 23:59:08 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
- 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


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-5-19 16:18 , Processed in 0.087111 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表