mirror of https://github.com/jumpserver/jumpserver
feat: 添加自动化任务rdp ping
parent
f64073f48f
commit
dedc42d775
|
@ -1,11 +1,12 @@
|
|||
- hosts: custom
|
||||
gather_facts: no
|
||||
vars:
|
||||
ansible_shell_type: sh
|
||||
ansible_connection: local
|
||||
|
||||
tasks:
|
||||
- name: Verify account
|
||||
ssh_ping:
|
||||
- name: Verify account (pyfreerdp)
|
||||
rdp_ping:
|
||||
login_host: "{{ jms_asset.address }}"
|
||||
login_port: "{{ jms_asset.port }}"
|
||||
login_user: "{{ account.username }}"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
ansible_connection: local
|
||||
|
||||
tasks:
|
||||
- name: Verify account
|
||||
- name: Verify account (paramiko)
|
||||
ssh_ping:
|
||||
login_host: "{{ jms_asset.address }}"
|
||||
login_port: "{{ jms_asset.port }}"
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
- hosts: custom
|
||||
gather_facts: no
|
||||
vars:
|
||||
ansible_shell_type: sh
|
||||
ansible_connection: local
|
||||
|
||||
tasks:
|
||||
- name: Test asset connection (pyfreerdp)
|
||||
rdp_ping:
|
||||
login_user: "{{ jms_account.username }}"
|
||||
login_password: "{{ jms_account.secret }}"
|
||||
login_host: "{{ jms_asset.address }}"
|
||||
login_port: "{{ jms_asset.port }}"
|
||||
login_secret_type: "{{ jms_account.secret_type }}"
|
||||
login_private_key_path: "{{ jms_account.private_key_path }}"
|
|
@ -0,0 +1,13 @@
|
|||
id: ping_by_rdp
|
||||
name: "{{ 'Ping by pyfreerdp' | trans }}"
|
||||
category:
|
||||
- device
|
||||
- host
|
||||
type:
|
||||
- windows
|
||||
method: ping
|
||||
i18n:
|
||||
Ping by pyfreerdp:
|
||||
zh: 使用 Python 模块 pyfreerdp 测试主机可连接性
|
||||
en: Ping by pyfreerdp module
|
||||
ja: Pyfreerdpモジュールを使用してホストにPingする
|
|
@ -4,7 +4,7 @@
|
|||
ansible_connection: local
|
||||
|
||||
tasks:
|
||||
- name: Test asset connection
|
||||
- name: Test asset connection (paramiko)
|
||||
ssh_ping:
|
||||
login_user: "{{ jms_account.username }}"
|
||||
login_password: "{{ jms_account.secret }}"
|
|
@ -39,10 +39,6 @@ import pyfreerdp
|
|||
from typing import NamedTuple
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ops.ansible.modules_utils.custom_common import (
|
||||
common_argument_spec
|
||||
)
|
||||
|
||||
|
||||
# =========================================
|
||||
# Module execution.
|
||||
|
@ -55,6 +51,18 @@ class Param(NamedTuple):
|
|||
password: str
|
||||
|
||||
|
||||
def common_argument_spec():
|
||||
options = dict(
|
||||
login_host=dict(type='str', required=False, default='localhost'),
|
||||
login_port=dict(type='int', required=False, default=22),
|
||||
login_user=dict(type='str', required=False, default='root'),
|
||||
login_password=dict(type='str', required=False, no_log=True),
|
||||
login_secret_type=dict(type='str', required=False, default='password'),
|
||||
login_private_key_path=dict(type='str', required=False, no_log=True),
|
||||
)
|
||||
return options
|
||||
|
||||
|
||||
def main():
|
||||
options = common_argument_spec()
|
||||
module = AnsibleModule(argument_spec=options, supports_check_mode=True)
|
||||
|
|
Loading…
Reference in New Issue