# Ansible user home directory issue

**URL:** <https://forum.ansible.com/t/ansible-user-home-directory-issue/32220>\
**Category:** Ansible Project\
**Created:** [February 13, 2020, 9:55am UTC](https://forum.ansible.com/t/ansible-user-home-directory-issue/32220 "2020-02-13T09:55:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bala\_Mutyam](https://avatars.discourse-cdn.com/v4/letter/b/65b543/32.png) [@Bala\_Mutyam](https://forum.ansible.com/u/Bala_Mutyam)\
**Post date:** [February 13, 2020, 9:55am UTC](https://forum.ansible.com/t/ansible-user-home-directory-issue/32220/1 "2020-02-13T09:55:20Z")

</div>

Hi all,

ansible --version  
ansible 2.7.7

I’m not sure if it’s a bug?

I’m creating a system user & group without home directory and --disabled-login but in the /etc/passwd , it’s showing as home directory created but it doesn’t exist.

Playbook:

- name: Create sonarqube group  
group:  
name: sonarqube  
system: yes  
state: present
- name: Create sonarqube user account  
user:  
name: sonarqube  
group: sonarqube  
create\_home: no  
system: yes  
state: present  
password: ‘!’

cat /etc/passwd

sonarqube:x:998:998::/home/sonarqube:/bin/sh

cat /etc/group

sonarqube:x:998:

cat /etc/shadow

sonarqube:!:18305::::::

ls -l /home/sonarqube  
ls: cannot access ‘/home/sonarqube’: No such file or directory

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [February 13, 2020, 10:36am UTC](https://forum.ansible.com/t/ansible-user-home-directory-issue/32220/2 "2020-02-13T10:36:06Z")

</div>

> Hi all,
> 
> ansible --version  
> ansible 2.7.7
> 
> I'm not sure if it's a bug?

No, why would you think that?

> I'm creating a system user & group without home directory and  
> --disabled-login but in the /etc/passwd , it's showing as home directory  
> created but it doesn't exist.
> 
> Playbook:
> 
> - name: Create sonarqube group  
> &nbsp;&nbsp;group:  
> &nbsp;&nbsp;&nbsp;&nbsp;name: sonarqube  
> &nbsp;&nbsp;&nbsp;&nbsp;system: yes  
> &nbsp;&nbsp;&nbsp;&nbsp;state: present  
> - name: Create sonarqube user account  
> &nbsp;&nbsp;user:  
> &nbsp;&nbsp;&nbsp;&nbsp;name: sonarqube  
> &nbsp;&nbsp;&nbsp;&nbsp;group: sonarqube  
> &nbsp;&nbsp;&nbsp;&nbsp;create\_home: no  
> &nbsp;&nbsp;&nbsp;&nbsp;system: yes  
> &nbsp;&nbsp;&nbsp;&nbsp;state: present  
> &nbsp;&nbsp;&nbsp;&nbsp;password: '!'
> 
> cat /etc/passwd  
> sonarqube:x:998:998::/home/sonarqube:/bin/sh
> 
> cat /etc/group  
> sonarqube:x:998:
> 
> cat /etc/shadow  
> sonarqube:!:18305::::::
> 
> ls -l /home/sonarqube  
> ls: cannot access '/home/sonarqube': No such file or directory

It doesn't show it as created you ls demonstrate that.

Setting HOME dir in /etc/passwd is default behavior (same as useradd/adduser commands) and  
has nothing to do with the directory being created or not.

If you want other value, set the home parameter on the user module.

---

<div class="post-metadata">

**Author:** ![Bala\_Mutyam](https://avatars.discourse-cdn.com/v4/letter/b/65b543/32.png) [@Bala\_Mutyam](https://forum.ansible.com/u/Bala_Mutyam)\
**Post date:** [February 14, 2020, 11:02am UTC](https://forum.ansible.com/t/ansible-user-home-directory-issue/32220/3 "2020-02-14T11:02:47Z")

</div>

I thought because of the /home/user in the /etc/passwd.

Ok,thanks for the clarification.
