levonet.ci_get_free_port
CI:获取空闲TCP端口
这个角色用于在远程主机上获取空闲的TCP端口。
角色变量
ci_get_free_port__var
(默认值:ci_get_free_port):这个变量包含将写入空闲端口的变量名称。ci_get_free_port__pool
(默认值:1024-32767):将在此范围内查找空闲端口。ci_get_free_port__host
(默认值:127.0.0.1):将检查空闲端口的IP地址。ci_get_free_port__default
(默认值:""):如果在范围内未找到空闲端口,将写入该变量的值。
需求
远程主机上必须安装 nmap
(或 nc
)工具。
示例剧本
- hosts: all
become: yes
become_method: sudo
vars:
ci_get_free_port__var: project_port
roles:
- role: levonet.ci_get_free_port
tasks:
- debug:
msg: "端口:{{ project_port }}"
许可
作者信息
此角色由 Pavlo Bashynskyi 创建。