The `user` module reports `changed` on every run for the `password` parameter
AdvancedTroubleshootingModules, Idempotency and Handlers
Answer
Likely causes → password_hash('sha512') generates a random salt each run, so the hash is always different from the one in /etc/shadow.
Fix → Use a stable salt per host, or only set the password when the user is created:
- ansible.builtin.user:
name: deploy
password: "{{ deploy_password | password_hash('sha512', deploy_salt) }}"
update_password: on_create
no_log: true
Here deploy_salt is a fixed vaulted string of 16 characters or fewer ([./a-zA-Z0-9]).
Prevent → Prefer SSH keys and disable passwords for service accounts. When passwords are required, store the pre-computed hash in Vault.
More on Modules, Idempotency and Handlers
`ERROR! The requested handler 'Restart nginx' was not found in either the main handlers list nor in the listening handlers list`BeginnerA handler named `restart {{ app_service }}` is never found when notified as `restart myapp`AdvancedA `command` task reports `changed` on every run, and the Molecule idempotence check failsBeginner`curl ... | tar xz` fails on the host but the `shell` task reports successIntermediate`lineinfile` appends the same line again on every runIntermediate`lineinfile` with `backrefs: true` reports `ok` but the line was never addedIntermediate