Files
2026-05-19 06:57:40 +02:00

31 lines
779 B
YAML

---
- name: Change account password
hosts: all
gather_facts: false
become: true
vars:
target_account_name: >-
{{ password_target_user | default(ansible_user, true) }}
vars_prompt:
- name: new_account_password
prompt: New password for the target account
private: true
confirm: true
pre_tasks:
- name: Validate target user
ansible.builtin.assert:
that:
- target_account_name is defined
- target_account_name | length > 0
fail_msg: "Set password_target_user or ansible_user for each host."
tasks:
- name: Update password for target account
ansible.builtin.command:
cmd: chpasswd
stdin: "{{ target_account_name }}:{{ new_account_password }}"
no_log: true