当前位置:网站首页>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
边栏推荐
猜你喜欢

kubernetes资源对象介绍及常用命令(五)-(ConfigMap)

【一起上水硕系列】Day 10

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

2022.DAY592

6.23 warehouse operation on Thursday

Technical analysis of qianyuantong multi card aggregation router

Yolov5 model construction source code details | CSDN creation punch in

Hotel public broadcasting background music - Design of hotel IP network broadcasting system based on Internet +

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

redis 无法远程连接问题。
随机推荐
Pessimistic lock and optimistic lock of multithreading
获取并监控远程服务器日志
【一起上水硕系列】Day 7 内容+Day8
ES7 easy mistakes in index creation
Covering Safari and edge, almost all mainstream browsers have realized webgl 2.0 support
Communication - how to be a good listener?
期末复习DAY8
Brief introduction of realsense d435i imaging principle
Introduction to redis using Lua script
Redis使用Lua脚本简介
一起上水硕系列】Day 9
2022.6.30DAY591
PHP笔记超详细!!!
Altaro virtual machine replication failed: "unsupported file type vmgs"
今天很多 CTO 都是被幹掉的,因為他沒有成就業務
Calculation method of AUC
Congratulations to musk and NADELLA on their election as academicians of the American Academy of engineering, and Zhang Hongjiang and Fang daining on their election as foreign academicians
期末复习(DAY6)
Niuke JS separator
Jetson AgX Orin platform porting ar0233 gw5200 max9295 camera driver