当前位置:网站首页>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
边栏推荐
- Principles of BTC cryptography
- Explanation of variables, code blocks, constructors, static variables and initialization execution sequence of static code blocks of Ali interview questions
- "C and pointer" - Chapter 13 advanced pointer int * (* (* (*f) () [6]) ()
- 期末复习(DAY6)
- 获取并监控远程服务器日志
- 请求数据库报错:“could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGram
- Go practice -- use JWT (JSON web token) in golang
- Latest version of source insight
- Go practice -- gorilla/rpc (gorilla/rpc/json) used by gorilla web Toolkit
- "C and pointer" - Chapter 13 function of function pointer 1 - callback function 1
猜你喜欢
![[set theory] relational closure (relational closure related theorem)](/img/6a/b6dca7abf592f8d8ab1d6aecc43381.jpg)
[set theory] relational closure (relational closure related theorem)

Principles of BTC cryptography

Notepad++ wrap by specified character

About debugging the assignment of pagenum and PageSize of the formal parameter pageweb < T > (i.e. page encapsulation generic) in the controller

中职网络子网划分例题解析

Why is go language particularly popular in China

大学校园IP网络广播-厂家基于校园局域网的大学校园IP广播方案设计指南

求质数的方法

Classification and discussion of plane grab detection methods based on learning

2022.DAY592
随机推荐
在PyCharm中配置使用Anaconda环境
2022.DAY592
2022.7.2day594
Intégration profonde et alignement des séquences de protéines Google
6.23 warehouse operation on Thursday
2022.DAY592
Simpleitk learning notes
Bluebridge cup real topic 2020 palindrome date simulation construction provincial competition
@Solutions to null pointer error caused by Autowired
Jetson AgX Orin platform porting ar0233 gw5200 max9295 camera driver
(subplots usage) Matplotlib how to draw multiple subgraphs (axis field)
Go practice -- use redis in golang (redis and go redis / redis)
Altaro virtual machine replication failed: "unsupported file type vmgs"
穀歌 | 蛋白序列的深度嵌入和比對
Go practice -- use JWT (JSON web token) in golang
Go practice -- factory mode of design patterns in golang (simple factory, factory method, abstract factory)
Introduction to redis and explanation of data types
The request database reported an error: "could not extract resultset; SQL [n/a]; needed exception is org.hibernate.exception.sqlgram"
Altaro set grandfather parent child (GFS) archiving
求质数的方法