Ansible batch forwarding control method and device
By determining the forwarding host in Ansible, setting firewall port forwarding rules, and dynamically writing the hosts file, efficient and automated batch forwarding of target hosts that cannot be directly connected on the network link is achieved, which solves the problem of direct delivery in the existing technology. Ansible commands and manual interactive settings maintain network security and flexibility.
Patent Information
- Application Number
- CN202410847993.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-06-27
AI Technical Summary
The existing Ansible batch forwarding technology cannot effectively solve the forwarding control problem of target hosts that cannot be directly connected on the network link. In particular, Ansible commands cannot be directly issued and there is a need for manual interactive settings. Moreover, the existing methods are in the network, It will be invalid when the listening port is not qualified due to security, management and other restrictions.
By determining the forwarding host, setting firewall port forwarding rules, and dynamically writing into the Ansible hosts file, batch forwarding control of the target host is achieved, and the client is supported to directly issue Ansible instructions in one stop without changing the Ansible client configuration. The client does not need to Listening ports, forwarding rules are flexible and controllable, and whitelist controls network security.
It achieves efficient and automated batch forwarding of target hosts that cannot be directly connected on the network link, maintains network security, avoids manual interactive operations, and meets the needs of clients that do not have listening ports due to network, security, management, etc. conditions, providing flexible and controllable forwarding rules and whitelist control.
Smart Images

Figure CN118764239A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of batch forwarding control, and in particular, relates to an Ansible batch forwarding control method and device. Background Art
[0002] In applications that use Ansible to connect to target hosts from management nodes, you can batch issue execution tasks to hosts in a specific group. However, for target hosts that cannot be directly connected to a network link, you need to solve the problem of forwarding control while retaining the advantages of Ansible batch operation and maintenance automation.
[0003] In the existing technology:
[0004] Ansible itself does not solve this problem.
[0005] Among the common SSH forwarding methods, the sshpass method can only execute shell scripts on the forwarding host for the target host that cannot be directly connected, and cannot directly issue Ansible commands. The ssh-l command method requires manual interactive settings and cannot be directly set through Ansible.
[0006] A similar patent, "A method and system for realizing network element communication in IP unreachable scenarios", authorization number CN202010737939.1, designs a communication method from network management to non-gateway network elements, but requires the network management node to perform port monitoring to implement it. However, when the network management node does not have the conditions to monitor the port due to network, security, management and other reasons, this method will not work. Summary of the invention
[0007] In view of the above deficiencies in the prior art, the purpose of the invention is to provide an Ansible batch forwarding control method, device, electronic device and storage medium, which support the client to directly issue Ansible instructions in one stop, without changing the general configuration of the Ansible client, without having to put the instructions on the forwarding host for execution, the client does not need to listen to the port, and the issuing environment is convenient and controllable; the forwarding rules are flexible and controllable, can be increased or decreased, and take effect immediately without manual interactive operations; through whitelist control, the network security of the target host that cannot be directly connected on the network link is maintained.
[0008] A first aspect of the present invention provides an Ansible batch forwarding control method, comprising:
[0009] Determine the forwarding host;
[0010] Send the task of setting firewall port forwarding rules to the forwarding host;
[0011] Determine the target host, add the target host to the Ansible host list, and write the dynamics of the target host into the first Ansible hosts file;
[0012] Issue Ansible tasks to the target host based on the first Ansible hosts file.
[0013] Furthermore, the above-mentioned Ansible batch forwarding control method further includes:
[0014] Send a task to cancel the firewall port forwarding rule to the forwarding host.
[0015] Furthermore, in the above-mentioned Ansible batch forwarding control method, determining the forwarding host includes: determining a host that can be directly connected to the target host through Ansible as the forwarding host.
[0016] Furthermore, in the above-mentioned Ansible batch forwarding control method, sending a task of setting firewall port forwarding rules to the forwarding host includes:
[0017] Set firewall forwarding rules for the forwarding host and set up the corresponding connection whitelist;
[0018] Among them, the firewall forwarding rules include: exposed port, target host IP and target port;
[0019] Connection whitelist, including: IP address of the Ansible task platform.
[0020] Furthermore, in the above-mentioned Ansible batch forwarding control method, determining the target host includes: determining a host that cannot be directly connected through a network link as the target host.
[0021] Furthermore, in the above-mentioned Ansible batch 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 above-mentioned Ansible batch forwarding control method, the dynamic writing of the target host into the first Ansible hosts file is done through an Ansible command.
[0023] A second aspect of the present invention further provides an Ansible batch forwarding control device, comprising:
[0024] The first determination module is used to determine the forwarding host;
[0025] Setting module: used to send a task of setting firewall port forwarding rules to the forwarding host;
[0026] Join module and write module: used to determine the target host, add the target host to the Ansible host list, and write the dynamics of the target host into the first Ansible hosts file;
[0027] Delivery module: used to deliver Ansible tasks to the target host according to the first Ansible hosts file.
[0028] According to a third aspect of the present invention, an electronic device is provided, comprising: a processor and a memory;
[0029] The processor is used to execute an Ansible batch forwarding control method as described in any one of the above items by calling the program or instruction stored in the memory.
[0030] In a fourth aspect of the present invention, a computer-readable storage medium is further proposed, wherein the computer-readable storage medium stores a program or instruction, wherein the program or instruction enables a computer to execute an Ansible batch forwarding control method as described in any one of the above items.
[0031] The beneficial effects of the present invention are as follows: compared with the method in which a target host that cannot be directly connected is directly accessed, the firewall forwarding rules set by the present invention are flexible and controllable, and can be used for whitelist control, thereby basically maintaining the network security of the target host; compared with the method of using sshpass, sshpass can only execute shell scripts on hosts in an isolated network on a directly connected host, and cannot directly issue Ansible commands; the present invention does not need to change the general configuration of the Ansible client, nor does it need to put the instructions on the forwarding host for execution, thereby ensuring the convenience and controllability of the issuing environment; compared with the method of using ssh-l commands, ssh-l requires manual interactive settings and cannot be directly set through Ansible; the present invention does not require interactive settings, and the entire issuing process is imperceptible, efficient, and automated; compared with the method in "A method and system for realizing network element communication in an IP unreachable scenario" authorization number CN202010737939.1, the Ansible client of the present invention does not need to open and listen to ports additionally, thereby meeting the needs when the client does not have the conditions to listen to ports due to network, security, management and other reasons. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The accompanying drawings are only used to illustrate specific embodiments and are not considered to limit the present invention. In the entire drawings, the same reference symbols represent the same components. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.
[0033] Figure 1 A diagram of an Ansible batch forwarding control method provided by an embodiment of the present invention;
[0034] Figure 2 An Ansible batch forwarding control scenario diagram provided for an embodiment of the present invention;
[0035] Figure 3 A schematic diagram of a solution for an Ansible batch forwarding control scenario provided by an embodiment of the present invention;
[0036] Figure 4 A diagram of an Ansible batch forwarding control device provided in an embodiment of the present invention;
[0037] Figure 5 A schematic block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0038] In order 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 in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. It should be understood that these descriptions are only 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 ordinary technicians in the field without making creative work should fall within the scope of protection of the present invention.
[0039] Furthermore, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts disclosed in the present invention.
[0040] In the description of the present invention, the terms "first", "second", and "third" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be internal communication between two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0041] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of methods and systems consistent with some aspects of the present invention as detailed in the appended claims.
[0042] Before introducing the embodiments of the present invention, professional terms involved in the present invention are first introduced.
[0043] Ansible is an open source automation tool for configuration management, application deployment, orchestration, and coordination. It makes automation not only easy to use, but also highly scalable. Ansible uses concise YAML syntax to define tasks and scripts, uses hosts files to define target hosts, connects to target hosts via SSH protocol, and uses Python on the management node itself to execute tasks.
[0044] The present invention proposes an Ansible batch forwarding control method, device, electronic device and storage medium, which support a client to directly issue Ansible instructions in a one-stop manner, do not change the general configuration of the Ansible client, do not need to put the instructions into a forwarding host for execution, the client does not need to monitor the port, and the issuing environment is convenient and controllable; the forwarding rules are flexible and controllable, can be increased or decreased, and take effect immediately without manual interactive operations; through whitelist control, the network security of the target host that cannot be directly connected on the network link is maintained.
[0045] Method Embodiment
[0046] Figure 1 A diagram of an Ansible batch forwarding control method provided by an embodiment of the present invention.
[0047] In the first aspect of the present invention, a method for controlling batch forwarding of Ansible is proposed, combining Figure 1 ,include:
[0048] S1: Determine the forwarding host.
[0049] Specifically, in an embodiment of the present invention, a host that can be directly connected to the target host through Ansible is determined as a forwarding host. Exemplarily, the forwarding host can be a host that directly accesses the target storage virtual machine. Here, the target storage virtual machine cannot be directly accessed by hosts other than the host.
[0050] S2: Send a task to set firewall port forwarding rules to the forwarding host.
[0051] Specifically, in an embodiment of the present invention, setting a firewall port forwarding rule for a forwarding host means setting a firewall forwarding rule for the forwarding host, and setting a corresponding connection whitelist; wherein the firewall forwarding rule includes: an exposed port, a target host IP, and a target port; the connection whitelist includes: an IP of the Ansible task platform.
[0052] S3: Determine the target host, add the target host to the Ansible host list, and write the dynamics of the target host to the first Ansible hosts file.
[0053] Specifically, in an embodiment of the present invention, a host that cannot be directly connected on a network link is determined as a target host, the target host is added to an Ansible host list, and information about the host that cannot be directly connected on a network link is dynamically written into a new Ansible hosts file through an Ansible command.
[0054] Exemplarily, the forwarding host may be a host machine that directly accesses the target storage virtual machine. The target storage virtual machine here cannot be directly accessed by hosts other than the host machine. The target storage virtual machine here is the target host.
[0055] S4: Send Ansible tasks to the target host according to the first Ansible hosts file.
[0056] Specifically, in the embodiment of the present invention, the Ansible task is issued to any target host on the network link as needed through the new Ansible hosts file.
[0057] In the embodiment of the present invention, a forwarding host is determined, a task of setting a firewall port forwarding rule is issued to the forwarding host, a target host is determined, the target host is added to the Ansible host list, the dynamics of the target host are written into the first Ansible hosts file, an Ansible task is issued to the target host according to the first Ansible hosts file, and a task of cancelling the firewall port forwarding rule is issued to the forwarding host. All of these can be achieved in a one-stop manner in the tasks defined in the Ansible YAML file of the management node, which is simple and efficient.
[0058] Furthermore, the above-mentioned Ansible batch forwarding control method further includes:
[0059] Send a task to cancel the firewall port forwarding rule to the forwarding host.
[0060] Specifically, after the task is sent, a task of canceling the firewall port forwarding rule is sent to the forwarding host, which is simple and fast to operate.
[0061] Furthermore, in the above-mentioned Ansible batch forwarding control method, determining the forwarding host includes: determining a host that can be directly connected to the target host through Ansible as the forwarding host.
[0062] Exemplarily, the forwarding host may be a host machine that can directly access the target storage virtual machine through Ansible, and the target storage virtual machine here cannot be directly accessed by hosts other than the host machine.
[0063] Furthermore, in the above-mentioned Ansible batch forwarding control method, sending a task of setting firewall port forwarding rules to the forwarding host includes:
[0064] Set firewall forwarding rules for the forwarding host and set up the corresponding connection whitelist;
[0065] Among them, the firewall forwarding rules include: exposed port, target host IP and target port;
[0066] Connection whitelist, including: IP address of the Ansible task platform.
[0067] For example, the exposed ports are 9001 to 9..n, the target host IP is 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 task platform, which ensures the security of the connection. The firewall forwarding rules and connection whitelist here can be organized in a tabular form, so that the firewall forwarding rules and connection whitelist can be seen more intuitively.
[0068] Furthermore, in the above-mentioned Ansible batch forwarding control method, determining the target host includes: determining a host that cannot be directly connected through a network link as the target host.
[0069] Exemplarily, the forwarding host may be a host machine that directly accesses the target storage virtual machine. The target storage virtual machine here cannot be directly accessed by hosts other than the host machine. The target storage virtual machine here is the target host.
[0070] Furthermore, in the above-mentioned Ansible batch 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] Here, 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 can form an Ansible host list presented in a tabular form.
[0072] Furthermore, in the above-mentioned Ansible batch forwarding control method, the dynamic writing of the target host into the first Ansible hosts file is done through an Ansible command.
[0073] An Ansible batch forwarding control method of the present invention is introduced below in conjunction with a specific embodiment.
[0074] Figure 2 An Ansible batch forwarding control scenario diagram provided by an embodiment of the present invention.
[0075] Combination Figure 2 During the installation and deployment of the Tianyi Cloud iStack cloud native all-in-one machine, the wizard task platform needs to deploy the storage cluster in the target storage virtual machines 192.168.1.1 to 192.168.xn of the host machines 1 to n. However, for data security considerations, the target storage virtual machines cannot be directly accessed by hosts other than the host machine.
[0076] Figure 3 A schematic diagram of a solution for an Ansible batch forwarding control scenario provided by an embodiment of the present invention.
[0077] For the above usage scenario, host 1 is selected as the forwarding host for managing the target storage virtual machine. Figure 3 , including the following steps:
[0078] Step 1: Host 1 connected to by Ansible is the forwarding host.
[0079] Step 2: In the Ansible task, send a task to set the firewall port forwarding rules to the forwarding host, and expose ports 9001 to 9..n, which are forwarded to port 22 of the target storage virtual machine 192.168.1.1 to 192.168.xn respectively. The setting will 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 1, and the port number is the exposed port 9001 to 9..n of the firewall of host 1. It is not limited to these ports and can also be an unoccupied port; the whitelist is the IP of the wizard task platform to ensure the security of the connection.
[0081] Step 4: Directly issue the Ansible task for installing the storage cluster to the target storage VM in the Ansible host list.
[0082] Step 5: After the installation is complete, remove the firewall port forwarding rules of host 1.
[0083] The above five steps realize the one-stop direct distribution of Ansible commands on the wizard-style task platform, without changing the general configuration of the Ansible client, and without having to put the commands on the forwarding host for execution. The distribution environment is convenient and controllable; the forwarding rules are flexible and controllable, can be increased or decreased, and take effect immediately without manual interactive operations; through whitelist control, the network security of the storage cluster in the target storage virtual machine is maintained.
[0084] Device Embodiment
[0085] Figure 4 A diagram of an Ansible batch forwarding control device provided in an embodiment of the present invention.
[0086] A second aspect of the present invention further provides an Ansible batch forwarding control device, comprising:
[0087] The first determining module 41 is used to determine a forwarding host.
[0088] Specifically, in the embodiment of the present invention, the first determination module 41 determines that a host that can be directly connected to the target host through Ansible is a forwarding host. Exemplarily, the forwarding host can be a host 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.
[0089] Setting module 42: used for sending a task of setting firewall port forwarding rules to the forwarding host.
[0090] Specifically, in an embodiment of the present invention, the setting module 42 sends a firewall port forwarding rule to the forwarding host, and sets a firewall forwarding rule for the forwarding host, and sets a corresponding connection whitelist; wherein the firewall forwarding rule includes: exposed port, target host IP and target port; the connection whitelist includes: the IP of the Ansible task platform.
[0091] The adding module 43 and the writing module 44 are used to determine the target host, add the target host to the Ansible host list, and write the dynamics of the target host into the first Ansible hosts file.
[0092] Specifically, in the embodiment of the present 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 the new Ansible hosts file through the Ansible command.
[0093] Exemplarily, the forwarding host may be a host machine that directly accesses the target storage virtual machine. The target storage virtual machine here cannot be directly accessed by hosts other than the host machine. The target storage virtual machine here is the target host.
[0094] The issuing module 45 is used to issue the Ansible task to the target host according to the first Ansible hosts file.
[0095] Specifically, in the embodiment of the present invention, Ansible tasks are issued to any target host on the network link as needed through a new Ansible hosts file.
[0096] In the embodiment of the present device, the first determination module 41 determines the forwarding host, the setting module 42 sends a task of setting a firewall port forwarding rule to the forwarding host, the adding module 43 and the writing module 44 determine the target host, add the target host to the Ansible host list, and write the dynamics of the target host into the first Ansible hosts file. The sending module 45 sends the Ansible task to the target host according to the first Ansible hosts file, and sends the task of canceling the firewall port forwarding rule to the forwarding host. All of these can be implemented in a one-stop manner in the tasks defined in the Ansible YAML file of the management node, which is simple and efficient.
[0097] According to a third aspect of the present invention, an electronic device is provided, comprising: a processor and a memory;
[0098] The processor is used to execute an Ansible batch forwarding control method as described in any one of the above items by calling the program or instruction stored in the memory.
[0099] In a fourth aspect of the present invention, a computer-readable storage medium is further proposed, wherein the computer-readable storage medium stores a program or instruction, and the program or instruction enables a computer to execute an Ansible batch forwarding control method as described in any one of the above items.
[0100] Figure 5 It is a schematic block diagram of an electronic device provided by 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 through a bus system 504. The communication interface 503 is used to transmit information between external devices. It can be understood that the bus system 504 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 504 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 5 Various buses are labeled as bus system 504 .
[0102] It can be understood that the memory 502 in this embodiment can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories.
[0103] In some implementations, the memory 502 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system and application programs.
[0104] The operating system includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application includes various application programs, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services. A program that implements any method in an Ansible batch forwarding control method provided in an embodiment of the present invention can be included in the application.
[0105] In an embodiment of the present invention, the processor 501 calls a program or instruction stored in the memory 502, specifically, a program or instruction stored in an application, and the processor 501 is used to execute the steps of each embodiment of an Ansible batch forwarding control method provided in an embodiment of the present invention.
[0106] Determine the forwarding host;
[0107] Sending a task of setting firewall port forwarding rules to the forwarding host;
[0108] Determine the target host, add the target host to the Ansible host list, and write the dynamics of the target host into the first Ansible hosts file;
[0109] Issue Ansible tasks to the target host according to the first Ansible hosts file.
[0110] Any method in the Ansible batch forwarding control method provided in an embodiment of the present invention can be applied to the processor 501, or implemented by the processor 501. The processor 501 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 501 or an instruction in the form of software. The above-mentioned processor 501 can be a general-purpose processor, a digital signal processor (DigitalSignal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0111] The steps of any method in the Ansible batch forwarding control method provided by the embodiment of the present invention can be directly embodied as being executed by a hardware decoding processor, or being executed by a combination of hardware and software units in the decoding processor. The software unit can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 502, and the processor 501 reads the information in the memory 502 and completes the steps of the method in combination with its hardware.
[0112] Those skilled in the art will appreciate that although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features from different embodiments is meant to be within the scope of the present invention and to form different embodiments.
[0113] Those skilled in the art will appreciate that the description of each embodiment has its own emphasis, and for parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0114] Although the embodiments of the present invention are described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations all fall within the scope defined by the appended claims. The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of various equivalent modifications or substitutions within the technical scope disclosed by the present invention, and these modifications or substitutions should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
[0115] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. An Ansible batch forwarding control method, characterized in that: include: Determine the forwarding host; Sending a task of setting firewall port forwarding rules to the forwarding host; Determine the target host, add the target host to the Ansible host list, and write the dynamics of the target host into the first Ansible hosts file; Issue Ansible tasks to the target host according to the first Ansible hosts file.
2. An Ansible batch forwarding control method according to claim 1, characterized in that: The method further comprises: A task of canceling the firewall port forwarding rule is issued to the forwarding host.
3. The Ansible batch forwarding control method according to claim 1, characterized in that: Determining the forwarding host includes: determining a host that can be directly connected to the target host through Ansible as the forwarding host.
4. The Ansible batch forwarding control method according to claim 1, characterized in that: Sending a task of setting firewall port forwarding rules to the forwarding host includes: Set firewall forwarding rules for the forwarding host and set up the corresponding connection whitelist; Wherein, the firewall forwarding rules include: exposed port, target host IP and target port; The connection whitelist includes: the IP address of the Ansible task platform.
5. The Ansible batch forwarding control method according to claim 1, characterized in that: The determining of the target host includes: determining a host that cannot be directly connected via a network link as the target host.
6. The Ansible batch forwarding control method according to claim 1, characterized in that: 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.
7. The Ansible batch forwarding control method according to claim 1, characterized in that: The dynamic writing of the target host into the first Ansible hosts file is written through an Ansible command.
8. An Ansible batch forwarding control device, characterized in that: include: The first determination module is used to determine the forwarding host; Setting module: used to send a task of setting firewall port forwarding rules to the forwarding host; Join module and write module: used to determine the target host, add the target host to the Ansible host list, and write the dynamics of the target host into the first Ansible hosts file; Delivery module: used to deliver Ansible tasks to the target host according to the first Ansible hosts file.
9. An electronic device, characterized in that: include: Processor and memory; The processor is used to execute an Ansible batch forwarding control method as described in any one of claims 1 to 7 by calling the program or instruction stored in the memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program or instruction, and the program or instruction enables a computer to execute an Ansible batch forwarding control method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Intelligent firewall access rules
CN105765901A
Method and system for realizing network element communication in IP unreachable scene
CN111918306A
Method for automatically deploying high-availability cluster of service system based on ansible
CN112491606A
Dynamic monitoring-based iptables firewall policy auditing method and device, and medium
CN115567293A
Method for improving network security and related equipment
CN116055083A
