I would like to create a user with a clean home directory, but when using the user module, I get by default the files .bashrc, .bash_logout and .profile (these are the defaults in /etc/skel/)
How do I create a user without them?
Relevant part of playbook:
- name: Create user
become: true
user:
name: johndoe
state: present
shell: /bin/bash
system: no
createhome: yes
home: /data/johndoe
You have to set skeleton to /dev/null, like this:
- name: Create user
become: true
user:
name: johndoe
state: present
shell: /bin/bash
system: no
createhome: yes
home: /data/johndoe
skeleton: /dev/null # <- add this line
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With