This is the error I am facing. Kindly check and let me know what is the issue. I have encrypted the password as directed.
This is my code
- name: create group
hosts: stapp02
become: true
vars:
dev_pass: !vault |
$ANSIBLE_VAULT;1.1;AES256
admin_pass: !vault |
$ANSIBLE_VAULT;1.1;AES256
vars_files:
- /home/thor/playbooks/data/users.yml
tasks:
- name: create groups
group:
name: admins
state: present
- name: create groups
group:
name: developers
state: present
- name: create users and add them there groups
user:
name: “{{ item }}”
groups:
- admins
- wheel
state: present
home: /home/{{ item }}
password: “{{ admin_pass }}”
with_items: “{{ admins }}”
- name: create users and add them there groups
user:
name: “{{ item }}”
groups: developers
state: present
home: /var/www/
password: “{{ dev_pass }}”
with_items: “{{ developers }}”
Hi @krishna.k15896,
If not done yet, please share your work under the “Review” section. I tried to run your playbook and had many issues.
I request you to please share the playbook in the correct format.
Regards,
Use this option to share the playbook in the correct format.
You have to use that encrypted password in the playbook, also. And did you configure the vault secret
file in the ansible.cfg?
- name: create group
hosts: stapp02
become: true
vars:
dev_pass: !vault |
$ANSIBLE_VAULT;1.1;AES256
admin_pass: !vault |
$ANSIBLE_VAULT;1.1;AES256
vars_files:
- /home/thor/playbooks/data/users.yml
tasks:
- name: create groups
group:
name: admins
state: present
- name: create groups
group:
name: developers
state: present
- name: create users and add them there groups
user:
name: “{{ item }}”
groups:
- admins
- wheel
state: present
home: /home/{{ item }}
password: “{{ admin_pass }}”
with_items: “{{ admins }}”
- name: create users and add them there groups
user:
name: “{{ item }}”
groups: developers
state: present
home: /var/www/
password: “{{ dev_pass }}”
with_items: “{{ developers }}”
This is my code, I have used vault file in cfg file and encrpyted password too. Also, requested for the review.
@Tej-Singh-Rana Could you please check the above code.
Also, I have pushed it review. But, now I want to try another solution I am unable to do it. Can you help me fix this please.
Hi @krishna.k15896,
Try again now.
I am able to solve this. Thanks for your help