diff --git a/apps/accounts/automations/change_secret/custom/ssh/main.yml b/apps/accounts/automations/change_secret/custom/ssh/main.yml index 25d26e549..c4381b730 100644 --- a/apps/accounts/automations/change_secret/custom/ssh/main.yml +++ b/apps/accounts/automations/change_secret/custom/ssh/main.yml @@ -1,9 +1,9 @@ - hosts: custom gather_facts: no vars: + asset_port: "{{ jms_asset.protocols | selectattr('name', 'equalto', 'ssh') | map(attribute='port') | first }}" ansible_connection: local ansible_become: false - asset_port: "{{ jms_asset.protocols | selectattr('name', 'equalto', 'ssh') | map(attribute='port') | first }}" tasks: - name: Test privileged account (paramiko) @@ -20,6 +20,7 @@ become_password: "{{ custom_become_password | default('') }}" become_private_key_path: "{{ custom_become_private_key_path | default(None) }}" register: ping_info + delegate_to: localhost - name: Change asset password (paramiko) custom_command: @@ -41,6 +42,7 @@ ignore_errors: true when: ping_info is succeeded register: change_info + delegate_to: localhost - name: Verify password (paramiko) ssh_ping: @@ -53,3 +55,4 @@ become_user: "{{ account.become.ansible_user | default('') }}" become_password: "{{ account.become.ansible_password | default('') }}" become_private_key_path: "{{ account.become.ansible_ssh_private_key_file | default(None) }}" + delegate_to: localhost diff --git a/apps/accounts/automations/change_secret/host/windows_rdp_verify/main.yml b/apps/accounts/automations/change_secret/host/windows_rdp_verify/main.yml new file mode 100644 index 000000000..e1ced1359 --- /dev/null +++ b/apps/accounts/automations/change_secret/host/windows_rdp_verify/main.yml @@ -0,0 +1,35 @@ +- hosts: demo + gather_facts: no + tasks: + - name: Test privileged account + ansible.windows.win_ping: + +# - name: Print variables +# debug: +# msg: "Username: {{ account.username }}, Password: {{ account.secret }}" + + - name: Change password + ansible.windows.win_user: + fullname: "{{ account.username}}" + name: "{{ account.username }}" + password: "{{ account.secret }}" + password_never_expires: yes + groups: "{{ params.groups }}" + groups_action: add + update_password: always + ignore_errors: true + when: account.secret_type == "password" + + - name: Refresh connection + ansible.builtin.meta: reset_connection + + - name: Verify password (pyfreerdp) + rdp_ping: + login_host: "{{ jms_asset.address }}" + login_port: "{{ jms_asset.protocols | selectattr('name', 'equalto', 'rdp') | map(attribute='port') | first }}" + login_user: "{{ account.username }}" + login_password: "{{ account.secret }}" + login_secret_type: "{{ account.secret_type }}" + login_private_key_path: "{{ account.private_key_path }}" + when: account.secret_type == "password" + delegate_to: localhost diff --git a/apps/accounts/automations/change_secret/host/windows_rdp_verify/manifest.yml b/apps/accounts/automations/change_secret/host/windows_rdp_verify/manifest.yml new file mode 100644 index 000000000..52f0e02df --- /dev/null +++ b/apps/accounts/automations/change_secret/host/windows_rdp_verify/manifest.yml @@ -0,0 +1,26 @@ +id: change_secret_windows_rdp_verify +name: "{{ 'Windows account change secret rdp verify' | trans }}" +version: 1 +method: change_secret +category: host +type: + - windows +params: + - name: groups + type: str + label: '用户组' + default: 'Users,Remote Desktop Users' + help_text: "{{ 'Params groups help text' | trans }}" + + +i18n: + Windows account change secret rdp verify: + zh: '使用 Ansible 模块 win_user 执行 Windows 账号改密 RDP 协议测试最后的可连接性' + ja: 'Ansibleモジュールwin_userはWindowsアカウントの改密RDPプロトコルテストの最後の接続性を実行する' + en: 'Using the Ansible module win_user performs Windows account encryption RDP protocol testing for final connectivity' + + Params groups help text: + zh: '请输入用户组,多个用户组使用逗号分隔(需填写已存在的用户组)' + ja: 'グループを入力してください。複数のグループはコンマで区切ってください(既存のグループを入力してください)' + en: 'Please enter the group. Multiple groups are separated by commas (please enter the existing group)' + diff --git a/apps/accounts/automations/push_account/host/windows_rdp_verify/main.yml b/apps/accounts/automations/push_account/host/windows_rdp_verify/main.yml new file mode 100644 index 000000000..29f4fb022 --- /dev/null +++ b/apps/accounts/automations/push_account/host/windows_rdp_verify/main.yml @@ -0,0 +1,35 @@ +- hosts: demo + gather_facts: no + tasks: + - name: Test privileged account + ansible.windows.win_ping: + +# - name: Print variables +# debug: +# msg: "Username: {{ account.username }}, Password: {{ account.secret }}" + + - name: Push user password + ansible.windows.win_user: + fullname: "{{ account.username}}" + name: "{{ account.username }}" + password: "{{ account.secret }}" + password_never_expires: yes + groups: "{{ params.groups }}" + groups_action: add + update_password: always + ignore_errors: true + when: account.secret_type == "password" + + - name: Refresh connection + ansible.builtin.meta: reset_connection + + - name: Verify password (pyfreerdp) + rdp_ping: + login_host: "{{ jms_asset.address }}" + login_port: "{{ jms_asset.protocols | selectattr('name', 'equalto', 'rdp') | map(attribute='port') | first }}" + login_user: "{{ account.username }}" + login_password: "{{ account.secret }}" + login_secret_type: "{{ account.secret_type }}" + login_private_key_path: "{{ account.private_key_path }}" + when: account.secret_type == "password" + delegate_to: localhost diff --git a/apps/accounts/automations/push_account/host/windows_rdp_verify/manifest.yml b/apps/accounts/automations/push_account/host/windows_rdp_verify/manifest.yml new file mode 100644 index 000000000..449cf726f --- /dev/null +++ b/apps/accounts/automations/push_account/host/windows_rdp_verify/manifest.yml @@ -0,0 +1,19 @@ +id: push_account_windows_rdp_verify +name: "{{ 'Windows account push rdp verify' | trans }}" +version: 1 +method: push_account +category: host +type: + - windows +params: + - name: groups + type: str + label: '用户组' + default: 'Users,Remote Desktop Users' + help_text: '请输入用户组,多个用户组使用逗号分隔(需填写已存在的用户组)' + +i18n: + Windows account push rdp verify: + zh: 使用 Ansible 模块 win_user 执行 Windows 账号推送 RDP 协议测试最后的可连接性 + ja: Ansibleモジュールwin_userがWindowsアカウントプッシュRDPプロトコルテストを実行する最後の接続性 + en: Using the Ansible module win_user performs Windows account push RDP protocol testing for final connectivity