perf: Change secret

pull/15121/head
feng 2025-03-25 16:03:09 +08:00 committed by ZhaoJiSen
parent 5f2e838342
commit 266ea9b858
4 changed files with 32 additions and 8 deletions

View File

@ -41,6 +41,7 @@
password: "{{ account.secret | password_hash('des') }}"
update_password: always
ignore_errors: true
register: change_secret_result
when: account.secret_type == "password"
- name: "Get home directory for {{ account.username }}"
@ -83,6 +84,7 @@
user: "{{ account.username }}"
key: "{{ account.secret }}"
exclusive: "{{ ssh_params.exclusive }}"
register: change_secret_result
when: account.secret_type == "ssh_key"
- name: Refresh connection
@ -101,7 +103,9 @@
become_password: "{{ account.become.ansible_password | default('') }}"
become_private_key_path: "{{ account.become.ansible_ssh_private_key_file | default(None) }}"
old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}"
when: account.secret_type == "password" and check_conn_after_change
when:
- account.secret_type == "password"
- check_conn_after_change or change_secret_result.failed
delegate_to: localhost
- name: "Verify {{ account.username }} SSH KEY (paramiko)"
@ -112,5 +116,7 @@
login_private_key_path: "{{ account.private_key_path }}"
gateway_args: "{{ jms_asset.ansible_ssh_common_args | default(None) }}"
old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}"
when: account.secret_type == "ssh_key" and check_conn_after_change
when:
- account.secret_type == "ssh_key"
- check_conn_after_change or change_secret_result.failed
delegate_to: localhost

View File

@ -41,6 +41,7 @@
password: "{{ account.secret | password_hash('sha512') }}"
update_password: always
ignore_errors: true
register: change_secret_result
when: account.secret_type == "password"
- name: "Get home directory for {{ account.username }}"
@ -83,6 +84,7 @@
user: "{{ account.username }}"
key: "{{ account.secret }}"
exclusive: "{{ ssh_params.exclusive }}"
register: change_secret_result
when: account.secret_type == "ssh_key"
- name: Refresh connection
@ -101,7 +103,9 @@
become_password: "{{ account.become.ansible_password | default('') }}"
become_private_key_path: "{{ account.become.ansible_ssh_private_key_file | default(None) }}"
old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}"
when: account.secret_type == "password" and check_conn_after_change
when:
- account.secret_type == "password"
- check_conn_after_change or change_secret_result.failed
delegate_to: localhost
- name: "Verify {{ account.username }} SSH KEY (paramiko)"
@ -112,5 +116,7 @@
login_private_key_path: "{{ account.private_key_path }}"
gateway_args: "{{ jms_asset.ansible_ssh_common_args | default(None) }}"
old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}"
when: account.secret_type == "ssh_key" and check_conn_after_change
when:
- account.secret_type == "ssh_key"
- check_conn_after_change or change_secret_result.failed
delegate_to: localhost

View File

@ -41,6 +41,7 @@
password: "{{ account.secret | password_hash('des') }}"
update_password: always
ignore_errors: true
register: change_secret_result
when: account.secret_type == "password"
- name: "Get home directory for {{ account.username }}"
@ -83,6 +84,7 @@
user: "{{ account.username }}"
key: "{{ account.secret }}"
exclusive: "{{ ssh_params.exclusive }}"
register: change_secret_result
when: account.secret_type == "ssh_key"
- name: Refresh connection
@ -101,7 +103,9 @@
become_password: "{{ account.become.ansible_password | default('') }}"
become_private_key_path: "{{ account.become.ansible_ssh_private_key_file | default(None) }}"
old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}"
when: account.secret_type == "password" and check_conn_after_change
when:
- account.secret_type == "password"
- check_conn_after_change or change_secret_result.failed
delegate_to: localhost
- name: "Verify {{ account.username }} SSH KEY (paramiko)"
@ -112,6 +116,8 @@
login_private_key_path: "{{ account.private_key_path }}"
gateway_args: "{{ jms_asset.ansible_ssh_common_args | default(None) }}"
old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}"
when: account.secret_type == "ssh_key" and check_conn_after_change
when:
- account.secret_type == "ssh_key"
- check_conn_after_change or change_secret_result.failed
delegate_to: localhost

View File

@ -41,6 +41,7 @@
password: "{{ account.secret | password_hash('sha512') }}"
update_password: always
ignore_errors: true
register: change_secret_result
when: account.secret_type == "password"
- name: "Get home directory for {{ account.username }}"
@ -83,6 +84,7 @@
user: "{{ account.username }}"
key: "{{ account.secret }}"
exclusive: "{{ ssh_params.exclusive }}"
register: change_secret_result
when: account.secret_type == "ssh_key"
- name: Refresh connection
@ -101,7 +103,9 @@
become_password: "{{ account.become.ansible_password | default('') }}"
become_private_key_path: "{{ account.become.ansible_ssh_private_key_file | default(None) }}"
old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}"
when: account.secret_type == "password" and check_conn_after_change
when:
- account.secret_type == "password"
- check_conn_after_change or change_secret_result.failed
delegate_to: localhost
- name: "Verify {{ account.username }} SSH KEY (paramiko)"
@ -112,6 +116,8 @@
login_private_key_path: "{{ account.private_key_path }}"
gateway_args: "{{ jms_asset.ansible_ssh_common_args | default(None) }}"
old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}"
when: account.secret_type == "ssh_key" and check_conn_after_change
when:
- account.secret_type == "ssh_key"
- check_conn_after_change or change_secret_result.failed
delegate_to: localhost