Ansible user home directory issue

763 views
Skip to first unread message

Bala Mutyam

unread,
Feb 13, 2020, 4:55:21 AM2/13/20
to Ansible Project
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

Kai Stian Olstad

unread,
Feb 13, 2020, 5:36:33 AM2/13/20
to ansible...@googlegroups.com
On Thu, Feb 13, 2020 at 01:55:20AM -0800, Bala Mutyam wrote:
> Hi all,
>
> ansible --version
> ansible 2.7.7
>
>
> I'm not sure if it's a bug?

No, why would you think that?
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.

--
Kai Stian Olstad

Bala Mutyam

unread,
Feb 14, 2020, 6:02:47 AM2/14/20
to Ansible Project
I thought because of the /home/user in the /etc/passwd.

Ok,thanks for the clarification.
Reply all
Reply to author
Forward
0 new messages