当前位置:网站首页>Ansible firewall firewalld setting
Ansible firewall firewalld setting
2022-07-03 05:37:00 【Shuibutian】
ansible A firewall firewalld Set up
background
A firewall By organically combining all kinds of software and hardware equipment for safety management and screening , Help the computer network in it 、 Build a relatively isolated protective barrier between the external networks , A technology to protect user data and information security .
As far as computers are concerned, firewalls are divided into hardware and software , This article starts from the firewall of software , Introduce the firewall technology of the operating system .
Firewall setting is one of the common operations in the process of program deployment . This article ansible Introduction to the carrier , Traditional firewall settings reference 《centos7 Firewall settings 》
demand
Switch the firewall for the assigned server 、 Port policy and service settings .
operation
ansible Operation firewall involves three parts in this chapter
- Switch of firewall
- Firewall port policy
- Firewall service policy
Switch of firewall
The switch of firewall uses ansible Medium service service
open
# Turn on firewalld service
- hosts: middleware
# Remote task execution user
remote_user: root
# Task list
tasks:
# Get service information in the system
- name: checking service
ansible.builtin.service_facts:
# Statement
- name: Turn on firewalld A firewall
service:
name: firewalld
state: started
enabled: yes
when: ansible_facts.services['firewalld.service'] is defined
If you need to turn off the firewall state The status is set to stopped
verification
$ ansible middleware -a 'systemctl status firewalld' -i hosts
Firewall port policy
open
# Set up firewalld Port policy
- hosts: middleware
# Remote task execution user
remote_user: root
# Task list
tasks:
# Statement
- name: Set up firewalld Port policy
firewalld:
port: 8848/tcp
state: enabled
permanent: yes
immediate: yes
verification
$ ansible middleware -m shell -a 'firewall-cmd --lists-ports' -i hosts
Firewall service policy
open
# Set up firewalld Service strategy
- hosts: middleware
# Remote task execution user
remote_user: root
# Task list
tasks:
# Statement
- name: Set up firewalld Service strategy
firewalld:
service: http
state: enabled
permanent: yes
immediate: yes
verification
$ ansible middleware -m shell -a 'firewall-cmd --lists-services' -i hosts
边栏推荐
- Best practices for setting up altaro VM backups
- (subplots usage) Matplotlib how to draw multiple subgraphs (axis field)
- Go practice -- use redis in golang (redis and go redis / redis)
- Redis Introduction et explication des types de données
- (subplots用法)matplotlib如何绘制多个子图(轴域)
- [untitled]
- 穀歌 | 蛋白序列的深度嵌入和比對
- 2022.7.2day594
- Altaro virtual machine replication failed: "unsupported file type vmgs"
- XML Configuration File
猜你喜欢

@Autowired 导致空指针报错 解决方式

小学校园IP网络广播-基于校园局域网的小学IP数字广播系统设计

Webrtc protocol introduction -- an article to understand ice, stun, NAT, turn

Latest version of source insight

How to install and configure altaro VM backup for VMware vSphere

Shanghai daoning, together with American /n software, will provide you with more powerful Internet enterprise communication and security component services

DEX net 2.0 for crawl detection

"C and pointer" - Chapter 13 advanced pointer int * (* (* (*f) () [6]) ()

Analysis of the example of network subnet division in secondary vocational school

Redis cannot connect remotely.
随机推荐
Installing altaro VM backup
Today, many CTOs were killed because they didn't achieve business
Sophomore dilemma (resumption)
Introduction to redis and explanation of data types
【一起上水硕系列】Day 7 内容+Day8
Redis 入门和数据类型讲解
Deploy crawl detection network using tensorrt (I)
期末复习(day3)
谷歌 | 蛋白序列的深度嵌入和比对
Rust基础入门之(基本类型)
Learn libcef together -- set cookies for your browser
Altaro requirements for starting from backup on Hyper-V
Niuke JS separator
Common interview questions of microservice
Redis encountered noauth authentication required
Apache+PHP+MySQL环境搭建超详细!!!
Can altaro back up Microsoft teams?
Configure and use Anaconda environment in pycharm
3dslam with 16 line lidar and octomap
2022.7.2 模拟赛