Ansible Create Users and Groups - failed with no information

The task got failed without any information. Can you please check what went wrong?

Task Status - Failed
You may check your work again to see what went wrong. The environment expires in 5 minutes. If you think you did your work correctly and is marked failed, please take outputs/screenshot of your work and post in community.kodekloud.com.

something is strange with that task @Inderpreet @mmumshad can you check for us what’s wrong with it please ?

This issue is already resolved on another thread

1 Like

@rahul456
Ansible Create Users and Groups

Task Status - Failed
  • ‘rob’ user’s password is incorrect

You may check your work again to see what went wrong. The environment expires in 5 minutes. If you think you did your work correctly and is marked failed, please take outputs/screenshot of your work and post in community.kodekloud.com.

I have encrypted the password given in question and used the same in playbook but still task failed.
Kindly check on it.

hor@jump_host ~/playbooks$ ansible-vault encrypt_string ‘8FmzjvFU6S’ --vault-password-file=~/playbooks/secrets/vault.txt
!vault |
ANSIBLE_VAULT;1.1;AES256 38343766663138366639393765386562323763313163306666636133386230633363656362393566 3463336133616562353064346663346166616433396631380a366535373963373762663936333764 33363530663863336432633138396134336564306532343132363862343738646639333831373765 3436326466313765310a343737363936343864356563656536636132616530396534353064383035 3632 Encryption successful thor@jump_host ~/playbooks ansible-vault encrypt_string ‘LQfKeWWxWD’ --vault-password-file=~/playbooks/secrets/vault.txt
!vault |
$ANSIBLE_VAULT;1.1;AES256
61636131313337633865303366353135656364373762313334323535383133353838363934313534
3966646138643839376666623664616437323261376431380a656633326236353332313332376136
31633634366265656264383232633262643964666235303137383662663336336639366239626434
3338356330613536630a376634356238313266626361656234326563633765653462363366303231
3461
Encryption successful

  • name: user and group creation
    hosts: stapp03
    become: true
    vars_files:
    • ~/playbooks/data/users.yml
      vars:
      password: !vault |
      $ANSIBLE_VAULT;1.1;AES256
      38343766663138366639393765386562323763313163306666636133386230633363656362393566
      3463336133616562353064346663346166616433396631380a366535373963373762663936333764
      33363530663863336432633138396134336564306532343132363862343738646639333831373765
      3436326466313765310a343737363936343864356563656536636132616530396534353064383035
      3632
      password1: !vault |
      $ANSIBLE_VAULT;1.1;AES256
      61636131313337633865303366353135656364373762313334323535383133353838363934313534
      3966646138643839376666623664616437323261376431380a656633326236353332313332376136
      31633634366265656264383232633262643964666235303137383662663336336639366239626434
      3338356330613536630a376634356238313266626361656234326563633765653462363366303231
      3461
      tasks:
    • name: group creation
      group:
      name: “{{item}}”
      state: present
      with_items:
      • developers
      • admins
    • name: user creation
      user:
      name: “{{item}}”
      state: present
      groups: “admins, wheel”
      password: “{{ password1 }}”
      loop:
      “{{admins}}”
    • name: user creation
      user:
      name: “{{item}}”
      state: present
      groups: developers
      home: /var/www
      password: “{{ password }}”
      loop:
      “{{developers}}”
      thor@jump_host ~/playbooks$

thor@jump_host ~/playbooks$ cat ansible.cfg
[defaults]
host_key_checking = False
vault_password_file = ~/playbooks/secrets/vault.txt
thor@jump_host ~/playbooks$