perf: update ad account push and test

This commit is contained in:
ibuler
2026-04-27 15:32:36 +08:00
parent 3afa86f1e8
commit f03416eed1
6 changed files with 1557 additions and 1529 deletions

View File

@@ -5,14 +5,14 @@
ansible.windows.win_ping:
- name: Change password
community.windows.win_domain_user:
microsoft.ad.user:
name: "{{ account.username }}"
password: "{{ account.secret }}"
update_password: always
password_never_expires: yes
state: present
groups: "{{ params.groups }}"
groups_action: add
groups:
add: "{{ params.groups }}"
ignore_errors: true
when: account.secret_type == "password"
@@ -22,7 +22,7 @@
- name: Verify password (win_ping)
ansible.windows.win_ping:
vars:
ansible_user: "{{ account.full_username }}"
ansible_user: "{{ account.username }}"
ansible_password: "{{ account.secret }}"
when: account.secret_type == "password" and check_conn_after_change
register: verify_winping
@@ -43,4 +43,8 @@
- verify_winping is not defined
or (verify_winping.unreachable | default(false))
or (verify_winping.failed | default(false))
delegate_to: localhost
vars:
ansible_connection: local
ansible_shell_type: sh
ansible_python_interpreter: "{{ local_python_interpreter }}"
delegate_to: 127.0.0.1

View File

@@ -28,4 +28,7 @@
login_secret_type: "{{ account.secret_type }}"
gateway_args: "{{ jms_gateway | default({}) }}"
when: account.secret_type == "password" and check_conn_after_change
delegate_to: localhost
vars:
ansible_connection: local
ansible_shell_type: sh
ansible_python_interpreter: "{{ local_python_interpreter }}"

View File

@@ -5,14 +5,14 @@
ansible.windows.win_ping:
- name: Push user password
community.windows.win_domain_user:
microsoft.ad.user:
name: "{{ account.username }}"
password: "{{ account.secret }}"
update_password: always
password_never_expires: yes
state: present
groups: "{{ params.groups }}"
groups_action: add
groups:
add: "{{ params.groups }}"
ignore_errors: true
when: account.secret_type == "password"
@@ -22,7 +22,7 @@
- name: Verify password (win_ping)
ansible.windows.win_ping:
vars:
ansible_user: "{{ account.full_username }}"
ansible_user: "{{ account.username }}"
ansible_password: "{{ account.secret }}"
when: account.secret_type == "password" and check_conn_after_change
register: verify_winping
@@ -43,4 +43,7 @@
- verify_winping is not defined
or (verify_winping.unreachable | default(false))
or (verify_winping.failed | default(false))
delegate_to: localhost
vars:
ansible_connection: local
ansible_shell_type: sh
ansible_python_interpreter: "{{ local_python_interpreter }}"

View File

@@ -28,4 +28,7 @@
login_secret_type: "{{ account.secret_type }}"
gateway_args: "{{ jms_gateway | default({}) }}"
when: account.secret_type == "password" and check_conn_after_change
delegate_to: localhost
vars:
ansible_connection: local
ansible_shell_type: sh
ansible_python_interpreter: "{{ local_python_interpreter }}"

View File

@@ -259,6 +259,7 @@ class PlaybookPrepareMixin:
def write_cert_to_file(filename, content):
with open(filename, "w") as f:
f.write(content)
os.chmod(filename, 0o600)
return filename
def convert_cert_to_file(self, host, path_dir):

3048
uv.lock generated

File diff suppressed because it is too large Load Diff