Eerror! Conflicting Action Statements: User, Update_Password

I decided to write a simple script, but something went wrong, I hope for your help.

---
- name: Reset root password, disable users
  hosts: all
  become: yes
  become_user: root
  vars:
    vault_ansible_production_root_password: 123456
  tasks:
    - name: Reset root password
      user:
        name: root
        password: "{{vault_ansible_production_root_password}}"
      update_password: always
    - name: Disable user accounts
      user:
        name: "*"
        state: absent
        uid: ">=1000"
        remove: yes

ERROR! conflicting action statements: user, update_password

The error appears to be in '/etc/an_script/work.yml': line 8, column 7, but may be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

tasks: - name: Reset root password ^ here PS

I'm just starting, please don't throw too many tomatoes )))

Ran through debug

1 Answer

Indentation's wrong.

With your current code, "user" and "update_password" are at the same level: Ansible doesn't know which one is the plugin to call: conflicting statement

Try this instead:

tasks:
- name: Reset root password
  user:
    name: root
    password: "{{vault_ansible_production_root_password}}"
    update_password: always

See docs, params of that module should be one level down:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest