Team,
This task is always failing . Please help . This is how I did . All users were created under their respective groups , still it failed
Command to encrypt the password :
ansible-vault encrypt_string BruCStnMT5 : Developer
ansible-vault encrypt_string YchZHRcLkL : Admin
Playbook:
- hosts: stapp02
become: yes
gather_facts: no
vars:
admin_pass: !vault |
$ANSIBLE_VAULT;1.1;AES256
31303937316339393534663439643931653133353061313134313238646531663330353636643136
3135623931666662643332396363646437646462616432640a333234623237663032666231663135
34393561613438626530373837626563373336383264306366366337376436393939363265323436
3265636134353139310a343036636137343535346636323137306135346130633135383162663031
3339
developer_pass: !vault |
$ANSIBLE_VAULT;1.1;AES256
39386462303030626631333965656261323834376465636536363934373836643266366536353665
3162623831326563383538646138306634313232303536620a316364646530393366643537363162
33393666396461383734623364626365333763323335316566616138386163333833383838666661
3535643336333834300a333164626165363635653364656537666534343830366366353964616436
3036
tasks:-
name: create groups
group:
name: “{{ item }}”
state: present
with_items:- admins
- developers
-
name: Include user.yml
include_vars:
file: data/users.yml -
name: Creating admins
user:
name: “{{ item }}”
password: “{{ admin_pass | string | password_hash(‘sha512’) }}”
groups: wheel,admins
with_items: “{{ admins | list }}” -
name: creating developers
user:
name: “{{ item }}”
password: “{{ developer_pass | string | password_hash(‘sha512’) }}”
home: /var/www
groups: developers
-