Ansible bulk forwarding control method and device

By setting firewall port forwarding rules and whitelists on the forwarding host, and dynamically adding target hosts to the Ansible host list, the problem of Ansible being unable to directly issue commands is solved, achieving efficient and secure batch forwarding control.

CN118764239BActive Publication Date: 2026-04-17CHINA TELECOM CLOUD TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CLOUD TECH CO LTD
Filing Date
2024-06-27
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing Ansible technology cannot effectively solve the problem of batch forwarding control for target hosts that cannot be directly connected on network links, and existing methods require manual interactive settings or cannot directly issue Ansible commands.

Method used

By identifying the forwarding host, setting firewall port forwarding rules with a connection whitelist, dynamically adding the target host to the Ansible host list, and issuing Ansible tasks based on the hosts file, and canceling rules without manual interaction, network security is maintained.

Benefits of technology

It enables flexible control of firewall forwarding rules without changing the Ansible client configuration, and automatically and efficiently issues Ansible commands, ensuring network security and ease of operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118764239B_ABST
    Figure CN118764239B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of Ansible bulk forwarding control method and device, belong to forwarding control technical field, the method comprises: determining forwarding host;Firewall port forwarding rule task is issued to forwarding host for setting;Determine target host, join target host to Ansible host inventory, and write the dynamic of target host into Ansible hosts file;According to Ansible hosts file, issue Ansible task to target host.The present application supports client one-stop direct issuance of Ansible instruction, does not change the general configuration of Ansible client, without putting instruction to forwarding host execution, client does not need to listen to port, and the environment of issuance is convenient and controllable;Forwarding rule is flexible and controllable, can increase, can reduce, take effect immediately, without manual interactive operation;Through whitelist control, the network security of target host that cannot be directly connected on network link is maintained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of bulk forwarding control technology, and particularly relates to an Ansible bulk forwarding control method and apparatus. Background Technology

[0002] In applications that use Ansible to connect to target hosts from a management node, tasks can be batch-deployed to hosts in specified groups. However, for target hosts that cannot be directly connected via network links, it is necessary to address the issue of forwarding control while retaining Ansible's advantages in batch automated operations and maintenance.

[0003] In existing technologies:

[0004] Ansible itself cannot solve this problem.

[0005] Among common SSH forwarding methods, sshpass can only execute shell scripts on target hosts that cannot be directly connected from the forwarding host; it cannot directly issue Ansible commands. The ssh -l command method requires manual interactive configuration and cannot be directly configured through Ansible.

[0006] A similar patent, "A Method and System for Realizing Network Element Communication in IP Unreachable Scenarios" (CN202010737939.1), designs a communication method from a network management system to a non-gateway network element. However, this method requires the network management node to listen to a port. When the network management node does not have the conditions to listen to the port due to network, security, or management reasons, the method will not work. Summary of the Invention

[0007] In view of the shortcomings of the prior art, the purpose of this invention is to provide an Ansible bulk forwarding control method, device, electronic device and storage medium that supports one-stop direct issuance of Ansible commands by the client without changing the general configuration of the Ansible client, without requiring the commands to be executed on the forwarding host, without the client needing to listen on a port, and with a convenient and controllable issuance environment; the forwarding rules are flexible and controllable, can be added or removed, and take effect immediately without manual interactive operation; and the network security of target hosts that cannot be directly connected on the network link is maintained through whitelist control.

[0008] A first aspect of the present invention provides an Ansible bulk forwarding control method, comprising:

[0009] Identify the forwarding host;

[0010] Issue a task to configure firewall port forwarding rules to the forwarding host;

[0011] Identify the target host, add the target host to the Ansible host list, and dynamically write the target host to the first Ansible hosts file;

[0012] Ansible tasks are issued to the target host based on the first Ansible hosts file.

[0013] Furthermore, the aforementioned Ansible bulk forwarding control method also includes:

[0014] Issue a task to the forwarding host to cancel the firewall port forwarding rule.

[0015] Furthermore, in the aforementioned Ansible bulk forwarding control method, determining the forwarding host includes: determining the host that can directly connect to the target host through Ansible as the forwarding host.

[0016] Furthermore, in the aforementioned Ansible bulk forwarding control method, the task of setting firewall port forwarding rules for the forwarding host includes:

[0017] Configure firewall forwarding rules for the forwarding host, and also configure the corresponding connection whitelist;

[0018] The firewall forwarding rules include: exposed port, target host IP, and target port;

[0019] The connection whitelist includes the IPs of the Ansible task platform.

[0020] Furthermore, in the aforementioned Ansible bulk forwarding control method, determining the target host includes: identifying a host that cannot be directly connected to via a network link as the target host.

[0021] Furthermore, in the aforementioned Ansible bulk forwarding control method, the Ansible host list includes: the name of the forwarding host, the connection IP of the forwarding host, the connection port of the forwarding host, the connection user of the forwarding host, the connection password of the forwarding host, the name of the target host, the connection IP of the target host, the connection port of the target host, the connection user of the target host, and the connection password of the target host.

[0022] Furthermore, in the aforementioned Ansible bulk forwarding control method, the dynamic writing of the target host to the first Ansible hosts file is done via Ansible commands.

[0023] A second aspect of the present invention also provides an Ansible bulk forwarding control device, comprising:

[0024] First determination module: used to determine the forwarding host;

[0025] Configuration module: Used to issue tasks to configure firewall port forwarding rules to the forwarding host;

[0026] Add and write modules: These are used to determine the target host, add the target host to the Ansible host list, and dynamically write the target host to the first Ansible hosts file.

[0027] The dispatch module is used to dispatch Ansible tasks to the target host based on the first Ansible hosts file.

[0028] A third aspect of the present invention also provides an electronic device comprising: a processor and a memory;

[0029] The processor executes an Ansible bulk forwarding control method as described above by calling programs or instructions stored in the memory.

[0030] In a fourth aspect, the present invention also provides a computer-readable storage medium storing a program or instructions that cause a computer to perform an Ansible bulk forwarding control method as described in any one of the above claims.

[0031] The beneficial effects of this invention are as follows: Compared to methods where a target host that cannot be directly connected is directly accessed, the firewall forwarding rules set by this invention are flexible and controllable, and can be whitelisted, basically maintaining the network security of the target host; Compared to using sshpass, which can only execute shell scripts on hosts within an isolated network on directly connected hosts and cannot directly issue Ansible commands; This invention does not require changing the general configuration of the Ansible client, nor does it require placing the commands on the forwarding host for execution, ensuring convenient and controllable distribution environment; Compared to using the ssh -l command, which requires manual interactive settings and cannot be directly set through Ansible; This invention requires no interactive settings, and the entire distribution process is seamless, efficient, and automated; Compared to the method in the authorization number CN202010737939.1 of "A Method and System for Implementing Network Element Communication in IP Unreachable Scenarios", the Ansible client of this invention does not need to open and listen to additional ports, meeting the needs of clients that do not have the conditions to listen to ports due to network, security, management, or other reasons. Attached Figure Description

[0032] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts. It is obvious that the drawings described below are merely some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings.

[0033] Figure 1 A diagram illustrating an Ansible bulk forwarding control method provided in an embodiment of the present invention;

[0034] Figure 2 This is a scenario diagram of Ansible bulk forwarding control provided in an embodiment of the present invention;

[0035] Figure 3 This is a schematic diagram illustrating a solution for an Ansible bulk forwarding control scenario provided by an embodiment of the present invention;

[0036] Figure 4 A diagram of an Ansible bulk forwarding control device provided in an embodiment of the present invention;

[0037] Figure 5 A schematic block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0038] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. It should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0039] Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts disclosed in this invention.

[0040] In the description of this invention, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance. The terms "installed," "connected," and "linked" should be interpreted broadly; for example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art will understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0041] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of methods and systems consistent with some aspects of the invention as detailed in the appended claims.

[0042] Before introducing the embodiments of the present invention, the technical terms involved in the present invention will be introduced first.

[0043] Ansible is an open-source automation tool for configuration management, application deployment, orchestration, and coordination. It makes automation not only simple and easy to use but also highly scalable. Ansible uses concise YAML syntax to define tasks and playbooks, uses a hosts file to define target hosts, connects to target hosts via the SSH protocol, and executes tasks using the management node's own Python.

[0044] This invention proposes an Ansible bulk forwarding control method, device, electronic device, and storage medium, which supports one-stop direct issuance of Ansible commands by the client without changing the general configuration of the Ansible client, eliminating the need to place the commands on the forwarding host for execution, and requiring no client to listen on a port. The issuance environment is convenient and controllable. Forwarding rules are flexible and controllable, can be added or removed, and take effect immediately without manual interactive operation. Through whitelist control, the network security of target hosts that cannot be directly connected on the network link is maintained.

[0045] Method Implementation Examples

[0046] Figure 1 This diagram illustrates an Ansible bulk forwarding control method provided in an embodiment of the present invention.

[0047] In a first aspect, the present invention proposes an Ansible bulk forwarding control method, combined with Figure 1 ,include:

[0048] S1: Determine the forwarding host.

[0049] Specifically, in this embodiment of the invention, the host that can directly connect to the target host through Ansible is determined as the forwarding host. For example, the forwarding host can be the host machine that directly accesses the target storage virtual machine. Here, the target storage virtual machine cannot be directly accessed by hosts other than the host machine.

[0050] S2: Issue a task to configure firewall port forwarding rules to the forwarding host.

[0051] Specifically, in this embodiment of the invention, setting firewall port forwarding rules for the forwarding host involves setting firewall forwarding rules for the forwarding host and setting a corresponding connection whitelist; wherein, the firewall forwarding rules include: exposed port, target host IP and target port; the connection whitelist includes: the IP of the Ansible task platform.

[0052] S3: Determine the target host, add the target host to the Ansible host list, and dynamically write the target host to the first Ansible hosts file.

[0053] Specifically, in this embodiment of the invention, the host that cannot be directly connected on the network link is identified as the target host, the target host is added to the Ansible host list, and the information of the host that cannot be directly connected on the network link is dynamically written to a new Ansible hosts file through Ansible commands.

[0054] For example, the forwarding host can be the host machine that directly accesses the target storage virtual machine. Here, the target storage virtual machine cannot be directly accessed by any host other than the host machine. The target storage virtual machine is the target host.

[0055] S4: Issue Ansible tasks to the target host based on the first Ansible hosts file.

[0056] Specifically, in this embodiment of the invention, Ansible tasks are issued to any target host on the network link as needed through a new Ansible hosts file.

[0057] In this embodiment of the invention, determining the forwarding host, issuing a task to the forwarding host to set firewall port forwarding rules, determining the target host, adding the target host to the Ansible host list, dynamically writing the target host's information into the first Ansible hosts file, issuing Ansible tasks to the target host based on the first Ansible hosts file, and issuing a task to the forwarding host to cancel firewall port forwarding rules can all be achieved in one stop within the tasks defined in the Ansible YAML file of the management node, which is simple and efficient.

[0058] Furthermore, the aforementioned Ansible bulk forwarding control method also includes:

[0059] Issue a task to the forwarding host to cancel the firewall port forwarding rule.

[0060] Specifically, after the task is completed, a task to cancel firewall port forwarding rules is issued to the forwarding host. The operation is simple and quick.

[0061] Furthermore, in the aforementioned Ansible bulk forwarding control method, determining the forwarding host includes: determining the host that can directly connect to the target host through Ansible as the forwarding host.

[0062] For example, the forwarding host can be a host machine that can directly access the target storage virtual machine through Ansible. Here, the target storage virtual machine cannot be directly accessed by any host other than the host machine.

[0063] Furthermore, in the aforementioned Ansible bulk forwarding control method, the task of setting firewall port forwarding rules for the forwarding host includes:

[0064] Configure firewall forwarding rules for the forwarding host, and also configure the corresponding connection whitelist;

[0065] The firewall forwarding rules include: exposed port, target host IP, and target port;

[0066] The connection whitelist includes the IPs of the Ansible task platform.

[0067] For example, the exposed ports are 9001 to 9..n, the target host IPs are 192.168.1.1 to 192.168.xn, the target port is port 22 of 192.168.1.1 to 192.168.xn, and the whitelist is the IP of the wizard-driven task platform, which ensures the security of the connection. The firewall forwarding rules and connection whitelist can be combined into a table to make the firewall forwarding rules and connection whitelist more intuitive.

[0068] Furthermore, in the aforementioned Ansible bulk forwarding control method, determining the target host includes: identifying a host that cannot be directly connected to via a network link as the target host.

[0069] For example, the forwarding host can be the host machine that directly accesses the target storage virtual machine. Here, the target storage virtual machine cannot be directly accessed by any host other than the host machine. The target storage virtual machine is the target host.

[0070] Furthermore, in the aforementioned Ansible bulk forwarding control method, the Ansible host list includes: the name of the forwarding host, the connection IP of the forwarding host, the connection port of the forwarding host, the connection user of the forwarding host, the connection password of the forwarding host, the name of the target host, the connection IP of the target host, the connection port of the target host, the connection user of the target host, and the connection password of the target host.

[0071] The forwarding host's name, the forwarding host's connection IP, the forwarding host's connection port, the forwarding host's connection user, the forwarding host's connection password, the target host's name, the target host's connection IP, the target host's connection port, the target host's connection user, and the target host's connection password can be combined to form an Ansible host list presented in tabular form.

[0072] Furthermore, in the aforementioned Ansible bulk forwarding control method, the dynamic writing of the target host to the first Ansible hosts file is done via Ansible commands.

[0073] The following describes an Ansible bulk forwarding control method of the present invention with reference to a specific embodiment.

[0074] Figure 2 This is a scenario diagram of Ansible bulk forwarding control provided in an embodiment of the present invention.

[0075] Combination Figure 2 During the installation and deployment of the China Telecom Cloud iStack cloud-native appliance, the wizard-guided task platform requires the deployment of a storage cluster on the target storage virtual machines 192.168.1.1 to 192.168.xn on the host machine (1 to n). However, for data security reasons, the target storage virtual machines cannot be directly accessed by hosts other than the host machine.

[0076] Figure 3 This is a schematic diagram illustrating a solution for an Ansible bulk forwarding control scenario provided by an embodiment of the present invention.

[0077] For the above use case, host machine 1 is selected as the forwarding host for managing the target storage virtual machine, combined with Figure 3 This includes the following steps:

[0078] Step 1: The host machine 1 that Ansible connects to is the forwarding host.

[0079] Step 2: In the Ansible task, issue a task to configure firewall port forwarding rules for the forwarding host, exposing ports 9001 to 9..n, which correspond to forwarding to port 22 of the target storage virtual machine 192.168.1.1 to 192.168.xn respectively. The settings will then take effect.

[0080] Step 3: In the Ansible task, add the name, connection IP, connection port, connection user, and connection password of the target storage virtual machine (192.168.1.1 to 192.168.xn) to the Ansible host list. The connection IP is host machine 1, and the port number is the exposed port 9001 to 9..n of host machine 1's firewall. This is not limited to these ports and can also be an unused port. The whitelist is the IP of the wizard task platform to ensure connection security.

[0081] Step 4: For the target storage virtual machine in the Ansible host list, directly issue an Ansible task to install the storage cluster.

[0082] Step 5: After installation, remove the port forwarding rules from the firewall of host machine 1.

[0083] The above five steps enable the wizard-driven task platform to directly issue Ansible commands in one stop, without changing the general configuration of the Ansible client or placing the commands on the forwarding host for execution. The issuance environment is convenient and controllable; the forwarding rules are flexible and controllable, can be added or removed, and take effect immediately without manual interactive operation; and the network security of the storage cluster in the target storage virtual machine is maintained through whitelist control.

[0084] Device Examples

[0085] Figure 4 This is a diagram of an Ansible bulk forwarding control device provided in an embodiment of the present invention.

[0086] A second aspect of the present invention also provides an Ansible bulk forwarding control device, comprising:

[0087] First determination module 41: Used to determine the forwarding host.

[0088] Specifically, in this embodiment of the invention, the first determining module 41 determines the host that can directly connect to the target host through Ansible as the forwarding host. For example, the forwarding host can be the host machine that can directly access the target storage virtual machine through Ansible. Here, the target storage virtual machine cannot be directly accessed by hosts other than the host machine.

[0089] Configuration module 42: Used to issue firewall port forwarding rule configuration tasks to the forwarding host.

[0090] Specifically, in this embodiment of the invention, the setting module 42 issues firewall port forwarding rules to the forwarding host, and sets firewall forwarding rules for the forwarding host, and sets a corresponding connection whitelist; wherein, the firewall forwarding rules include: exposed port, target host IP and target port; the connection whitelist includes: the IP of the Ansible task platform.

[0091] Add module 43 and write module 44: Used to determine the target host, add the target host to the Ansible host list, and dynamically write the target host to the first Ansible hosts file.

[0092] Specifically, in this embodiment of the invention, the adding module 43 determines the host that cannot be directly connected on the network link as the target host, adds the target host to the Ansible host list, and the writing module 44 dynamically writes the information of the host that cannot be directly connected on the network link into a new Ansible hosts file through Ansible commands.

[0093] For example, the forwarding host can be the host machine that directly accesses the target storage virtual machine. Here, the target storage virtual machine cannot be directly accessed by any host other than the host machine. The target storage virtual machine is the target host.

[0094] Module 45: Used to distribute Ansible tasks to the target host based on the first Ansible hosts file.

[0095] Specifically, in this embodiment of the invention, Ansible tasks are issued to any target host on the network link as needed through a new Ansible hosts file.

[0096] In this embodiment of the device, the first determining module 41 determines the forwarding host, the setting module 42 issues a task to the forwarding host to set firewall port forwarding rules, the adding module 43 and the writing module 44 determine the target host, add the target host to the Ansible host list, dynamically write the target host to the first Ansible hosts file, and the issuing module 45 issues Ansible tasks to the target host according to the first Ansible hosts file. The task to cancel firewall port forwarding rules on the forwarding host can all be implemented in one stop within the task defined in the Ansible YAML file of the management node, which is simple and efficient.

[0097] A third aspect of the present invention also provides an electronic device comprising: a processor and a memory;

[0098] The processor executes an Ansible bulk forwarding control method as described above by calling programs or instructions stored in the memory.

[0099] In a fourth aspect, the present invention also provides a computer-readable storage medium storing a program or instructions that cause a computer to perform an Ansible bulk forwarding control method as described in any one of the above claims.

[0100] Figure 5 This is a schematic block diagram of an electronic device provided in an embodiment of the present invention.

[0101] like Figure 5 As shown, the electronic device includes at least one processor 501, at least one memory 502, and at least one communication interface 503. The various components in the electronic device are coupled together via a bus system 504. The communication interface 503 is used for information transmission with external devices. It is understood that the bus system 504 is used to implement communication between these components. In addition to a data bus, the bus system 504 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 5 The general designated all buses as Bus System 504.

[0102] It is understood that the memory 502 in this embodiment can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory.

[0103] In some implementations, memory 502 stores elements such as executable units or data structures, or subsets thereof, or extended sets thereof: operating systems and applications.

[0104] The operating system includes various system programs, such as the framework layer, core library layer, and driver layer, used to implement various basic business functions and handle hardware-based tasks. The application programs include various applications, such as media players and browsers, used to implement various application functions. A program implementing any method in the Ansible bulk forwarding control method provided in this embodiment of the invention can be included in the application programs.

[0105] In this embodiment of the invention, the processor 501 executes the steps of various embodiments of the Ansible bulk forwarding control method provided in this embodiment of the invention by calling the program or instructions stored in the memory 502, specifically, the program or instructions stored in the application program.

[0106] Identify the forwarding host;

[0107] The task of setting firewall port forwarding rules is issued to the forwarding host;

[0108] Identify the target host, add the target host to the Ansible host list, and dynamically write the target host to the first Ansible hosts file;

[0109] Ansible tasks are issued to the target host based on the first Ansible hosts file.

[0110] Any method in the Ansible bulk forwarding control method provided in this embodiment of the invention can be applied to, or implemented by, the processor 501. The processor 501 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 501 or by instructions in software form. The processor 501 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor.

[0111] The steps of any method in the Ansible bulk forwarding control method provided in this embodiment of the invention can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software units in the decoding processor. The software units can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory 502, and processor 501 reads the information in memory 502 and combines it with its hardware to complete the steps of the method.

[0112] Those skilled in the art will understand that although some embodiments described herein include certain features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention and form different embodiments.

[0113] Those skilled in the art will understand that the descriptions of the various embodiments have different focuses, and for parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0114] Although embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention. All such modifications and variations fall within the scope defined by the appended claims. The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

[0115] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. An Ansible bulk forwarding control method, characterized by, include: Identify the forwarding host; The task of setting firewall port forwarding rules is issued to the forwarding host; Identify the target host, add the target host to the Ansible host list, and dynamically write the target host to the first Ansible hosts file; Ansible tasks are issued to the target host based on the first Ansible hosts file; After the task of setting up firewall port forwarding rules is completed, the task of canceling firewall port forwarding rules is issued to the forwarding host. The determination of the forwarding host includes: determining the host that can be directly connected to the target host through Ansible as the forwarding host; The determination of the target host includes: determining the host that cannot be directly connected to through the network link as the target host; The firewall port forwarding rules include: exposed port, target host IP, and target port.

2. The Ansible bulk forwarding control method of claim 1, wherein, The task of setting firewall port forwarding rules is issued to the forwarding host, including: Configure firewall port forwarding rules for the forwarding host, and also configure the corresponding connection whitelist; The connection whitelist includes the IP addresses of the Ansible task platform.

3. The Ansible bulk forwarding control method of claim 1, wherein, The Ansible host list includes: the name of the forwarding host, the connection IP of the forwarding host, the connection port of the forwarding host, the connection user of the forwarding host, the connection password of the forwarding host, the name of the target host, the connection IP of the target host, the connection port of the target host, the connection user of the target host, and the connection password of the target host.

4. The Ansible bulk forwarding control method of claim 1, wherein, The dynamic writing of the target host to the first Ansible hosts file is done using Ansible commands.

5. An Ansible bulk forwarding control device, characterized in that, include: First determination module: used to determine the forwarding host; Configuration module: Used to issue tasks to configure firewall port forwarding rules to the forwarding host; Add and write modules: These are used to determine the target host, add the target host to the Ansible host list, and dynamically write the target host to the first Ansible hosts file. The distribution module is used to distribute Ansible tasks to the target host based on the first Ansible hosts file. After the task of setting up firewall port forwarding rules is completed, the task of canceling firewall port forwarding rules is issued to the forwarding host. The determination of the forwarding host includes: determining the host that can be directly connected to the target host through Ansible as the forwarding host; The determination of the target host includes: determining the host that cannot be directly connected to through the network link as the target host; The firewall port forwarding rules include: exposed port, target host IP, and target port.

6. An electronic device, comprising: include: Processor and memory; The processor executes an Ansible bulk forwarding control method as described in any one of claims 1 to 4 by calling programs or instructions stored in the memory.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program or instructions that cause a computer to perform an Ansible bulk forwarding control method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • A method and system for implementing network element communication in IP-unreachable scenarios

    CN111918306B

  • Dynamic monitoring-based iptables firewall policy auditing method and device, and medium

    CN115567293A

  • Linux system host and extension module configuration method, data transmission method and system

    CN118233378A